You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/1881.e5fa17a6.async.js

3328 lines
2.2 MiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

!(function(){var Ef=Math.pow;var $0=(qn,Li,G)=>new Promise((Mt,kt)=>{var vt=ft=>{try{ut(G.next(ft))}catch(Pt){kt(Pt)}},le=ft=>{try{ut(G.throw(ft))}catch(Pt){kt(Pt)}},ut=ft=>ft.done?Mt(ft.value):Promise.resolve(ft.value).then(vt,le);ut((G=G.apply(qn,Li)).next())});(self.webpackChunk=self.webpackChunk||[]).push([[1881],{40001:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Q}});var Mt=G(32855),kt=G(59301),vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},le=vt,ut=G(7657),ft=function(yt,be){return kt.createElement(ut.Z,(0,Mt.Z)({},yt,{ref:be,icon:le}))},Pt=kt.forwardRef(ft),Q=Pt},84105:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Q}});var Mt=G(32855),kt=G(59301),vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},le=vt,ut=G(7657),ft=function(yt,be){return kt.createElement(ut.Z,(0,Mt.Z)({},yt,{ref:be,icon:le}))},Pt=kt.forwardRef(ft),Q=Pt},18785:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Q}});var Mt=G(32855),kt=G(59301),vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},le=vt,ut=G(7657),ft=function(yt,be){return kt.createElement(ut.Z,(0,Mt.Z)({},yt,{ref:be,icon:le}))},Pt=kt.forwardRef(ft),Q=Pt},73331:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Q}});var Mt=G(32855),kt=G(59301),vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}},{tag:"path",attrs:{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"}}]},name:"eye-invisible",theme:"outlined"},le=vt,ut=G(7657),ft=function(yt,be){return kt.createElement(ut.Z,(0,Mt.Z)({},yt,{ref:be,icon:le}))},Pt=kt.forwardRef(ft),Q=Pt},15277:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Q}});var Mt=G(32855),kt=G(59301),vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"},le=vt,ut=G(7657),ft=function(yt,be){return kt.createElement(ut.Z,(0,Mt.Z)({},yt,{ref:be,icon:le}))},Pt=kt.forwardRef(ft),Q=Pt},62772:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Q}});var Mt=G(32855),kt=G(59301),vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},le=vt,ut=G(7657),ft=function(yt,be){return kt.createElement(ut.Z,(0,Mt.Z)({},yt,{ref:be,icon:le}))},Pt=kt.forwardRef(ft),Q=Pt},61485:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Q}});var Mt=G(32855),kt=G(59301),vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},le=vt,ut=G(7657),ft=function(yt,be){return kt.createElement(ut.Z,(0,Mt.Z)({},yt,{ref:be,icon:le}))},Pt=kt.forwardRef(ft),Q=Pt},47472:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Q}});var Mt=G(32855),kt=G(59301),vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},le=vt,ut=G(7657),ft=function(yt,be){return kt.createElement(ut.Z,(0,Mt.Z)({},yt,{ref:be,icon:le}))},Pt=kt.forwardRef(ft),Q=Pt},87395:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Q}});var Mt=G(32855),kt=G(59301),vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},le=vt,ut=G(7657),ft=function(yt,be){return kt.createElement(ut.Z,(0,Mt.Z)({},yt,{ref:be,icon:le}))},Pt=kt.forwardRef(ft),Q=Pt},66543:function(){"use strict"},59598:function(){"use strict"},19080:function(qn,Li,G){"use strict";G.d(Li,{F:function(){return ut},Z:function(){return le}});var Mt=G(92310),kt=G.n(Mt);const vt=null;function le(ft,Pt,Q){return kt()({[`${ft}-status-success`]:Pt==="success",[`${ft}-status-warning`]:Pt==="warning",[`${ft}-status-error`]:Pt==="error",[`${ft}-status-validating`]:Pt==="validating",[`${ft}-has-feedback`]:Q})}const ut=(ft,Pt)=>Pt||ft},93891:function(qn,Li,G){"use strict";var Mt=G(59301),kt=G(36355),vt=G(64165);const le=ut=>{const{componentName:ft}=ut,{getPrefixCls:Pt}=(0,Mt.useContext)(kt.E_),Q=Pt("empty");switch(ft){case"Table":case"List":return Mt.createElement(vt.Z,{image:vt.Z.PRESENTED_IMAGE_SIMPLE});case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return Mt.createElement(vt.Z,{image:vt.Z.PRESENTED_IMAGE_SIMPLE,className:`${Q}-small`});default:return Mt.createElement(vt.Z,null)}};Li.Z=le},64165:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return $t}});var Mt=G(92310),kt=G.n(Mt),vt=G(59301),le=G(36355),ut=G(9763),ft=G(64993),Pt=G(88088),rt=()=>{const[,Xt]=(0,Pt.Z)(),q=new ft.C(Xt.colorBgBase).toHsl().l<.5?{opacity:.65}:{};return vt.createElement("svg",{style:q,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},vt.createElement("g",{fill:"none",fillRule:"evenodd"},vt.createElement("g",{transform:"translate(24 31.67)"},vt.createElement("ellipse",{fillOpacity:".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),vt.createElement("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"}),vt.createElement("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"}),vt.createElement("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"}),vt.createElement("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"})),vt.createElement("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"}),vt.createElement("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},vt.createElement("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),vt.createElement("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"}))))},be=()=>{const[,Xt]=(0,Pt.Z)(),{colorFill:Ct,colorFillTertiary:q,colorFillQuaternary:Et,colorBgContainer:Bt}=Xt,{borderColor:ve,shadowColor:Vt,contentColor:We}=(0,vt.useMemo)(()=>({borderColor:new ft.C(Ct).onBackground(Bt).toHexShortString(),shadowColor:new ft.C(q).onBackground(Bt).toHexShortString(),contentColor:new ft.C(Et).onBackground(Bt).toHexShortString()}),[Ct,q,Et,Bt]);return vt.createElement("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},vt.createElement("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd"},vt.createElement("ellipse",{fill:Vt,cx:"32",cy:"33",rx:"32",ry:"7"}),vt.createElement("g",{fillRule:"nonzero",stroke:ve},vt.createElement("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),vt.createElement("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:We}))))},pt=G(83116),Rt=G(37613);const Ce=Xt=>{const{componentCls:Ct,margin:q,marginXS:Et,marginXL:Bt,fontSize:ve,lineHeight:Vt}=Xt;return{[Ct]:{marginInline:Et,fontSize:ve,lineHeight:Vt,textAlign:"center",[`${Ct}-image`]:{height:Xt.emptyImgHeight,marginBottom:Et,opacity:Xt.opacityImage,img:{height:"100%"},svg:{maxWidth:"100%",height:"100%",margin:"auto"}},[`${Ct}-description`]:{color:Xt.colorText},[`${Ct}-footer`]:{marginTop:q},"&-normal":{marginBlock:Bt,color:Xt.colorTextDisabled,[`${Ct}-description`]:{color:Xt.colorTextDisabled},[`${Ct}-image`]:{height:Xt.emptyImgHeightMD}},"&-small":{marginBlock:Et,color:Xt.colorTextDisabled,[`${Ct}-image`]:{height:Xt.emptyImgHeightSM}}}}};var jt=(0,pt.Z)("Empty",Xt=>{const{componentCls:Ct,controlHeightLG:q}=Xt,Et=(0,Rt.TS)(Xt,{emptyImgCls:`${Ct}-img`,emptyImgHeight:q*2.5,emptyImgHeightMD:q,emptyImgHeightSM:q*.875});return[Ce(Et)]}),Jt=function(Xt,Ct){var q={};for(var Et in Xt)Object.prototype.hasOwnProperty.call(Xt,Et)&&Ct.indexOf(Et)<0&&(q[Et]=Xt[Et]);if(Xt!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Bt=0,Et=Object.getOwnPropertySymbols(Xt);Bt<Et.length;Bt++)Ct.indexOf(Et[Bt])<0&&Object.prototype.propertyIsEnumerable.call(Xt,Et[Bt])&&(q[Et[Bt]]=Xt[Et[Bt]]);return q};const Ht=vt.createElement(rt,null),de=vt.createElement(be,null),De=Xt=>{var{className:Ct,rootClassName:q,prefixCls:Et,image:Bt=Ht,description:ve,children:Vt,imageStyle:We,style:ee}=Xt,xe=Jt(Xt,["className","rootClassName","prefixCls","image","description","children","imageStyle","style"]);const{getPrefixCls:Nt,direction:_e,empty:ti}=vt.useContext(le.E_),je=Nt("empty",Et),[Be,Se]=jt(je),[dt]=(0,ut.Z)("Empty"),W=typeof ve!="undefined"?ve:dt==null?void 0:dt.description,Zt=typeof W=="string"?W:"empty";let ze=null;return typeof Bt=="string"?ze=vt.createElement("img",{alt:Zt,src:Bt}):ze=Bt,Be(vt.createElement("div",Object.assign({className:kt()(Se,je,ti==null?void 0:ti.className,{[`${je}-normal`]:Bt===de,[`${je}-rtl`]:_e==="rtl"},Ct,q),style:Object.assign(Object.assign({},ti==null?void 0:ti.style),ee)},xe),vt.createElement("div",{className:`${je}-image`,style:We},ze),W&&vt.createElement("div",{className:`${je}-description`},W),Vt&&vt.createElement("div",{className:`${je}-footer`},Vt)))};De.PRESENTED_IMAGE_DEFAULT=Ht,De.PRESENTED_IMAGE_SIMPLE=de;var $t=De},78241:function(qn,Li,G){"use strict";G.d(Li,{default:function(){return gi}});var Mt=G(3300),kt=G(92310),vt=G.n(kt),le=G(77900),ut=G(59301),ft=G(62892),Pt=G(32441);function Q(ct){const[J,ot]=ut.useState(ct);return ut.useEffect(()=>{const nt=setTimeout(()=>{ot(ct)},ct.length?0:10);return()=>{clearTimeout(nt)}},[ct]),J}var rt=G(17313),yt=G(29878),be=G(8378),pt=G(37613),Rt=G(83116),jt=ct=>{const{componentCls:J}=ct,ot=`${J}-show-help`,nt=`${J}-show-help-item`;return{[ot]:{transition:`opacity ${ct.motionDurationSlow} ${ct.motionEaseInOut}`,"&-appear, &-enter":{opacity:0,"&-active":{opacity:1}},"&-leave":{opacity:1,"&-active":{opacity:0}},[nt]:{overflow:"hidden",transition:`height ${ct.motionDurationSlow} ${ct.motionEaseInOut},
opacity ${ct.motionDurationSlow} ${ct.motionEaseInOut},
transform ${ct.motionDurationSlow} ${ct.motionEaseInOut} !important`,[`&${nt}-appear, &${nt}-enter`]:{transform:"translateY(-5px)",opacity:0,"&-active":{transform:"translateY(0)",opacity:1}},[`&${nt}-leave-active`]:{transform:"translateY(-5px)"}}}}};const Jt=ct=>({legend:{display:"block",width:"100%",marginBottom:ct.marginLG,padding:0,color:ct.colorTextDescription,fontSize:ct.fontSizeLG,lineHeight:"inherit",border:0,borderBottom:`${ct.lineWidth}px ${ct.lineType} ${ct.colorBorder}`},label:{fontSize:ct.fontSize},'input[type="search"]':{boxSizing:"border-box"},'input[type="radio"], input[type="checkbox"]':{lineHeight:"normal"},'input[type="file"]':{display:"block"},'input[type="range"]':{display:"block",width:"100%"},"select[multiple], select[size]":{height:"auto"},"input[type='file']:focus,\n input[type='radio']:focus,\n input[type='checkbox']:focus":{outline:0,boxShadow:`0 0 0 ${ct.controlOutlineWidth}px ${ct.controlOutline}`},output:{display:"block",paddingTop:15,color:ct.colorText,fontSize:ct.fontSize,lineHeight:ct.lineHeight}}),Ht=(ct,J)=>{const{formItemCls:ot}=ct;return{[ot]:{[`${ot}-label > label`]:{height:J},[`${ot}-control-input`]:{minHeight:J}}}},de=ct=>{const{componentCls:J}=ct;return{[ct.componentCls]:Object.assign(Object.assign(Object.assign({},(0,rt.Wf)(ct)),Jt(ct)),{[`${J}-text`]:{display:"inline-block",paddingInlineEnd:ct.paddingSM},"&-small":Object.assign({},Ht(ct,ct.controlHeightSM)),"&-large":Object.assign({},Ht(ct,ct.controlHeightLG))})}},De=ct=>{const{formItemCls:J,iconCls:ot,componentCls:nt,rootPrefixCls:Z,labelRequiredMarkColor:xt,labelColor:Ot,labelFontSize:ge,labelHeight:te,labelColonMarginInlineStart:lt,labelColonMarginInlineEnd:Qt,itemMarginBottom:me}=ct;return{[J]:Object.assign(Object.assign({},(0,rt.Wf)(ct)),{marginBottom:me,verticalAlign:"top","&-with-help":{transition:"none"},[`&-hidden,
&-hidden.${Z}-row`]:{display:"none"},"&-has-warning":{[`${J}-split`]:{color:ct.colorError}},"&-has-error":{[`${J}-split`]:{color:ct.colorWarning}},[`${J}-label`]:{flexGrow:0,overflow:"hidden",whiteSpace:"nowrap",textAlign:"end",verticalAlign:"middle","&-left":{textAlign:"start"},"&-wrap":{overflow:"unset",lineHeight:`${ct.lineHeight} - 0.25em`,whiteSpace:"unset"},"> label":{position:"relative",display:"inline-flex",alignItems:"center",maxWidth:"100%",height:te,color:Ot,fontSize:ge,[`> ${ot}`]:{fontSize:ct.fontSize,verticalAlign:"top"},[`&${J}-required:not(${J}-required-mark-optional)::before`]:{display:"inline-block",marginInlineEnd:ct.marginXXS,color:xt,fontSize:ct.fontSize,fontFamily:"SimSun, sans-serif",lineHeight:1,content:'"*"',[`${nt}-hide-required-mark &`]:{display:"none"}},[`${J}-optional`]:{display:"inline-block",marginInlineStart:ct.marginXXS,color:ct.colorTextDescription,[`${nt}-hide-required-mark &`]:{display:"none"}},[`${J}-tooltip`]:{color:ct.colorTextDescription,cursor:"help",writingMode:"horizontal-tb",marginInlineStart:ct.marginXXS},"&::after":{content:'":"',position:"relative",marginBlock:0,marginInlineStart:lt,marginInlineEnd:Qt},[`&${J}-no-colon::after`]:{content:'"\\a0"'}}},[`${J}-control`]:{"--ant-display":"flex",flexDirection:"column",flexGrow:1,[`&:first-child:not([class^="'${Z}-col-'"]):not([class*="' ${Z}-col-'"])`]:{width:"100%"},"&-input":{position:"relative",display:"flex",alignItems:"center",minHeight:ct.controlHeight,"&-content":{flex:"auto",maxWidth:"100%"}}},[J]:{"&-explain, &-extra":{clear:"both",color:ct.colorTextDescription,fontSize:ct.fontSize,lineHeight:ct.lineHeight},"&-explain-connected":{width:"100%"},"&-extra":{minHeight:ct.controlHeightSM,transition:`color ${ct.motionDurationMid} ${ct.motionEaseOut}`},"&-explain":{"&-error":{color:ct.colorError},"&-warning":{color:ct.colorWarning}}},[`&-with-help ${J}-explain`]:{height:"auto",opacity:1},[`${J}-feedback-icon`]:{fontSize:ct.fontSize,textAlign:"center",visibility:"visible",animationName:yt.kr,animationDuration:ct.motionDurationMid,animationTimingFunction:ct.motionEaseOutBack,pointerEvents:"none","&-success":{color:ct.colorSuccess},"&-error":{color:ct.colorError},"&-warning":{color:ct.colorWarning},"&-validating":{color:ct.colorPrimary}}})}},$t=ct=>{const{componentCls:J,formItemCls:ot}=ct;return{[`${J}-horizontal`]:{[`${ot}-label`]:{flexGrow:0},[`${ot}-control`]:{flex:"1 1 0",minWidth:0},[`${ot}-label[class$='-24'], ${ot}-label[class*='-24 ']`]:{[`& + ${ot}-control`]:{minWidth:"unset"}}}}},Xt=ct=>{const{componentCls:J,formItemCls:ot}=ct;return{[`${J}-inline`]:{display:"flex",flexWrap:"wrap",[ot]:{flex:"none",marginInlineEnd:ct.margin,marginBottom:0,"&-row":{flexWrap:"nowrap"},[`> ${ot}-label,
> ${ot}-control`]:{display:"inline-block",verticalAlign:"top"},[`> ${ot}-label`]:{flex:"none"},[`${J}-text`]:{display:"inline-block"},[`${ot}-has-feedback`]:{display:"inline-block"}}}}},Ct=ct=>({padding:ct.verticalLabelPadding,margin:ct.verticalLabelMargin,whiteSpace:"initial",textAlign:"start","> label":{margin:0,"&::after":{visibility:"hidden"}}}),q=ct=>{const{componentCls:J,formItemCls:ot,rootPrefixCls:nt}=ct;return{[`${ot} ${ot}-label`]:Ct(ct),[J]:{[ot]:{flexWrap:"wrap",[`${ot}-label, ${ot}-control`]:{[`&:not([class*=" ${nt}-col-xs"])`]:{flex:"0 0 100%",maxWidth:"100%"}}}}}},Et=ct=>{const{componentCls:J,formItemCls:ot,rootPrefixCls:nt}=ct;return{[`${J}-vertical`]:{[ot]:{"&-row":{flexDirection:"column"},"&-label > label":{height:"auto"},[`${J}-item-control`]:{width:"100%"}}},[`${J}-vertical ${ot}-label,
.${nt}-col-24${ot}-label,
.${nt}-col-xl-24${ot}-label`]:Ct(ct),[`@media (max-width: ${ct.screenXSMax}px)`]:[q(ct),{[J]:{[`.${nt}-col-xs-24${ot}-label`]:Ct(ct)}}],[`@media (max-width: ${ct.screenSMMax}px)`]:{[J]:{[`.${nt}-col-sm-24${ot}-label`]:Ct(ct)}},[`@media (max-width: ${ct.screenMDMax}px)`]:{[J]:{[`.${nt}-col-md-24${ot}-label`]:Ct(ct)}},[`@media (max-width: ${ct.screenLGMax}px)`]:{[J]:{[`.${nt}-col-lg-24${ot}-label`]:Ct(ct)}}}},Bt=(ct,J)=>(0,pt.TS)(ct,{formItemCls:`${ct.componentCls}-item`,rootPrefixCls:J});var ve=(0,Rt.Z)("Form",(ct,J)=>{let{rootPrefixCls:ot}=J;const nt=Bt(ct,ot);return[de(nt),De(nt),jt(nt),$t(nt),Xt(nt),Et(nt),(0,be.Z)(nt),yt.kr]},ct=>({labelRequiredMarkColor:ct.colorError,labelColor:ct.colorTextHeading,labelFontSize:ct.fontSize,labelHeight:ct.controlHeight,labelColonMarginInlineStart:ct.marginXXS/2,labelColonMarginInlineEnd:ct.marginXS,itemMarginBottom:ct.marginLG,verticalLabelPadding:`0 0 ${ct.paddingXS}px`,verticalLabelMargin:0}),{order:-1e3});const Vt=[];function We(ct,J,ot){let nt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;return{key:typeof ct=="string"?ct:`${J}-${nt}`,error:ct,errorStatus:ot}}var xe=ct=>{let{help:J,helpStatus:ot,errors:nt=Vt,warnings:Z=Vt,className:xt,fieldId:Ot,onVisibleChanged:ge}=ct;const{prefixCls:te}=ut.useContext(Pt.Rk),lt=`${te}-item-explain`,[,Qt]=ve(te),me=(0,ut.useMemo)(()=>(0,ft.Z)(te),[te]),Fe=Q(nt),Tt=Q(Z),ce=ut.useMemo(()=>J!=null?[We(J,"help",ot)]:[].concat((0,Mt.Z)(Fe.map((li,Mi)=>We(li,"error","error",Mi))),(0,Mt.Z)(Tt.map((li,Mi)=>We(li,"warning","warning",Mi)))),[J,ot,Fe,Tt]),bi={};return Ot&&(bi.id=`${Ot}_help`),ut.createElement(le.default,{motionDeadline:me.motionDeadline,motionName:`${te}-show-help`,visible:!!ce.length,onVisibleChanged:ge},li=>{const{className:Mi,style:Pe}=li;return ut.createElement("div",Object.assign({},bi,{className:vt()(lt,Mi,xt,Qt),style:Pe,role:"alert"}),ut.createElement(le.CSSMotionList,Object.assign({keys:ce},(0,ft.Z)(te),{motionName:`${te}-show-help-item`,component:!1}),qe=>{const{key:Re,error:ni,errorStatus:Ut,className:Wt,style:Dt}=qe;return ut.createElement("div",{key:Re,className:vt()(Wt,{[`${lt}-${Ut}`]:Ut}),style:Dt},ni)}))})},Nt=G(95013),_e=G(36355),ti=G(1684),je=G(52946),Be=G(19716),Se=G(16722);const dt=["parentNode"],W="form_item";function Zt(ct){return ct===void 0||ct===!1?[]:Array.isArray(ct)?ct:[ct]}function ze(ct,J){if(!ct.length)return;const ot=ct.join("_");return J?`${J}_${ot}`:dt.includes(ot)?`${W}_${ot}`:ot}function Me(ct,J,ot,nt,Z,xt){let Ot=nt;return xt!==void 0?Ot=xt:ot.validating?Ot="validating":ct.length?Ot="error":J.length?Ot="warning":(ot.touched||Z&&ot.validated)&&(Ot="success"),Ot}function ye(ct){return Zt(ct).join("_")}function se(ct){const[J]=(0,Nt.useForm)(),ot=ut.useRef({}),nt=ut.useMemo(()=>ct!=null?ct:Object.assign(Object.assign({},J),{__INTERNAL__:{itemRef:Z=>xt=>{const Ot=ye(Z);xt?ot.current[Ot]=xt:delete ot.current[Ot]}},scrollToField:function(Z){let xt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const Ot=Zt(Z),ge=ze(Ot,nt.__INTERNAL__.name),te=ge?document.getElementById(ge):null;te&&(0,Se.Z)(te,Object.assign({scrollMode:"if-needed",block:"nearest"},xt))},getFieldInstance:Z=>{const xt=ye(Z);return ot.current[xt]}}),[ct,J]);return[nt]}var Ue=G(28726),Fi=function(ct,J){var ot={};for(var nt in ct)Object.prototype.hasOwnProperty.call(ct,nt)&&J.indexOf(nt)<0&&(ot[nt]=ct[nt]);if(ct!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Z=0,nt=Object.getOwnPropertySymbols(ct);Z<nt.length;Z++)J.indexOf(nt[Z])<0&&Object.prototype.propertyIsEnumerable.call(ct,nt[Z])&&(ot[nt[Z]]=ct[nt[Z]]);return ot};const wi=(ct,J)=>{const ot=ut.useContext(ti.Z),{getPrefixCls:nt,direction:Z,form:xt}=ut.useContext(_e.E_),{prefixCls:Ot,className:ge,rootClassName:te,size:lt,disabled:Qt=ot,form:me,colon:Fe,labelAlign:Tt,labelWrap:ce,labelCol:bi,wrapperCol:li,hideRequiredMark:Mi,layout:Pe="horizontal",scrollToFirstError:qe,requiredMark:Re,onFinishFailed:ni,name:Ut,style:Wt,feedbackIcons:Dt}=ct,ke=Fi(ct,["prefixCls","className","rootClassName","size","disabled","form","colon","labelAlign","labelWrap","labelCol","wrapperCol","hideRequiredMark","layout","scrollToFirstError","requiredMark","onFinishFailed","name","style","feedbackIcons"]),re=(0,Be.Z)(lt),Ie=ut.useContext(Ue.Z),mt=(0,ut.useMemo)(()=>Re!==void 0?Re:xt&&xt.requiredMark!==void 0?xt.requiredMark:!Mi,[Mi,Re,xt]),Xe=Fe!=null?Fe:xt==null?void 0:xt.colon,pi=nt("form",Ot),[ci,Ui]=ve(pi),Ni=vt()(pi,`${pi}-${Pe}`,{[`${pi}-hide-required-mark`]:mt===!1,[`${pi}-rtl`]:Z==="rtl",[`${pi}-${re}`]:re},Ui,xt==null?void 0:xt.className,ge,te),[Gi]=se(me),{__INTERNAL__:ki}=Gi;ki.name=Ut;const di=(0,ut.useMemo)(()=>({name:Ut,labelAlign:Tt,labelCol:bi,labelWrap:ce,wrapperCol:li,vertical:Pe==="vertical",colon:Xe,requiredMark:mt,itemRef:ki.itemRef,form:Gi,feedbackIcons:Dt}),[Ut,Tt,bi,li,Pe,Xe,mt,Gi,Dt]);ut.useImperativeHandle(J,()=>Gi);const Ki=(Ri,At)=>{if(Ri){let vi={block:"nearest"};typeof Ri=="object"&&(vi=Ri),Gi.scrollToField(At,vi)}},Kt=Ri=>{if(ni==null||ni(Ri),Ri.errorFields.length){const At=Ri.errorFields[0].name;if(qe!==void 0){Ki(qe,At);return}xt&&xt.scrollToFirstError!==void 0&&Ki(xt.scrollToFirstError,At)}};return ci(ut.createElement(ti.n,{disabled:Qt},ut.createElement(je.q,{size:re},ut.createElement(Pt.RV,Object.assign({},{validateMessages:Ie}),ut.createElement(Pt.q3.Provider,{value:di},ut.createElement(Nt.default,Object.assign({id:Ut},ke,{name:Ut,onFinishFailed:Kt,form:Gi,style:Object.assign(Object.assign({},xt==null?void 0:xt.style),Wt),className:Ni})))))))};var ri=ut.forwardRef(wi),sn=G(41799),Zi=G(8654),j=G(92343),P=G(11592);function E(ct){if(typeof ct=="function")return ct;const J=(0,P.Z)(ct);return J.length<=1?J[0]:J}const B=()=>{const{status:ct,errors:J=[],warnings:ot=[]}=(0,ut.useContext)(Pt.aM);return{status:ct,errors:J,warnings:ot}};B.Context=Pt.aM;var U=B,D=G(16089);function St(ct){const[J,ot]=ut.useState(ct),nt=(0,ut.useRef)(null),Z=(0,ut.useRef)([]),xt=(0,ut.useRef)(!1);ut.useEffect(()=>(xt.current=!1,()=>{xt.current=!0,D.Z.cancel(nt.current),nt.current=null}),[]);function Ot(ge){xt.current||(nt.current===null&&(Z.current=[],nt.current=(0,D.Z)(()=>{nt.current=null,ot(te=>{let lt=te;return Z.current.forEach(Qt=>{lt=Qt(lt)}),lt})})),Z.current.push(ge))}return[J,Ot]}function ae(){const{itemRef:ct}=ut.useContext(Pt.q3),J=ut.useRef({});function ot(nt,Z){const xt=Z&&typeof Z=="object"&&Z.ref,Ot=nt.join("_");return(J.current.name!==Ot||J.current.originRef!==xt)&&(J.current.name=Ot,J.current.originRef=xt,J.current.ref=(0,Zi.sQ)(ct(nt),xt)),J.current.ref}return ot}var $e=G(29194),Ae=G(34280),Qe=G(2738),He=G(27382),Si=G(37028);const Ei=ct=>{const{formItemCls:J}=ct;return{"@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)":{[`${J}-control`]:{display:"flex"}}}};var Ci=(0,Rt.b)(["Form","item-item"],(ct,J)=>{let{rootPrefixCls:ot}=J;const nt=Bt(ct,ot);return[Ei(nt)]}),ei=ct=>{const{prefixCls:J,status:ot,wrapperCol:nt,children:Z,errors:xt,warnings:Ot,_internalItemRender:ge,extra:te,help:lt,fieldId:Qt,marginBottom:me,onErrorVisibleChanged:Fe}=ct,Tt=`${J}-item`,ce=ut.useContext(Pt.q3),bi=nt||ce.wrapperCol||{},li=vt()(`${Tt}-control`,bi.className),Mi=ut.useMemo(()=>Object.assign({},ce),[ce]);delete Mi.labelCol,delete Mi.wrapperCol;const Pe=ut.createElement("div",{className:`${Tt}-control-input`},ut.createElement("div",{className:`${Tt}-control-input-content`},Z)),qe=ut.useMemo(()=>({prefixCls:J,status:ot}),[J,ot]),Re=me!==null||xt.length||Ot.length?ut.createElement("div",{style:{display:"flex",flexWrap:"nowrap"}},ut.createElement(Pt.Rk.Provider,{value:qe},ut.createElement(xe,{fieldId:Qt,errors:xt,warnings:Ot,help:lt,helpStatus:ot,className:`${Tt}-explain-connected`,onVisibleChanged:Fe})),!!me&&ut.createElement("div",{style:{width:0,height:me}})):null,ni={};Qt&&(ni.id=`${Qt}_extra`);const Ut=te?ut.createElement("div",Object.assign({},ni,{className:`${Tt}-extra`}),te):null,Wt=ge&&ge.mark==="pro_table_render"&&ge.render?ge.render(ct,{input:Pe,errorList:Re,extra:Ut}):ut.createElement(ut.Fragment,null,Pe,Re,Ut);return ut.createElement(Pt.q3.Provider,{value:Mi},ut.createElement(Si.Z,Object.assign({},bi,{className:li}),Wt),ut.createElement(Ci,{prefixCls:J}))},ln=G(61485),Ft=G(31724),oe=G(9763),we=G(6848),Ii=function(ct,J){var ot={};for(var nt in ct)Object.prototype.hasOwnProperty.call(ct,nt)&&J.indexOf(nt)<0&&(ot[nt]=ct[nt]);if(ct!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Z=0,nt=Object.getOwnPropertySymbols(ct);Z<nt.length;Z++)J.indexOf(nt[Z])<0&&Object.prototype.propertyIsEnumerable.call(ct,nt[Z])&&(ot[nt[Z]]=ct[nt[Z]]);return ot};function Pi(ct){return ct?typeof ct=="object"&&!ut.isValidElement(ct)?ct:{title:ct}:null}var hn=ct=>{let{prefixCls:J,label:ot,htmlFor:nt,labelCol:Z,labelAlign:xt,colon:Ot,required:ge,requiredMark:te,tooltip:lt}=ct;var Qt;const[me]=(0,oe.Z)("Form"),{vertical:Fe,labelAlign:Tt,labelCol:ce,labelWrap:bi,colon:li}=ut.useContext(Pt.q3);if(!ot)return null;const Mi=Z||ce||{},Pe=xt||Tt,qe=`${J}-item-label`,Re=vt()(qe,Pe==="left"&&`${qe}-left`,Mi.className,{[`${qe}-wrap`]:!!bi});let ni=ot;const Ut=Ot===!0||li!==!1&&Ot!==!1;Ut&&!Fe&&typeof ot=="string"&&ot.trim()!==""&&(ni=ot.replace(/[:|]\s*$/,""));const Dt=Pi(lt);if(Dt){const{icon:mt=ut.createElement(ln.Z,null)}=Dt,Xe=Ii(Dt,["icon"]),pi=ut.createElement(we.Z,Object.assign({},Xe),ut.cloneElement(mt,{className:`${J}-item-tooltip`,title:""}));ni=ut.createElement(ut.Fragment,null,ni,pi)}const ke=te==="optional",re=typeof te=="function";re?ni=te(ni,{required:!!ge}):ke&&!ge&&(ni=ut.createElement(ut.Fragment,null,ni,ut.createElement("span",{className:`${J}-item-optional`,title:""},(me==null?void 0:me.optional)||((Qt=Ft.Z.Form)===null||Qt===void 0?void 0:Qt.optional))));const Ie=vt()({[`${J}-item-required`]:ge,[`${J}-item-required-mark-optional`]:ke||re,[`${J}-item-no-colon`]:!Ut});return ut.createElement(Si.Z,Object.assign({},Mi,{className:Re}),ut.createElement("label",{htmlFor:nt,className:Ie,title:typeof ot=="string"?ot:""},ni))},mn=G(29679),Ln=G(19248),jn=G(96512),On=G(58617);const rn={success:mn.Z,warning:jn.Z,error:Ln.Z,validating:On.Z};function ir(ct){let{children:J,errors:ot,warnings:nt,hasFeedback:Z,validateStatus:xt,prefixCls:Ot,meta:ge,noStyle:te}=ct;const lt=`${Ot}-item`,{feedbackIcons:Qt}=ut.useContext(Pt.q3),me=Me(ot,nt,ge,null,!!Z,xt),{isFormItemInput:Fe,status:Tt}=ut.useContext(Pt.aM),ce=ut.useMemo(()=>{var bi;let li;if(Z){const qe=Z!==!0&&Z.icons||Qt,Re=me&&((bi=qe==null?void 0:qe({status:me,errors:ot,warnings:nt}))===null||bi===void 0?void 0:bi[me]),ni=me&&rn[me];li=Re!==!1&&ni?ut.createElement("span",{className:vt()(`${lt}-feedback-icon`,`${lt}-feedback-icon-${me}`)},Re||ut.createElement(ni,null)):null}let Mi=!0,Pe=me||"";return te&&(Mi=Fe,Pe=(me!=null?me:Tt)||""),{status:Pe,errors:ot,warnings:nt,hasFeedback:!!Z,feedbackIcon:li,isFormItemInput:Mi}},[me,Z,te,Fe,Tt]);return ut.createElement(Pt.aM.Provider,{value:ce},J)}var tr=function(ct,J){var ot={};for(var nt in ct)Object.prototype.hasOwnProperty.call(ct,nt)&&J.indexOf(nt)<0&&(ot[nt]=ct[nt]);if(ct!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Z=0,nt=Object.getOwnPropertySymbols(ct);Z<nt.length;Z++)J.indexOf(nt[Z])<0&&Object.prototype.propertyIsEnumerable.call(ct,nt[Z])&&(ot[nt[Z]]=ct[nt[Z]]);return ot};function hr(ct){const{prefixCls:J,className:ot,rootClassName:nt,style:Z,help:xt,errors:Ot,warnings:ge,validateStatus:te,meta:lt,hasFeedback:Qt,hidden:me,children:Fe,fieldId:Tt,required:ce,isRequired:bi,onSubItemMetaChange:li}=ct,Mi=tr(ct,["prefixCls","className","rootClassName","style","help","errors","warnings","validateStatus","meta","hasFeedback","hidden","children","fieldId","required","isRequired","onSubItemMetaChange"]),Pe=`${J}-item`,{requiredMark:qe}=ut.useContext(Pt.q3),Re=ut.useRef(null),ni=Q(Ot),Ut=Q(ge),Wt=xt!=null,Dt=!!(Wt||Ot.length||ge.length),ke=!!Re.current&&(0,$e.Z)(Re.current),[re,Ie]=ut.useState(null);(0,Ae.Z)(()=>{if(Dt&&Re.current){const Ui=getComputedStyle(Re.current);Ie(parseInt(Ui.marginBottom,10))}},[Dt,ke]);const mt=Ui=>{Ui||Ie(null)},pi=function(){let Ui=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;const Ni=Ui?ni:lt.errors,Gi=Ui?Ut:lt.warnings;return Me(Ni,Gi,lt,"",!!Qt,te)}(),ci=vt()(Pe,ot,nt,{[`${Pe}-with-help`]:Wt||ni.length||Ut.length,[`${Pe}-has-feedback`]:pi&&Qt,[`${Pe}-has-success`]:pi==="success",[`${Pe}-has-warning`]:pi==="warning",[`${Pe}-has-error`]:pi==="error",[`${Pe}-is-validating`]:pi==="validating",[`${Pe}-hidden`]:me});return ut.createElement("div",{className:ci,style:Z,ref:Re},ut.createElement(He.Z,Object.assign({className:`${Pe}-row`},(0,Qe.Z)(Mi,["_internalItemRender","colon","dependencies","extra","fieldKey","getValueFromEvent","getValueProps","htmlFor","id","initialValue","isListField","label","labelAlign","labelCol","labelWrap","messageVariables","name","normalize","noStyle","preserve","requiredMark","rules","shouldUpdate","trigger","tooltip","validateFirst","validateTrigger","valuePropName","wrapperCol","validateDebounce"])),ut.createElement(hn,Object.assign({htmlFor:Tt},ct,{requiredMark:qe,required:ce!=null?ce:bi,prefixCls:J})),ut.createElement(ei,Object.assign({},ct,lt,{errors:ni,warnings:Ut,prefixCls:J,status:pi,help:xt,marginBottom:re,onErrorVisibleChanged:mt}),ut.createElement(Pt.qI.Provider,{value:li},ut.createElement(ir,{prefixCls:J,meta:lt,errors:lt.errors,warnings:lt.warnings,hasFeedback:Qt,validateStatus:pi},Fe)))),!!re&&ut.createElement("div",{className:`${Pe}-margin-offset`,style:{marginBottom:-re}}))}const Er="__SPLIT__",Hn=null,Ir=ut.memo(ct=>{let{children:J}=ct;return J},(ct,J)=>ct.value===J.value&&ct.update===J.update&&ct.childProps.length===J.childProps.length&&ct.childProps.every((ot,nt)=>ot===J.childProps[nt]));function T(ct){return ct!=null}function ur(){return{errors:[],warnings:[],touched:!1,validating:!1,name:[],validated:!1}}function $n(ct){const{name:J,noStyle:ot,className:nt,dependencies:Z,prefixCls:xt,shouldUpdate:Ot,rules:ge,children:te,required:lt,label:Qt,messageVariables:me,trigger:Fe="onChange",validateTrigger:Tt,hidden:ce,help:bi}=ct,{getPrefixCls:li}=ut.useContext(_e.E_),{name:Mi}=ut.useContext(Pt.q3),Pe=E(te),qe=typeof Pe=="function",Re=ut.useContext(Pt.qI),{validateTrigger:ni}=ut.useContext(Nt.FieldContext),Ut=Tt!==void 0?Tt:ni,Wt=T(J),Dt=li("form",xt),[ke,re]=ve(Dt),Ie=ut.useContext(Nt.ListContext),mt=ut.useRef(),[Xe,pi]=St({}),[ci,Ui]=(0,sn.Z)(()=>ur()),Ni=At=>{const vi=Ie==null?void 0:Ie.getKey(At.name);if(Ui(At.destroy?ur():At,!0),ot&&bi!==!1&&Re){let Qi=At.name;if(At.destroy)Qi=mt.current||Qi;else if(vi!==void 0){const[Ti,gn]=vi;Qi=[Ti].concat((0,Mt.Z)(gn)),mt.current=Qi}Re(At,Qi)}},Gi=(At,vi)=>{pi(Qi=>{const Ti=Object.assign({},Qi),Mn=[].concat((0,Mt.Z)(At.name.slice(0,-1)),(0,Mt.Z)(vi)).join(Er);return At.destroy?delete Ti[Mn]:Ti[Mn]=At,Ti})},[ki,di]=ut.useMemo(()=>{const At=(0,Mt.Z)(ci.errors),vi=(0,Mt.Z)(ci.warnings);return Object.values(Xe).forEach(Qi=>{At.push.apply(At,(0,Mt.Z)(Qi.errors||[])),vi.push.apply(vi,(0,Mt.Z)(Qi.warnings||[]))}),[At,vi]},[Xe,ci.errors,ci.warnings]),Ki=ae();function Kt(At,vi,Qi){return ot&&!ce?ut.createElement(ir,{prefixCls:Dt,hasFeedback:ct.hasFeedback,validateStatus:ct.validateStatus,meta:ci,errors:ki,warnings:di,noStyle:!0},At):ut.createElement(hr,Object.assign({key:"row"},ct,{className:vt()(nt,re),prefixCls:Dt,fieldId:vi,isRequired:Qi,errors:ki,warnings:di,meta:ci,onSubItemMetaChange:Gi}),At)}if(!Wt&&!qe&&!Z)return ke(Kt(Pe));let Ri={};return typeof Qt=="string"?Ri.label=Qt:J&&(Ri.label=String(J)),me&&(Ri=Object.assign(Object.assign({},Ri),me)),ke(ut.createElement(Nt.Field,Object.assign({},ct,{messageVariables:Ri,trigger:Fe,validateTrigger:Ut,onMetaChange:Ni}),(At,vi,Qi)=>{const Ti=Zt(J).length&&vi?vi.name:[],gn=ze(Ti,Mi),Mn=lt!==void 0?lt:!!(ge&&ge.some(Je=>{if(Je&&typeof Je=="object"&&Je.required&&!Je.warningOnly)return!0;if(typeof Je=="function"){const Oi=Je(Qi);return Oi&&Oi.required&&!Oi.warningOnly}return!1})),mi=Object.assign({},At);let Ye=null;if(Array.isArray(Pe)&&Wt)Ye=Pe;else if(!(qe&&(!(Ot||Z)||Wt))){if(!(Z&&!qe&&!Wt))if((0,j.l$)(Pe)){const Je=Object.assign(Object.assign({},Pe.props),mi);if(Je.id||(Je.id=gn),bi||ki.length>0||di.length>0||ct.extra){const z=[];(bi||ki.length>0)&&z.push(`${gn}_help`),ct.extra&&z.push(`${gn}_extra`),Je["aria-describedby"]=z.join(" ")}ki.length>0&&(Je["aria-invalid"]="true"),Mn&&(Je["aria-required"]="true"),(0,Zi.Yr)(Pe)&&(Je.ref=Ki(Ti,Pe)),new Set([].concat((0,Mt.Z)(Zt(Fe)),(0,Mt.Z)(Zt(Ut)))).forEach(z=>{Je[z]=function(){for(var fn,vn,Qn,Kn,Ar,tn=arguments.length,Hi=new Array(tn),Sn=0;Sn<tn;Sn++)Hi[Sn]=arguments[Sn];(Qn=mi[z])===null||Qn===void 0||(fn=Qn).call.apply(fn,[mi].concat(Hi)),(Ar=(Kn=Pe.props)[z])===null||Ar===void 0||(vn=Ar).call.apply(vn,[Kn].concat(Hi))}});const pe=[Je["aria-required"],Je["aria-invalid"],Je["aria-describedby"]];Ye=ut.createElement(Ir,{value:mi[ct.valuePropName||"value"],update:Pe,childProps:pe},(0,j.Tm)(Pe,Je))}else qe&&(Ot||Z)&&!Wt?Ye=Pe(Qi):Ye=Pe}return Kt(Ye,gn,Mn)}))}const Yn=$n;Yn.useStatus=U;var Nr=Yn,Gn=function(ct,J){var ot={};for(var nt in ct)Object.prototype.hasOwnProperty.call(ct,nt)&&J.indexOf(nt)<0&&(ot[nt]=ct[nt]);if(ct!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Z=0,nt=Object.getOwnPropertySymbols(ct);Z<nt.length;Z++)J.indexOf(nt[Z])<0&&Object.prototype.propertyIsEnumerable.call(ct,nt[Z])&&(ot[nt[Z]]=ct[nt[Z]]);return ot},zo=ct=>{var{prefixCls:J,children:ot}=ct,nt=Gn(ct,["prefixCls","children"]);const{getPrefixCls:Z}=ut.useContext(_e.E_),xt=Z("form",J),Ot=ut.useMemo(()=>({prefixCls:xt,status:"error"}),[xt]);return ut.createElement(Nt.List,Object.assign({},nt),(ge,te,lt)=>ut.createElement(Pt.Rk.Provider,{value:Ot},ot(ge.map(Qt=>Object.assign(Object.assign({},Qt),{fieldKey:Qt.key})),te,{errors:lt.errors,warnings:lt.warnings})))};function gr(){const{form:ct}=(0,ut.useContext)(Pt.q3);return ct}const pn=ri;pn.Item=Nr,pn.List=zo,pn.ErrorList=xe,pn.useForm=se,pn.useFormInstance=gr,pn.useWatch=Nt.useWatch,pn.Provider=Pt.RV,pn.create=()=>{};var gi=pn},5871:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return ln}});var Mt=G(84105),kt=G(87395),vt=G(92310),le=G.n(vt),ut=G(32855),ft=G(74430),Pt=G(34666),Q=G(11913),rt=G(43079),yt=G(33377),be=G(93912);function pt(){return typeof BigInt=="function"}function Rt(Ft){return!Ft&&Ft!==0&&!Number.isNaN(Ft)||!String(Ft).trim()}function Ce(Ft){var oe=Ft.trim(),we=oe.startsWith("-");we&&(oe=oe.slice(1)),oe=oe.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),oe.startsWith(".")&&(oe="0".concat(oe));var Ii=oe||"0",Pi=Ii.split("."),_i=Pi[0]||"0",hn=Pi[1]||"0";_i==="0"&&hn==="0"&&(we=!1);var mn=we?"-":"";return{negative:we,negativeStr:mn,trimStr:Ii,integerStr:_i,decimalStr:hn,fullStr:"".concat(mn).concat(Ii)}}function jt(Ft){var oe=String(Ft);return!Number.isNaN(Number(oe))&&oe.includes("e")}function Jt(Ft){var oe=String(Ft);if(jt(Ft)){var we=Number(oe.slice(oe.indexOf("e-")+2)),Ii=oe.match(/\.(\d+)/);return Ii!=null&&Ii[1]&&(we+=Ii[1].length),we}return oe.includes(".")&&de(oe)?oe.length-oe.indexOf(".")-1:0}function Ht(Ft){var oe=String(Ft);if(jt(Ft)){if(Ft>Number.MAX_SAFE_INTEGER)return String(pt()?BigInt(Ft).toString():Number.MAX_SAFE_INTEGER);if(Ft<Number.MIN_SAFE_INTEGER)return String(pt()?BigInt(Ft).toString():Number.MIN_SAFE_INTEGER);oe=Ft.toFixed(Jt(oe))}return Ce(oe).fullStr}function de(Ft){return typeof Ft=="number"?!Number.isNaN(Ft):Ft?/^\s*-?\d+(\.\d+)?\s*$/.test(Ft)||/^\s*-?\d+\.\s*$/.test(Ft)||/^\s*-?\.\d+\s*$/.test(Ft):!1}var De=function(){function Ft(oe){if((0,yt.Z)(this,Ft),(0,ft.Z)(this,"origin",""),(0,ft.Z)(this,"negative",void 0),(0,ft.Z)(this,"integer",void 0),(0,ft.Z)(this,"decimal",void 0),(0,ft.Z)(this,"decimalLen",void 0),(0,ft.Z)(this,"empty",void 0),(0,ft.Z)(this,"nan",void 0),Rt(oe)){this.empty=!0;return}if(this.origin=String(oe),oe==="-"||Number.isNaN(oe)){this.nan=!0;return}var we=oe;if(jt(we)&&(we=Number(we)),we=typeof we=="string"?we:Ht(we),de(we)){var Ii=Ce(we);this.negative=Ii.negative;var Pi=Ii.trimStr.split(".");this.integer=BigInt(Pi[0]);var _i=Pi[1]||"0";this.decimal=BigInt(_i),this.decimalLen=_i.length}else this.nan=!0}return(0,be.Z)(Ft,[{key:"getMark",value:function(){return this.negative?"-":""}},{key:"getIntegerStr",value:function(){return this.integer.toString()}},{key:"getDecimalStr",value:function(){return this.decimal.toString().padStart(this.decimalLen,"0")}},{key:"alignDecimal",value:function(we){var Ii="".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(we,"0"));return BigInt(Ii)}},{key:"negate",value:function(){var we=new Ft(this.toString());return we.negative=!we.negative,we}},{key:"cal",value:function(we,Ii,Pi){var _i=Math.max(this.getDecimalStr().length,we.getDecimalStr().length),hn=this.alignDecimal(_i),mn=we.alignDecimal(_i),Ln=Ii(hn,mn).toString(),jn=Pi(_i),On=Ce(Ln),rn=On.negativeStr,ir=On.trimStr,tr="".concat(rn).concat(ir.padStart(jn+1,"0"));return new Ft("".concat(tr.slice(0,-jn),".").concat(tr.slice(-jn)))}},{key:"add",value:function(we){if(this.isInvalidate())return new Ft(we);var Ii=new Ft(we);return Ii.isInvalidate()?this:this.cal(Ii,function(Pi,_i){return Pi+_i},function(Pi){return Pi})}},{key:"multi",value:function(we){var Ii=new Ft(we);return this.isInvalidate()||Ii.isInvalidate()?new Ft(NaN):this.cal(Ii,function(Pi,_i){return Pi*_i},function(Pi){return Pi*2})}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return this.nan}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(we){return this.toString()===(we==null?void 0:we.toString())}},{key:"lessEquals",value:function(we){return this.add(we.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return we?this.isInvalidate()?"":Ce("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),Ft}(),$t=function(){function Ft(oe){if((0,yt.Z)(this,Ft),(0,ft.Z)(this,"origin",""),(0,ft.Z)(this,"number",void 0),(0,ft.Z)(this,"empty",void 0),Rt(oe)){this.empty=!0;return}this.origin=String(oe),this.number=Number(oe)}return(0,be.Z)(Ft,[{key:"negate",value:function(){return new Ft(-this.toNumber())}},{key:"add",value:function(we){if(this.isInvalidate())return new Ft(we);var Ii=Number(we);if(Number.isNaN(Ii))return this;var Pi=this.number+Ii;if(Pi>Number.MAX_SAFE_INTEGER)return new Ft(Number.MAX_SAFE_INTEGER);if(Pi<Number.MIN_SAFE_INTEGER)return new Ft(Number.MIN_SAFE_INTEGER);var _i=Math.max(Jt(this.number),Jt(Ii));return new Ft(Pi.toFixed(_i))}},{key:"multi",value:function(we){var Ii=Number(we);if(this.isInvalidate()||Number.isNaN(Ii))return new Ft(NaN);var Pi=this.number*Ii;if(Pi>Number.MAX_SAFE_INTEGER)return new Ft(Number.MAX_SAFE_INTEGER);if(Pi<Number.MIN_SAFE_INTEGER)return new Ft(Number.MIN_SAFE_INTEGER);var _i=Math.max(Jt(this.number),Jt(Ii));return new Ft(Pi.toFixed(_i))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return Number.isNaN(this.number)}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(we){return this.toNumber()===(we==null?void 0:we.toNumber())}},{key:"lessEquals",value:function(we){return this.add(we.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return we?this.isInvalidate()?"":Ht(this.number):this.origin}}]),Ft}();function Xt(Ft){return pt()?new De(Ft):new $t(Ft)}function Ct(Ft,oe,we){var Ii=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(Ft==="")return"";var Pi=Ce(Ft),_i=Pi.negativeStr,hn=Pi.integerStr,mn=Pi.decimalStr,Ln="".concat(oe).concat(mn),jn="".concat(_i).concat(hn);if(we>=0){var On=Number(mn[we]);if(On>=5&&!Ii){var rn=Xt(Ft).add("".concat(_i,"0.").concat("0".repeat(we)).concat(10-On));return Ct(rn.toString(),oe,we,Ii)}return we===0?jn:"".concat(jn).concat(oe).concat(mn.padEnd(we,"0").slice(0,we))}return Ln===".0"?jn:"".concat(jn).concat(Ln)}var q=Xt,Et=G(93681),Bt=G(34280),ve=G(8654),Vt=G(59301),We=G(48736);function ee(Ft,oe){var we=(0,Vt.useRef)(null);function Ii(){try{var _i=Ft.selectionStart,hn=Ft.selectionEnd,mn=Ft.value,Ln=mn.substring(0,_i),jn=mn.substring(hn);we.current={start:_i,end:hn,value:mn,beforeTxt:Ln,afterTxt:jn}}catch(On){}}function Pi(){if(Ft&&we.current&&oe)try{var _i=Ft.value,hn=we.current,mn=hn.beforeTxt,Ln=hn.afterTxt,jn=hn.start,On=_i.length;if(_i.endsWith(Ln))On=_i.length-we.current.afterTxt.length;else if(_i.startsWith(mn))On=mn.length;else{var rn=mn[jn-1],ir=_i.indexOf(rn,jn-1);ir!==-1&&(On=ir+1)}Ft.setSelectionRange(On,On)}catch(tr){(0,We.ZP)(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(tr.message))}}return[Ii,Pi]}var xe=G(49658),Nt=function(){var oe=(0,Vt.useState)(!1),we=(0,Q.Z)(oe,2),Ii=we[0],Pi=we[1];return(0,Bt.Z)(function(){Pi((0,xe.Z)())},[]),Ii},_e=Nt,ti=G(16089),je=200,Be=600;function Se(Ft){var oe=Ft.prefixCls,we=Ft.upNode,Ii=Ft.downNode,Pi=Ft.upDisabled,_i=Ft.downDisabled,hn=Ft.onStep,mn=Vt.useRef(),Ln=Vt.useRef([]),jn=Vt.useRef();jn.current=hn;var On=function(){clearTimeout(mn.current)},rn=function(ur,$n){ur.preventDefault(),On(),jn.current($n);function Yn(){jn.current($n),mn.current=setTimeout(Yn,je)}mn.current=setTimeout(Yn,Be)};Vt.useEffect(function(){return function(){On(),Ln.current.forEach(function(T){return ti.Z.cancel(T)})}},[]);var ir=_e();if(ir)return null;var tr="".concat(oe,"-handler"),hr=le()(tr,"".concat(tr,"-up"),(0,ft.Z)({},"".concat(tr,"-up-disabled"),Pi)),Er=le()(tr,"".concat(tr,"-down"),(0,ft.Z)({},"".concat(tr,"-down-disabled"),_i)),Hn=function(){return Ln.current.push((0,ti.Z)(On))},Ir={unselectable:"on",role:"button",onMouseUp:Hn,onMouseLeave:Hn};return Vt.createElement("div",{className:"".concat(tr,"-wrap")},Vt.createElement("span",(0,ut.Z)({},Ir,{onMouseDown:function(ur){rn(ur,!0)},"aria-label":"Increase Value","aria-disabled":Pi,className:hr}),we||Vt.createElement("span",{unselectable:"on",className:"".concat(oe,"-handler-up-inner")})),Vt.createElement("span",(0,ut.Z)({},Ir,{onMouseDown:function(ur){rn(ur,!1)},"aria-label":"Decrease Value","aria-disabled":_i,className:Er}),Ii||Vt.createElement("span",{unselectable:"on",className:"".concat(oe,"-handler-down-inner")})))}function dt(Ft){var oe=typeof Ft=="number"?Ht(Ft):Ce(Ft).fullStr,we=oe.includes(".");return we?Ce(oe.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:Ft+"0"}var W=G(5643),Zt=function(){var Ft=(0,Vt.useRef)(0),oe=function(){ti.Z.cancel(Ft.current)};return(0,Vt.useEffect)(function(){return oe},[]),function(we){oe(),Ft.current=(0,ti.Z)(function(){we()})}},ze=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep"],Me=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","classes","className","classNames"],ye=function(oe,we){return oe||we.isEmpty()?we.toString():we.toNumber()},se=function(oe){var we=q(oe);return we.isInvalidate()?null:we},Ue=Vt.forwardRef(function(Ft,oe){var we,Ii=Ft.prefixCls,Pi=Ii===void 0?"rc-input-number":Ii,_i=Ft.className,hn=Ft.style,mn=Ft.min,Ln=Ft.max,jn=Ft.step,On=jn===void 0?1:jn,rn=Ft.defaultValue,ir=Ft.value,tr=Ft.disabled,hr=Ft.readOnly,Er=Ft.upHandler,Hn=Ft.downHandler,Ir=Ft.keyboard,T=Ft.controls,ur=T===void 0?!0:T,$n=Ft.classNames,Yn=Ft.stringMode,Nr=Ft.parser,Gn=Ft.formatter,uo=Ft.precision,zo=Ft.decimalSeparator,gr=Ft.onChange,pn=Ft.onInput,gi=Ft.onPressEnter,ct=Ft.onStep,J=(0,rt.Z)(Ft,ze),ot="".concat(Pi,"-input"),nt=Vt.useRef(null),Z=Vt.useState(!1),xt=(0,Q.Z)(Z,2),Ot=xt[0],ge=xt[1],te=Vt.useRef(!1),lt=Vt.useRef(!1),Qt=Vt.useRef(!1),me=Vt.useState(function(){return q(ir!=null?ir:rn)}),Fe=(0,Q.Z)(me,2),Tt=Fe[0],ce=Fe[1];function bi(Ye){ir===void 0&&ce(Ye)}var li=Vt.useCallback(function(Ye,Je){if(!Je)return uo>=0?uo:Math.max(Jt(Ye),Jt(On))},[uo,On]),Mi=Vt.useCallback(function(Ye){var Je=String(Ye);if(Nr)return Nr(Je);var Oi=Je;return zo&&(Oi=Oi.replace(zo,".")),Oi.replace(/[^\w.-]+/g,"")},[Nr,zo]),Pe=Vt.useRef(""),qe=Vt.useCallback(function(Ye,Je){if(Gn)return Gn(Ye,{userTyping:Je,input:String(Pe.current)});var Oi=typeof Ye=="number"?Ht(Ye):Ye;if(!Je){var pe=li(Oi,Je);if(de(Oi)&&(zo||pe>=0)){var z=zo||".";Oi=Ct(Oi,z,pe)}}return Oi},[Gn,li,zo]),Re=Vt.useState(function(){var Ye=rn!=null?rn:ir;return Tt.isInvalidate()&&["string","number"].includes((0,Pt.Z)(Ye))?Number.isNaN(Ye)?"":Ye:qe(Tt.toString(),!1)}),ni=(0,Q.Z)(Re,2),Ut=ni[0],Wt=ni[1];Pe.current=Ut;function Dt(Ye,Je){Wt(qe(Ye.isInvalidate()?Ye.toString(!1):Ye.toString(!Je),Je))}var ke=Vt.useMemo(function(){return se(Ln)},[Ln,uo]),re=Vt.useMemo(function(){return se(mn)},[mn,uo]),Ie=Vt.useMemo(function(){return!ke||!Tt||Tt.isInvalidate()?!1:ke.lessEquals(Tt)},[ke,Tt]),mt=Vt.useMemo(function(){return!re||!Tt||Tt.isInvalidate()?!1:Tt.lessEquals(re)},[re,Tt]),Xe=ee(nt.current,Ot),pi=(0,Q.Z)(Xe,2),ci=pi[0],Ui=pi[1],Ni=function(Je){return ke&&!Je.lessEquals(ke)?ke:re&&!re.lessEquals(Je)?re:null},Gi=function(Je){return!Ni(Je)},ki=function(Je,Oi){var pe=Je,z=Gi(pe)||pe.isEmpty();if(!pe.isEmpty()&&!Oi&&(pe=Ni(pe)||pe,z=!0),!hr&&!tr&&z){var fn=pe.toString(),vn=li(fn,Oi);return vn>=0&&(pe=q(Ct(fn,".",vn)),Gi(pe)||(pe=q(Ct(fn,".",vn,!0)))),pe.equals(Tt)||(bi(pe),gr==null||gr(pe.isEmpty()?null:ye(Yn,pe)),ir===void 0&&Dt(pe,Oi)),pe}return Tt},di=Zt(),Ki=function Ye(Je){if(ci(),Pe.current=Je,Wt(Je),!lt.current){var Oi=Mi(Je),pe=q(Oi);pe.isNaN()||ki(pe,!0)}pn==null||pn(Je),di(function(){var z=Je;Nr||(z=Je.replace(/。/g,".")),z!==Je&&Ye(z)})},Kt=function(){lt.current=!0},Ri=function(){lt.current=!1,Ki(nt.current.value)},At=function(Je){Ki(Je.target.value)},vi=function(Je){var Oi;if(!(Je&&Ie||!Je&&mt)){te.current=!1;var pe=q(Qt.current?dt(On):On);Je||(pe=pe.negate());var z=(Tt||q(0)).add(pe.toString()),fn=ki(z,!1);ct==null||ct(ye(Yn,fn),{offset:Qt.current?dt(On):On,type:Je?"up":"down"}),(Oi=nt.current)===null||Oi===void 0||Oi.focus()}},Qi=function(Je){var Oi=q(Mi(Ut)),pe=Oi;Oi.isNaN()?pe=ki(Tt,Je):pe=ki(Oi,Je),ir!==void 0?Dt(Tt,!1):pe.isNaN()||Dt(pe,!1)},Ti=function(){te.current=!0},gn=function(Je){var Oi=Je.key,pe=Je.shiftKey;te.current=!0,Qt.current=pe,Oi==="Enter"&&(lt.current||(te.current=!1),Qi(!1),gi==null||gi(Je)),Ir!==!1&&!lt.current&&["Up","ArrowUp","Down","ArrowDown"].includes(Oi)&&(vi(Oi==="Up"||Oi==="ArrowUp"),Je.preventDefault())},Mn=function(){te.current=!1,Qt.current=!1},mi=function(){Qi(!1),ge(!1),te.current=!1};return(0,Bt.o)(function(){Tt.isInvalidate()||Dt(Tt,!1)},[uo]),(0,Bt.o)(function(){var Ye=q(ir);ce(Ye);var Je=q(Mi(Ut));(!Ye.equals(Je)||!te.current||Gn)&&Dt(Ye,te.current)},[ir]),(0,Bt.o)(function(){Gn&&Ui()},[Ut]),Vt.createElement("div",{className:le()(Pi,$n==null?void 0:$n.input,_i,(we={},(0,ft.Z)(we,"".concat(Pi,"-focused"),Ot),(0,ft.Z)(we,"".concat(Pi,"-disabled"),tr),(0,ft.Z)(we,"".concat(Pi,"-readonly"),hr),(0,ft.Z)(we,"".concat(Pi,"-not-a-number"),Tt.isNaN()),(0,ft.Z)(we,"".concat(Pi,"-out-of-range"),!Tt.isInvalidate()&&!Gi(Tt)),we)),style:hn,onFocus:function(){ge(!0)},onBlur:mi,onKeyDown:gn,onKeyUp:Mn,onCompositionStart:Kt,onCompositionEnd:Ri,onBeforeInput:Ti},ur&&Vt.createElement(Se,{prefixCls:Pi,upNode:Er,downNode:Hn,upDisabled:Ie,downDisabled:mt,onStep:vi}),Vt.createElement("div",{className:"".concat(ot,"-wrap")},Vt.createElement("input",(0,ut.Z)({autoComplete:"off",role:"spinbutton","aria-valuemin":mn,"aria-valuemax":Ln,"aria-valuenow":Tt.isInvalidate()?null:Tt.toString(),step:On},J,{ref:(0,ve.sQ)(nt,oe),className:ot,value:Ut,onChange:At,disabled:tr,readOnly:hr}))))}),Fi=Vt.forwardRef(function(Ft,oe){var we=Ft.disabled,Ii=Ft.style,Pi=Ft.prefixCls,_i=Ft.value,hn=Ft.prefix,mn=Ft.suffix,Ln=Ft.addonBefore,jn=Ft.addonAfter,On=Ft.classes,rn=Ft.className,ir=Ft.classNames,tr=(0,rt.Z)(Ft,Me),hr=Vt.useRef(null),Er=function(Ir){hr.current&&(0,W.nH)(hr.current,Ir)};return Vt.createElement(Et.BaseInput,{inputElement:Vt.createElement(Ue,(0,ut.Z)({prefixCls:Pi,disabled:we,classNames:ir,ref:(0,ve.sQ)(hr,oe)},tr)),className:rn,triggerFocus:Er,prefixCls:Pi,value:_i,disabled:we,style:Ii,prefix:hn,suffix:mn,addonAfter:jn,addonBefore:Ln,classes:On,classNames:ir,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"}})});Fi.displayName="InputNumber";var wi=Fi,Ai=wi,ri=G(19080),sn=G(36355),Zi=G(92736),j=G(1684),P=G(19716),E=G(32441),B=G(33234),U=G(9937),D=G(17313),St=G(74207),ae=G(83116),$e=G(37613);const Ae=(Ft,oe)=>{let{componentCls:we,borderRadiusSM:Ii,borderRadiusLG:Pi}=Ft;const _i=oe==="lg"?Pi:Ii;return{[`&-${oe}`]:{[`${we}-handler-wrap`]:{borderStartEndRadius:_i,borderEndEndRadius:_i},[`${we}-handler-up`]:{borderStartEndRadius:_i},[`${we}-handler-down`]:{borderEndEndRadius:_i}}}},Qe=Ft=>{const{componentCls:oe,lineWidth:we,lineType:Ii,colorBorder:Pi,borderRadius:_i,fontSizeLG:hn,controlHeightLG:mn,controlHeightSM:Ln,colorError:jn,paddingInlineSM:On,colorTextDescription:rn,motionDurationMid:ir,handleHoverColor:tr,paddingInline:hr,paddingBlock:Er,handleBg:Hn,handleActiveBg:Ir,colorTextDisabled:T,borderRadiusSM:ur,borderRadiusLG:$n,controlWidth:Yn,handleVisible:Nr,handleBorderColor:Gn}=Ft;return[{[oe]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,D.Wf)(Ft)),(0,U.ik)(Ft)),(0,U.bi)(Ft,oe)),{display:"inline-block",width:Yn,margin:0,padding:0,border:`${we}px ${Ii} ${Pi}`,borderRadius:_i,"&-rtl":{direction:"rtl",[`${oe}-input`]:{direction:"rtl"}},"&-lg":{padding:0,fontSize:hn,borderRadius:$n,[`input${oe}-input`]:{height:mn-2*we}},"&-sm":{padding:0,borderRadius:ur,[`input${oe}-input`]:{height:Ln-2*we,padding:`0 ${On}px`}},"&:hover":Object.assign({},(0,U.pU)(Ft)),"&-focused":Object.assign({},(0,U.M1)(Ft)),"&-out-of-range":{[`${oe}-input-wrap`]:{input:{color:jn}}},"&-group":Object.assign(Object.assign(Object.assign({},(0,D.Wf)(Ft)),(0,U.s7)(Ft)),{"&-wrapper":{display:"inline-block",textAlign:"start",verticalAlign:"top",[`${oe}-affix-wrapper`]:{width:"100%"},"&-lg":{[`${oe}-group-addon`]:{borderRadius:$n,fontSize:Ft.fontSizeLG}},"&-sm":{[`${oe}-group-addon`]:{borderRadius:ur}},[`${oe}-wrapper-disabled > ${oe}-group-addon`]:Object.assign({},(0,U.Xy)(Ft))}}),[`&-disabled ${oe}-input`]:{cursor:"not-allowed"},[oe]:{"&-input":Object.assign(Object.assign(Object.assign(Object.assign({},(0,D.Wf)(Ft)),{width:"100%",padding:`${Er}px ${hr}px`,textAlign:"start",backgroundColor:"transparent",border:0,borderRadius:_i,outline:0,transition:`all ${ir} linear`,appearance:"textfield",fontSize:"inherit"}),(0,U.nz)(Ft.colorTextPlaceholder)),{'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':{margin:0,webkitAppearance:"none",appearance:"none"}})}})},{[oe]:Object.assign(Object.assign(Object.assign({[`&:hover ${oe}-handler-wrap, &-focused ${oe}-handler-wrap`]:{opacity:1},[`${oe}-handler-wrap`]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,width:Ft.handleWidth,height:"100%",background:Hn,borderStartStartRadius:0,borderStartEndRadius:_i,borderEndEndRadius:_i,borderEndStartRadius:0,opacity:Nr===!0?1:0,display:"flex",flexDirection:"column",alignItems:"stretch",transition:`opacity ${ir} linear ${ir}`,[`${oe}-handler`]:{display:"flex",alignItems:"center",justifyContent:"center",flex:"auto",height:"40%",[`
${oe}-handler-up-inner,
${oe}-handler-down-inner
`]:{marginInlineEnd:0,fontSize:Ft.handleFontSize}}},[`${oe}-handler`]:{height:"50%",overflow:"hidden",color:rn,fontWeight:"bold",lineHeight:0,textAlign:"center",cursor:"pointer",borderInlineStart:`${we}px ${Ii} ${Gn}`,transition:`all ${ir} linear`,"&:active":{background:Ir},"&:hover":{height:"60%",[`
${oe}-handler-up-inner,
${oe}-handler-down-inner
`]:{color:tr}},"&-up-inner, &-down-inner":Object.assign(Object.assign({},(0,D.Ro)()),{color:rn,transition:`all ${ir} linear`,userSelect:"none"})},[`${oe}-handler-up`]:{borderStartEndRadius:_i},[`${oe}-handler-down`]:{borderBlockStart:`${we}px ${Ii} ${Gn}`,borderEndEndRadius:_i}},Ae(Ft,"lg")),Ae(Ft,"sm")),{"&-disabled, &-readonly":{[`${oe}-handler-wrap`]:{display:"none"},[`${oe}-input`]:{color:"inherit"}},[`
${oe}-handler-up-disabled,
${oe}-handler-down-disabled
`]:{cursor:"not-allowed"},[`
${oe}-handler-up-disabled:hover &-handler-up-inner,
${oe}-handler-down-disabled:hover &-handler-down-inner
`]:{color:T}})},{[`${oe}-borderless`]:{borderColor:"transparent",boxShadow:"none",[`${oe}-handler-down`]:{borderBlockStartWidth:0}}}]},He=Ft=>{const{componentCls:oe,paddingBlock:we,paddingInline:Ii,inputAffixPadding:Pi,controlWidth:_i,borderRadiusLG:hn,borderRadiusSM:mn}=Ft;return{[`${oe}-affix-wrapper`]:Object.assign(Object.assign(Object.assign({},(0,U.ik)(Ft)),(0,U.bi)(Ft,`${oe}-affix-wrapper`)),{position:"relative",display:"inline-flex",width:_i,padding:0,paddingInlineStart:Ii,"&-lg":{borderRadius:hn},"&-sm":{borderRadius:mn},[`&:not(${oe}-affix-wrapper-disabled):hover`]:Object.assign(Object.assign({},(0,U.pU)(Ft)),{zIndex:1}),"&-focused, &:focus":{zIndex:1},[`&-disabled > ${oe}-disabled`]:{background:"transparent"},[`> div${oe}`]:{width:"100%",border:"none",outline:"none",[`&${oe}-focused`]:{boxShadow:"none !important"}},[`input${oe}-input`]:{padding:`${we}px 0`},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},[`${oe}-handler-wrap`]:{zIndex:2},[oe]:{"&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center",pointerEvents:"none"},"&-prefix":{marginInlineEnd:Pi},"&-suffix":{position:"absolute",insetBlockStart:0,insetInlineEnd:0,zIndex:1,height:"100%",marginInlineEnd:Ii,marginInlineStart:Pi}}})}};var Si=(0,ae.Z)("InputNumber",Ft=>{const oe=(0,$e.TS)(Ft,(0,U.e5)(Ft));return[Qe(oe),He(oe),(0,St.c)(oe)]},Ft=>Object.assign(Object.assign({},(0,U.TM)(Ft)),{controlWidth:90,handleWidth:Ft.controlHeightSM-Ft.lineWidth*2,handleFontSize:Ft.fontSize/2,handleVisible:"auto",handleActiveBg:Ft.colorFillAlter,handleBg:Ft.colorBgContainer,handleHoverColor:Ft.colorPrimary,handleBorderColor:Ft.colorBorder})),Ei=function(Ft,oe){var we={};for(var Ii in Ft)Object.prototype.hasOwnProperty.call(Ft,Ii)&&oe.indexOf(Ii)<0&&(we[Ii]=Ft[Ii]);if(Ft!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Pi=0,Ii=Object.getOwnPropertySymbols(Ft);Pi<Ii.length;Pi++)oe.indexOf(Ii[Pi])<0&&Object.prototype.propertyIsEnumerable.call(Ft,Ii[Pi])&&(we[Ii[Pi]]=Ft[Ii[Pi]]);return we};const Ci=Vt.forwardRef((Ft,oe)=>{const{getPrefixCls:we,direction:Ii}=Vt.useContext(sn.E_),Pi=Vt.useRef(null);Vt.useImperativeHandle(oe,()=>Pi.current);const{className:_i,rootClassName:hn,size:mn,disabled:Ln,prefixCls:jn,addonBefore:On,addonAfter:rn,prefix:ir,bordered:tr=!0,readOnly:hr,status:Er,controls:Hn}=Ft,Ir=Ei(Ft,["className","rootClassName","size","disabled","prefixCls","addonBefore","addonAfter","prefix","bordered","readOnly","status","controls"]),T=we("input-number",jn),[ur,$n]=Si(T),{compactSize:Yn,compactItemClassnames:Nr}=(0,B.ri)(T,Ii);let Gn=Vt.createElement(kt.Z,{className:`${T}-handler-up-inner`}),uo=Vt.createElement(Mt.Z,{className:`${T}-handler-down-inner`});const zo=typeof Hn=="boolean"?Hn:void 0;typeof Hn=="object"&&(Gn=typeof Hn.upIcon=="undefined"?Gn:Vt.createElement("span",{className:`${T}-handler-up-inner`},Hn.upIcon),uo=typeof Hn.downIcon=="undefined"?uo:Vt.createElement("span",{className:`${T}-handler-down-inner`},Hn.downIcon));const{hasFeedback:gr,status:pn,isFormItemInput:gi,feedbackIcon:ct}=Vt.useContext(E.aM),J=(0,ri.F)(pn,Er),ot=(0,P.Z)(te=>{var lt;return(lt=mn!=null?mn:Yn)!==null&&lt!==void 0?lt:te}),nt=Vt.useContext(j.Z),Z=Ln!=null?Ln:nt,xt=le()({[`${T}-lg`]:ot==="large",[`${T}-sm`]:ot==="small",[`${T}-rtl`]:Ii==="rtl",[`${T}-borderless`]:!tr,[`${T}-in-form-item`]:gi},(0,ri.Z)(T,J),Nr,$n),Ot=`${T}-group`,ge=Vt.createElement(Ai,Object.assign({ref:Pi,disabled:Z,className:le()(_i,hn),upHandler:Gn,downHandler:uo,prefixCls:T,readOnly:hr,controls:zo,prefix:ir,suffix:gr&&ct,addonAfter:rn&&Vt.createElement(B.BR,null,Vt.createElement(E.Ux,{override:!0,status:!0},rn)),addonBefore:On&&Vt.createElement(B.BR,null,Vt.createElement(E.Ux,{override:!0,status:!0},On)),classNames:{input:xt},classes:{affixWrapper:le()((0,ri.Z)(`${T}-affix-wrapper`,J,gr),{[`${T}-affix-wrapper-sm`]:ot==="small",[`${T}-affix-wrapper-lg`]:ot==="large",[`${T}-affix-wrapper-rtl`]:Ii==="rtl",[`${T}-affix-wrapper-borderless`]:!tr},$n),wrapper:le()({[`${Ot}-rtl`]:Ii==="rtl",[`${T}-wrapper-disabled`]:Z},$n),group:le()({[`${T}-group-wrapper-sm`]:ot==="small",[`${T}-group-wrapper-lg`]:ot==="large",[`${T}-group-wrapper-rtl`]:Ii==="rtl"},(0,ri.Z)(`${T}-group-wrapper`,J,gr),$n)}},Ir));return ur(ge)}),qt=Ci,ei=Ft=>Vt.createElement(Zi.ZP,{theme:{components:{InputNumber:{handleVisible:!0}}}},Vt.createElement(Ci,Object.assign({},Ft)));qt._InternalPanelDoNotUseOrYouWillBeFired=ei;var ln=qt},9432:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return De},n:function(){return Ht}});var Mt=G(19248),kt=G(92310),vt=G.n(kt),le=G(93681),ut=G(8654),ft=G(59301),Pt=G(19080),Q=G(36355),rt=G(1684),yt=G(19716),be=G(32441),pt=G(33234),Rt=G(59412),Ce=G(9937);function jt($t){return!!($t.prefix||$t.suffix||$t.allowClear)}var Jt=function($t,Xt){var Ct={};for(var q in $t)Object.prototype.hasOwnProperty.call($t,q)&&Xt.indexOf(q)<0&&(Ct[q]=$t[q]);if($t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Et=0,q=Object.getOwnPropertySymbols($t);Et<q.length;Et++)Xt.indexOf(q[Et])<0&&Object.prototype.propertyIsEnumerable.call($t,q[Et])&&(Ct[q[Et]]=$t[q[Et]]);return Ct};function Ht($t,Xt){if(!$t)return;$t.focus(Xt);const{cursor:Ct}=Xt||{};if(Ct){const q=$t.value.length;switch(Ct){case"start":$t.setSelectionRange(0,0);break;case"end":$t.setSelectionRange(q,q);break;default:$t.setSelectionRange(0,q);break}}}var De=(0,ft.forwardRef)(($t,Xt)=>{var Ct;const{prefixCls:q,bordered:Et=!0,status:Bt,size:ve,disabled:Vt,onBlur:We,onFocus:ee,suffix:xe,allowClear:Nt,addonAfter:_e,addonBefore:ti,className:je,style:Be,styles:Se,rootClassName:dt,onChange:W,classNames:Zt}=$t,ze=Jt($t,["prefixCls","bordered","status","size","disabled","onBlur","onFocus","suffix","allowClear","addonAfter","addonBefore","className","style","styles","rootClassName","onChange","classNames"]),{getPrefixCls:Me,direction:ye,input:se}=ft.useContext(Q.E_),Ue=Me("input",q),Fi=(0,ft.useRef)(null),[wi,Ai]=(0,Ce.ZP)(Ue),{compactSize:ri,compactItemClassnames:sn}=(0,pt.ri)(Ue,ye),Zi=(0,yt.Z)(Ci=>{var qt;return(qt=ve!=null?ve:ri)!==null&&qt!==void 0?qt:Ci}),j=ft.useContext(rt.Z),P=Vt!=null?Vt:j,{status:E,hasFeedback:B,feedbackIcon:U}=(0,ft.useContext)(be.aM),D=(0,Pt.F)(E,Bt),St=jt($t)||!!B,ae=(0,ft.useRef)(St);(0,ft.useEffect)(()=>{var Ci;St&&ae.current,ae.current=St},[St]);const $e=(0,Rt.Z)(Fi,!0),Ae=Ci=>{$e(),We==null||We(Ci)},Qe=Ci=>{$e(),ee==null||ee(Ci)},He=Ci=>{$e(),W==null||W(Ci)},Si=(B||xe)&&ft.createElement(ft.Fragment,null,xe,B&&U);let Ei;return typeof Nt=="object"&&(Nt!=null&&Nt.clearIcon)?Ei=Nt:Nt&&(Ei={clearIcon:ft.createElement(Mt.Z,null)}),wi(ft.createElement(le.default,Object.assign({ref:(0,ut.sQ)(Xt,Fi),prefixCls:Ue,autoComplete:se==null?void 0:se.autoComplete},ze,{disabled:P,onBlur:Ae,onFocus:Qe,style:Object.assign(Object.assign({},se==null?void 0:se.style),Be),styles:Object.assign(Object.assign({},se==null?void 0:se.styles),Se),suffix:Si,allowClear:Ei,className:vt()(je,dt,sn,se==null?void 0:se.className),onChange:He,addonAfter:_e&&ft.createElement(pt.BR,null,ft.createElement(be.Ux,{override:!0,status:!0},_e)),addonBefore:ti&&ft.createElement(pt.BR,null,ft.createElement(be.Ux,{override:!0,status:!0},ti)),classNames:Object.assign(Object.assign(Object.assign({},Zt),se==null?void 0:se.classNames),{input:vt()({[`${Ue}-sm`]:Zi==="small",[`${Ue}-lg`]:Zi==="large",[`${Ue}-rtl`]:ye==="rtl",[`${Ue}-borderless`]:!Et},!St&&(0,Pt.Z)(Ue,D),Zt==null?void 0:Zt.input,(Ct=se==null?void 0:se.classNames)===null||Ct===void 0?void 0:Ct.input,Ai)}),classes:{affixWrapper:vt()({[`${Ue}-affix-wrapper-sm`]:Zi==="small",[`${Ue}-affix-wrapper-lg`]:Zi==="large",[`${Ue}-affix-wrapper-rtl`]:ye==="rtl",[`${Ue}-affix-wrapper-borderless`]:!Et},(0,Pt.Z)(`${Ue}-affix-wrapper`,D,B),Ai),wrapper:vt()({[`${Ue}-group-rtl`]:ye==="rtl"},Ai),group:vt()({[`${Ue}-group-wrapper-sm`]:Zi==="small",[`${Ue}-group-wrapper-lg`]:Zi==="large",[`${Ue}-group-wrapper-rtl`]:ye==="rtl",[`${Ue}-group-wrapper-disabled`]:P},(0,Pt.Z)(`${Ue}-group-wrapper`,D,B),Ai)}})))})},1643:function(qn,Li,G){"use strict";var Mt=G(19248),kt=G(92310),vt=G.n(kt),le=G(9296),ut=G(59301),ft=G(19080),Pt=G(36355),Q=G(1684),rt=G(19716),yt=G(32441),be=G(9432),pt=G(9937),Rt=function(jt,Jt){var Ht={};for(var de in jt)Object.prototype.hasOwnProperty.call(jt,de)&&Jt.indexOf(de)<0&&(Ht[de]=jt[de]);if(jt!=null&&typeof Object.getOwnPropertySymbols=="function")for(var De=0,de=Object.getOwnPropertySymbols(jt);De<de.length;De++)Jt.indexOf(de[De])<0&&Object.prototype.propertyIsEnumerable.call(jt,de[De])&&(Ht[de[De]]=jt[de[De]]);return Ht};const Ce=(0,ut.forwardRef)((jt,Jt)=>{const{prefixCls:Ht,bordered:de=!0,size:De,disabled:$t,status:Xt,allowClear:Ct,showCount:q,classNames:Et,rootClassName:Bt,className:ve}=jt,Vt=Rt(jt,["prefixCls","bordered","size","disabled","status","allowClear","showCount","classNames","rootClassName","className"]),{getPrefixCls:We,direction:ee}=ut.useContext(Pt.E_),xe=(0,rt.Z)(De),Nt=ut.useContext(Q.Z),_e=$t!=null?$t:Nt,{status:ti,hasFeedback:je,feedbackIcon:Be}=ut.useContext(yt.aM),Se=(0,ft.F)(ti,Xt),dt=ut.useRef(null);ut.useImperativeHandle(Jt,()=>{var ye;return{resizableTextArea:(ye=dt.current)===null||ye===void 0?void 0:ye.resizableTextArea,focus:se=>{var Ue,Fi;(0,be.n)((Fi=(Ue=dt.current)===null||Ue===void 0?void 0:Ue.resizableTextArea)===null||Fi===void 0?void 0:Fi.textArea,se)},blur:()=>{var se;return(se=dt.current)===null||se===void 0?void 0:se.blur()}}});const W=We("input",Ht);let Zt;typeof Ct=="object"&&(Ct!=null&&Ct.clearIcon)?Zt=Ct:Ct&&(Zt={clearIcon:ut.createElement(Mt.Z,null)});const[ze,Me]=(0,pt.ZP)(W);return ze(ut.createElement(le.default,Object.assign({},Vt,{disabled:_e,allowClear:Zt,className:vt()(ve,Bt),classes:{affixWrapper:vt()(`${W}-textarea-affix-wrapper`,{[`${W}-affix-wrapper-rtl`]:ee==="rtl",[`${W}-affix-wrapper-borderless`]:!de,[`${W}-affix-wrapper-sm`]:xe==="small",[`${W}-affix-wrapper-lg`]:xe==="large",[`${W}-textarea-show-count`]:q},(0,ft.Z)(`${W}-affix-wrapper`,Se),Me)},classNames:Object.assign(Object.assign({},Et),{textarea:vt()({[`${W}-borderless`]:!de,[`${W}-sm`]:xe==="small",[`${W}-lg`]:xe==="large"},(0,ft.Z)(W,Se),Me,Et==null?void 0:Et.textarea)}),prefixCls:W,suffix:je&&ut.createElement("span",{className:`${W}-textarea-suffix`},Be),showCount:q,ref:dt})))});Li.Z=Ce},59412:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return kt}});var Mt=G(59301);function kt(vt,le){const ut=(0,Mt.useRef)([]),ft=()=>{ut.current.push(setTimeout(()=>{var Pt,Q,rt,yt;!((Pt=vt.current)===null||Pt===void 0)&&Pt.input&&((Q=vt.current)===null||Q===void 0?void 0:Q.input.getAttribute("type"))==="password"&&(!((rt=vt.current)===null||rt===void 0)&&rt.input.hasAttribute("value"))&&((yt=vt.current)===null||yt===void 0||yt.input.removeAttribute("value"))}))};return(0,Mt.useEffect)(()=>(le&&ft(),()=>ut.current.forEach(Pt=>{Pt&&clearTimeout(Pt)})),[]),ft}},92832:function(qn,Li,G){"use strict";G.d(Li,{default:function(){return xe}});var Mt=G(92310),kt=G.n(Mt),vt=G(59301),le=G(36355),ut=G(32441),ft=G(9937),Q=Nt=>{const{getPrefixCls:_e,direction:ti}=(0,vt.useContext)(le.E_),{prefixCls:je,className:Be}=Nt,Se=_e("input-group",je),dt=_e("input"),[W,Zt]=(0,ft.ZP)(dt),ze=kt()(Se,{[`${Se}-lg`]:Nt.size==="large",[`${Se}-sm`]:Nt.size==="small",[`${Se}-compact`]:Nt.compact,[`${Se}-rtl`]:ti==="rtl"},Zt,Be),Me=(0,vt.useContext)(ut.aM),ye=(0,vt.useMemo)(()=>Object.assign(Object.assign({},Me),{isFormItemInput:!1}),[Me]);return W(vt.createElement("span",{className:ze,style:Nt.style,onMouseEnter:Nt.onMouseEnter,onMouseLeave:Nt.onMouseLeave,onFocus:Nt.onFocus,onBlur:Nt.onBlur},vt.createElement(ut.aM.Provider,{value:ye},Nt.children)))},rt=G(9432),yt=G(73331),be=G(15277),pt=G(2738),Rt=G(8654),Ce=G(59412),jt=function(Nt,_e){var ti={};for(var je in Nt)Object.prototype.hasOwnProperty.call(Nt,je)&&_e.indexOf(je)<0&&(ti[je]=Nt[je]);if(Nt!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Be=0,je=Object.getOwnPropertySymbols(Nt);Be<je.length;Be++)_e.indexOf(je[Be])<0&&Object.prototype.propertyIsEnumerable.call(Nt,je[Be])&&(ti[je[Be]]=Nt[je[Be]]);return ti};const Jt=Nt=>Nt?vt.createElement(be.Z,null):vt.createElement(yt.Z,null),Ht={click:"onClick",hover:"onMouseOver"};var De=vt.forwardRef((Nt,_e)=>{const{visibilityToggle:ti=!0}=Nt,je=typeof ti=="object"&&ti.visible!==void 0,[Be,Se]=(0,vt.useState)(()=>je?ti.visible:!1),dt=(0,vt.useRef)(null);vt.useEffect(()=>{je&&Se(ti.visible)},[je,ti]);const W=(0,Ce.Z)(dt),Zt=()=>{const{disabled:P}=Nt;P||(Be&&W(),Se(E=>{var B;const U=!E;return typeof ti=="object"&&((B=ti.onVisibleChange)===null||B===void 0||B.call(ti,U)),U}))},ze=P=>{const{action:E="click",iconRender:B=Jt}=Nt,U=Ht[E]||"",D=B(Be),St={[U]:Zt,className:`${P}-icon`,key:"passwordIcon",onMouseDown:ae=>{ae.preventDefault()},onMouseUp:ae=>{ae.preventDefault()}};return vt.cloneElement(vt.isValidElement(D)?D:vt.createElement("span",null,D),St)},{className:Me,prefixCls:ye,inputPrefixCls:se,size:Ue}=Nt,Fi=jt(Nt,["className","prefixCls","inputPrefixCls","size"]),{getPrefixCls:wi}=vt.useContext(le.E_),Ai=wi("input",se),ri=wi("input-password",ye),sn=ti&&ze(ri),Zi=kt()(ri,Me,{[`${ri}-${Ue}`]:!!Ue}),j=Object.assign(Object.assign({},(0,pt.Z)(Fi,["suffix","iconRender","visibilityToggle"])),{type:Be?"text":"password",className:Zi,prefixCls:Ai,suffix:sn});return Ue&&(j.size=Ue),vt.createElement(rt.Z,Object.assign({ref:(0,Rt.sQ)(_e,dt)},j))}),$t=G(47472),Xt=G(92343),Ct=G(3113),q=G(19716),Et=G(33234),Bt=function(Nt,_e){var ti={};for(var je in Nt)Object.prototype.hasOwnProperty.call(Nt,je)&&_e.indexOf(je)<0&&(ti[je]=Nt[je]);if(Nt!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Be=0,je=Object.getOwnPropertySymbols(Nt);Be<je.length;Be++)_e.indexOf(je[Be])<0&&Object.prototype.propertyIsEnumerable.call(Nt,je[Be])&&(ti[je[Be]]=Nt[je[Be]]);return ti},Vt=vt.forwardRef((Nt,_e)=>{const{prefixCls:ti,inputPrefixCls:je,className:Be,size:Se,suffix:dt,enterButton:W=!1,addonAfter:Zt,loading:ze,disabled:Me,onSearch:ye,onChange:se,onCompositionStart:Ue,onCompositionEnd:Fi}=Nt,wi=Bt(Nt,["prefixCls","inputPrefixCls","className","size","suffix","enterButton","addonAfter","loading","disabled","onSearch","onChange","onCompositionStart","onCompositionEnd"]),{getPrefixCls:Ai,direction:ri}=vt.useContext(le.E_),sn=vt.useRef(!1),Zi=Ai("input-search",ti),j=Ai("input",je),{compactSize:P}=(0,Et.ri)(Zi,ri),E=(0,q.Z)(ei=>{var ln;return(ln=Se!=null?Se:P)!==null&&ln!==void 0?ln:ei}),B=vt.useRef(null),U=ei=>{ei&&ei.target&&ei.type==="click"&&ye&&ye(ei.target.value,ei,{source:"clear"}),se&&se(ei)},D=ei=>{var ln;document.activeElement===((ln=B.current)===null||ln===void 0?void 0:ln.input)&&ei.preventDefault()},St=ei=>{var ln,Ft;ye&&ye((Ft=(ln=B.current)===null||ln===void 0?void 0:ln.input)===null||Ft===void 0?void 0:Ft.value,ei,{source:"input"})},ae=ei=>{sn.current||ze||St(ei)},$e=typeof W=="boolean"?vt.createElement($t.Z,null):null,Ae=`${Zi}-button`;let Qe;const He=W||{},Si=He.type&&He.type.__ANT_BUTTON===!0;Si||He.type==="button"?Qe=(0,Xt.Tm)(He,Object.assign({onMouseDown:D,onClick:ei=>{var ln,Ft;(Ft=(ln=He==null?void 0:He.props)===null||ln===void 0?void 0:ln.onClick)===null||Ft===void 0||Ft.call(ln,ei),St(ei)},key:"enterButton"},Si?{className:Ae,size:E}:{})):Qe=vt.createElement(Ct.ZP,{className:Ae,type:W?"primary":void 0,size:E,disabled:Me,key:"enterButton",onMouseDown:D,onClick:St,loading:ze,icon:$e},W),Zt&&(Qe=[Qe,(0,Xt.Tm)(Zt,{key:"addonAfter"})]);const Ei=kt()(Zi,{[`${Zi}-rtl`]:ri==="rtl",[`${Zi}-${E}`]:!!E,[`${Zi}-with-button`]:!!W},Be),Ci=ei=>{sn.current=!0,Ue==null||Ue(ei)},qt=ei=>{sn.current=!1,Fi==null||Fi(ei)};return vt.createElement(rt.Z,Object.assign({ref:(0,Rt.sQ)(B,_e),onPressEnter:ae},wi,{size:E,onCompositionStart:Ci,onCompositionEnd:qt,prefixCls:j,addonAfter:Qe,suffix:dt,onChange:U,className:Ei,disabled:Me}))}),We=G(1643);const ee=rt.Z;ee.Group=Q,ee.Search=Vt,ee.TextArea=We.Z,ee.Password=De;var xe=ee},9937:function(qn,Li,G){"use strict";G.d(Li,{M1:function(){return Pt},TM:function(){return Xt},Xy:function(){return Q},bi:function(){return be},e5:function(){return $t},ik:function(){return pt},nz:function(){return ut},pU:function(){return ft},s7:function(){return Rt},x0:function(){return yt}});var Mt=G(17313),kt=G(74207),vt=G(37613),le=G(83116);const ut=Ct=>({"&::-moz-placeholder":{opacity:1},"&::placeholder":{color:Ct,userSelect:"none"},"&:placeholder-shown":{textOverflow:"ellipsis"}}),ft=Ct=>({borderColor:Ct.hoverBorderColor}),Pt=Ct=>({borderColor:Ct.activeBorderColor,boxShadow:Ct.activeShadow,outline:0}),Q=Ct=>({color:Ct.colorTextDisabled,backgroundColor:Ct.colorBgContainerDisabled,borderColor:Ct.colorBorder,boxShadow:"none",cursor:"not-allowed",opacity:1,"&:hover":Object.assign({},ft((0,vt.TS)(Ct,{hoverBorderColor:Ct.colorBorder})))}),rt=Ct=>{const{paddingBlockLG:q,fontSizeLG:Et,lineHeightLG:Bt,borderRadiusLG:ve,paddingInlineLG:Vt}=Ct;return{padding:`${q}px ${Vt}px`,fontSize:Et,lineHeight:Bt,borderRadius:ve}},yt=Ct=>({padding:`${Ct.paddingBlockSM}px ${Ct.paddingInlineSM}px`,borderRadius:Ct.borderRadiusSM}),be=(Ct,q)=>{const{componentCls:Et,colorError:Bt,colorWarning:ve,errorActiveShadow:Vt,warningActiveShadow:We,colorErrorBorderHover:ee,colorWarningBorderHover:xe}=Ct;return{[`&-status-error:not(${q}-disabled):not(${q}-borderless)${q}`]:{borderColor:Bt,"&:hover":{borderColor:ee},"&:focus, &-focused":Object.assign({},Pt((0,vt.TS)(Ct,{activeBorderColor:Bt,activeShadow:Vt}))),[`${Et}-prefix, ${Et}-suffix`]:{color:Bt}},[`&-status-warning:not(${q}-disabled):not(${q}-borderless)${q}`]:{borderColor:ve,"&:hover":{borderColor:xe},"&:focus, &-focused":Object.assign({},Pt((0,vt.TS)(Ct,{activeBorderColor:ve,activeShadow:We}))),[`${Et}-prefix, ${Et}-suffix`]:{color:ve}}}},pt=Ct=>Object.assign(Object.assign({position:"relative",display:"inline-block",width:"100%",minWidth:0,padding:`${Ct.paddingBlock}px ${Ct.paddingInline}px`,color:Ct.colorText,fontSize:Ct.fontSize,lineHeight:Ct.lineHeight,backgroundColor:Ct.colorBgContainer,backgroundImage:"none",borderWidth:Ct.lineWidth,borderStyle:Ct.lineType,borderColor:Ct.colorBorder,borderRadius:Ct.borderRadius,transition:`all ${Ct.motionDurationMid}`},ut(Ct.colorTextPlaceholder)),{"&:hover":Object.assign({},ft(Ct)),"&:focus, &-focused":Object.assign({},Pt(Ct)),"&-disabled, &[disabled]":Object.assign({},Q(Ct)),"&-borderless":{"&, &:hover, &:focus, &-focused, &-disabled, &[disabled]":{backgroundColor:"transparent",border:"none",boxShadow:"none"}},"textarea&":{maxWidth:"100%",height:"auto",minHeight:Ct.controlHeight,lineHeight:Ct.lineHeight,verticalAlign:"bottom",transition:`all ${Ct.motionDurationSlow}, height 0s`,resize:"vertical"},"&-lg":Object.assign({},rt(Ct)),"&-sm":Object.assign({},yt(Ct)),"&-rtl":{direction:"rtl"},"&-textarea-rtl":{direction:"rtl"}}),Rt=Ct=>{const{componentCls:q,antCls:Et}=Ct;return{position:"relative",display:"table",width:"100%",borderCollapse:"separate",borderSpacing:0,"&[class*='col-']":{paddingInlineEnd:Ct.paddingXS,"&:last-child":{paddingInlineEnd:0}},[`&-lg ${q}, &-lg > ${q}-group-addon`]:Object.assign({},rt(Ct)),[`&-sm ${q}, &-sm > ${q}-group-addon`]:Object.assign({},yt(Ct)),[`&-lg ${Et}-select-single ${Et}-select-selector`]:{height:Ct.controlHeightLG},[`&-sm ${Et}-select-single ${Et}-select-selector`]:{height:Ct.controlHeightSM},[`> ${q}`]:{display:"table-cell","&:not(:first-child):not(:last-child)":{borderRadius:0}},[`${q}-group`]:{"&-addon, &-wrap":{display:"table-cell",width:1,whiteSpace:"nowrap",verticalAlign:"middle","&:not(:first-child):not(:last-child)":{borderRadius:0}},"&-wrap > *":{display:"block !important"},"&-addon":{position:"relative",padding:`0 ${Ct.paddingInline}px`,color:Ct.colorText,fontWeight:"normal",fontSize:Ct.fontSize,textAlign:"center",backgroundColor:Ct.colorFillAlter,border:`${Ct.lineWidth}px ${Ct.lineType} ${Ct.colorBorder}`,borderRadius:Ct.borderRadius,transition:`all ${Ct.motionDurationSlow}`,lineHeight:1,[`${Et}-select`]:{margin:`-${Ct.paddingBlock+1}px -${Ct.paddingInline}px`,[`&${Et}-select-single:not(${Et}-select-customize-input)`]:{[`${Et}-select-selector`]:{backgroundColor:"inherit",border:`${Ct.lineWidth}px ${Ct.lineType} transparent`,boxShadow:"none"}},"&-open, &-focused":{[`${Et}-select-selector`]:{color:Ct.colorPrimary}}},[`${Et}-cascader-picker`]:{margin:`-9px -${Ct.paddingInline}px`,backgroundColor:"transparent",[`${Et}-cascader-input`]:{textAlign:"start",border:0,boxShadow:"none"}}},"&-addon:first-child":{borderInlineEnd:0},"&-addon:last-child":{borderInlineStart:0}},[`${q}`]:{width:"100%",marginBottom:0,textAlign:"inherit","&:focus":{zIndex:1,borderInlineEndWidth:1},"&:hover":{zIndex:1,borderInlineEndWidth:1,[`${q}-search-with-button &`]:{zIndex:0}}},[`> ${q}:first-child, ${q}-group-addon:first-child`]:{borderStartEndRadius:0,borderEndEndRadius:0,[`${Et}-select ${Et}-select-selector`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${q}-affix-wrapper`]:{[`&:not(:first-child) ${q}`]:{borderStartStartRadius:0,borderEndStartRadius:0},[`&:not(:last-child) ${q}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${q}:last-child, ${q}-group-addon:last-child`]:{borderStartStartRadius:0,borderEndStartRadius:0,[`${Et}-select ${Et}-select-selector`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`${q}-affix-wrapper`]:{"&:not(:last-child)":{borderStartEndRadius:0,borderEndEndRadius:0,[`${q}-search &`]:{borderStartStartRadius:Ct.borderRadius,borderEndStartRadius:Ct.borderRadius}},[`&:not(:first-child), ${q}-search &:not(:first-child)`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`&${q}-group-compact`]:Object.assign(Object.assign({display:"block"},(0,Mt.dF)()),{[`${q}-group-addon, ${q}-group-wrap, > ${q}`]:{"&:not(:first-child):not(:last-child)":{borderInlineEndWidth:Ct.lineWidth,"&:hover":{zIndex:1},"&:focus":{zIndex:1}}},"& > *":{display:"inline-block",float:"none",verticalAlign:"top",borderRadius:0},[`
& > ${q}-affix-wrapper,
& > ${q}-number-affix-wrapper,
& > ${Et}-picker-range
`]:{display:"inline-flex"},"& > *:not(:last-child)":{marginInlineEnd:-Ct.lineWidth,borderInlineEndWidth:Ct.lineWidth},[`${q}`]:{float:"none"},[`& > ${Et}-select > ${Et}-select-selector,
& > ${Et}-select-auto-complete ${q},
& > ${Et}-cascader-picker ${q},
& > ${q}-group-wrapper ${q}`]:{borderInlineEndWidth:Ct.lineWidth,borderRadius:0,"&:hover":{zIndex:1},"&:focus":{zIndex:1}},[`& > ${Et}-select-focused`]:{zIndex:1},[`& > ${Et}-select > ${Et}-select-arrow`]:{zIndex:1},[`& > *:first-child,
& > ${Et}-select:first-child > ${Et}-select-selector,
& > ${Et}-select-auto-complete:first-child ${q},
& > ${Et}-cascader-picker:first-child ${q}`]:{borderStartStartRadius:Ct.borderRadius,borderEndStartRadius:Ct.borderRadius},[`& > *:last-child,
& > ${Et}-select:last-child > ${Et}-select-selector,
& > ${Et}-cascader-picker:last-child ${q},
& > ${Et}-cascader-picker-focused:last-child ${q}`]:{borderInlineEndWidth:Ct.lineWidth,borderStartEndRadius:Ct.borderRadius,borderEndEndRadius:Ct.borderRadius},[`& > ${Et}-select-auto-complete ${q}`]:{verticalAlign:"top"},[`${q}-group-wrapper + ${q}-group-wrapper`]:{marginInlineStart:-Ct.lineWidth,[`${q}-affix-wrapper`]:{borderRadius:0}},[`${q}-group-wrapper:not(:last-child)`]:{[`&${q}-search > ${q}-group`]:{[`& > ${q}-group-addon > ${q}-search-button`]:{borderRadius:0},[`& > ${q}`]:{borderStartStartRadius:Ct.borderRadius,borderStartEndRadius:0,borderEndEndRadius:0,borderEndStartRadius:Ct.borderRadius}}}})}},Ce=Ct=>{const{componentCls:q,controlHeightSM:Et,lineWidth:Bt}=Ct,Vt=(Et-Bt*2-16)/2;return{[q]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,Mt.Wf)(Ct)),pt(Ct)),be(Ct,q)),{'&[type="color"]':{height:Ct.controlHeight,[`&${q}-lg`]:{height:Ct.controlHeightLG},[`&${q}-sm`]:{height:Et,paddingTop:Vt,paddingBottom:Vt}},'&[type="search"]::-webkit-search-cancel-button, &[type="search"]::-webkit-search-decoration':{"-webkit-appearance":"none"}})}},jt=Ct=>{const{componentCls:q}=Ct;return{[`${q}-clear-icon`]:{margin:0,color:Ct.colorTextQuaternary,fontSize:Ct.fontSizeIcon,verticalAlign:-1,cursor:"pointer",transition:`color ${Ct.motionDurationSlow}`,"&:hover":{color:Ct.colorTextTertiary},"&:active":{color:Ct.colorText},"&-hidden":{visibility:"hidden"},"&-has-suffix":{margin:`0 ${Ct.inputAffixPadding}px`}}}},Jt=Ct=>{const{componentCls:q,inputAffixPadding:Et,colorTextDescription:Bt,motionDurationSlow:ve,colorIcon:Vt,colorIconHover:We,iconCls:ee}=Ct;return{[`${q}-affix-wrapper`]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},pt(Ct)),{display:"inline-flex",[`&:not(${q}-affix-wrapper-disabled):hover`]:Object.assign(Object.assign({},ft(Ct)),{zIndex:1,[`${q}-search-with-button &`]:{zIndex:0}}),"&-focused, &:focus":{zIndex:1},"&-disabled":{[`${q}[disabled]`]:{background:"transparent"}},[`> input${q}`]:{padding:0,fontSize:"inherit",border:"none",borderRadius:0,outline:"none","&::-ms-reveal":{display:"none"},"&:focus":{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},[`${q}`]:{"&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center","> *:not(:last-child)":{marginInlineEnd:Ct.paddingXS}},"&-show-count-suffix":{color:Bt},"&-show-count-has-suffix":{marginInlineEnd:Ct.paddingXXS},"&-prefix":{marginInlineEnd:Et},"&-suffix":{marginInlineStart:Et}}}),jt(Ct)),{[`${ee}${q}-password-icon`]:{color:Vt,cursor:"pointer",transition:`all ${ve}`,"&:hover":{color:We}}}),be(Ct,`${q}-affix-wrapper`))}},Ht=Ct=>{const{componentCls:q,colorError:Et,colorWarning:Bt,borderRadiusLG:ve,borderRadiusSM:Vt}=Ct;return{[`${q}-group`]:Object.assign(Object.assign(Object.assign({},(0,Mt.Wf)(Ct)),Rt(Ct)),{"&-rtl":{direction:"rtl"},"&-wrapper":{display:"inline-block",width:"100%",textAlign:"start",verticalAlign:"top","&-rtl":{direction:"rtl"},"&-lg":{[`${q}-group-addon`]:{borderRadius:ve,fontSize:Ct.fontSizeLG}},"&-sm":{[`${q}-group-addon`]:{borderRadius:Vt}},"&-status-error":{[`${q}-group-addon`]:{color:Et,borderColor:Et}},"&-status-warning":{[`${q}-group-addon`]:{color:Bt,borderColor:Bt}},"&-disabled":{[`${q}-group-addon`]:Object.assign({},Q(Ct))},[`&:not(${q}-compact-first-item):not(${q}-compact-last-item)${q}-compact-item`]:{[`${q}, ${q}-group-addon`]:{borderRadius:0}},[`&:not(${q}-compact-last-item)${q}-compact-first-item`]:{[`${q}, ${q}-group-addon`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${q}-compact-first-item)${q}-compact-last-item`]:{[`${q}, ${q}-group-addon`]:{borderStartStartRadius:0,borderEndStartRadius:0}}}})}},de=Ct=>{const{componentCls:q,antCls:Et}=Ct,Bt=`${q}-search`;return{[Bt]:{[`${q}`]:{"&:hover, &:focus":{borderColor:Ct.colorPrimaryHover,[`+ ${q}-group-addon ${Bt}-button:not(${Et}-btn-primary)`]:{borderInlineStartColor:Ct.colorPrimaryHover}}},[`${q}-affix-wrapper`]:{borderRadius:0},[`${q}-lg`]:{lineHeight:Ct.lineHeightLG-2e-4},[`> ${q}-group`]:{[`> ${q}-group-addon:last-child`]:{insetInlineStart:-1,padding:0,border:0,[`${Bt}-button`]:{paddingTop:0,paddingBottom:0,borderStartStartRadius:0,borderStartEndRadius:Ct.borderRadius,borderEndEndRadius:Ct.borderRadius,borderEndStartRadius:0,boxShadow:"none"},[`${Bt}-button:not(${Et}-btn-primary)`]:{color:Ct.colorTextDescription,"&:hover":{color:Ct.colorPrimaryHover},"&:active":{color:Ct.colorPrimaryActive},[`&${Et}-btn-loading::before`]:{insetInlineStart:0,insetInlineEnd:0,insetBlockStart:0,insetBlockEnd:0}}}},[`${Bt}-button`]:{height:Ct.controlHeight,"&:hover, &:focus":{zIndex:1}},[`&-large ${Bt}-button`]:{height:Ct.controlHeightLG},[`&-small ${Bt}-button`]:{height:Ct.controlHeightSM},"&-rtl":{direction:"rtl"},[`&${q}-compact-item`]:{[`&:not(${q}-compact-last-item)`]:{[`${q}-group-addon`]:{[`${q}-search-button`]:{marginInlineEnd:-Ct.lineWidth,borderRadius:0}}},[`&:not(${q}-compact-first-item)`]:{[`${q},${q}-affix-wrapper`]:{borderRadius:0}},[`> ${q}-group-addon ${q}-search-button,
> ${q},
${q}-affix-wrapper`]:{"&:hover,&:focus,&:active":{zIndex:2}},[`> ${q}-affix-wrapper-focused`]:{zIndex:2}}}}},De=Ct=>{const{componentCls:q,paddingLG:Et}=Ct,Bt=`${q}-textarea`;return{[Bt]:{position:"relative","&-show-count":{[`> ${q}`]:{height:"100%"},[`${q}-data-count`]:{position:"absolute",bottom:-Ct.fontSize*Ct.lineHeight,insetInlineEnd:0,color:Ct.colorTextDescription,whiteSpace:"nowrap",pointerEvents:"none"}},"&-allow-clear":{[`> ${q}`]:{paddingInlineEnd:Et}},[`&-affix-wrapper${Bt}-has-feedback`]:{[`${q}`]:{paddingInlineEnd:Et}},[`&-affix-wrapper${q}-affix-wrapper`]:{padding:0,[`> textarea${q}`]:{fontSize:"inherit",border:"none",outline:"none","&:focus":{boxShadow:"none !important"}},[`${q}-suffix`]:{margin:0,"> *:not(:last-child)":{marginInline:0},[`${q}-clear-icon`]:{position:"absolute",insetInlineEnd:Ct.paddingXS,insetBlockStart:Ct.paddingXS},[`${Bt}-suffix`]:{position:"absolute",top:0,insetInlineEnd:Ct.paddingInline,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto",pointerEvents:"none"}}}}}};function $t(Ct){return(0,vt.TS)(Ct,{inputAffixPadding:Ct.paddingXXS})}const Xt=Ct=>{const{controlHeight:q,fontSize:Et,lineHeight:Bt,lineWidth:ve,controlHeightSM:Vt,controlHeightLG:We,fontSizeLG:ee,lineHeightLG:xe,paddingSM:Nt,controlPaddingHorizontalSM:_e,controlPaddingHorizontal:ti,colorFillAlter:je,colorPrimaryHover:Be,controlOutlineWidth:Se,controlOutline:dt,colorErrorOutline:W,colorWarningOutline:Zt}=Ct;return{paddingBlock:Math.max(Math.round((q-Et*Bt)/2*10)/10-ve,3),paddingBlockSM:Math.max(Math.round((Vt-Et*Bt)/2*10)/10-ve,0),paddingBlockLG:Math.ceil((We-ee*xe)/2*10)/10-ve,paddingInline:Nt-ve,paddingInlineSM:_e-ve,paddingInlineLG:ti-ve,addonBg:je,activeBorderColor:Be,hoverBorderColor:Be,activeShadow:`0 0 0 ${Se}px ${dt}`,errorActiveShadow:`0 0 0 ${Se}px ${W}`,warningActiveShadow:`0 0 0 ${Se}px ${Zt}`}};Li.ZP=(0,le.Z)("Input",Ct=>{const q=(0,vt.TS)(Ct,$t(Ct));return[Ce(q),De(q),Jt(q),Ht(q),de(q),(0,kt.c)(q)]},Xt)},5112:function(qn,Li,G){"use strict";G.d(Li,{ZP:function(){return dt}});var Mt=G(92310),kt=G.n(Mt),vt=G(18929),le=G(26112),ut=G(59301),ft=G(36355),Pt=G(19716);const Q=ut.createContext(null),rt=Q.Provider;var yt=Q;const be=ut.createContext(null),pt=be.Provider;var Rt=G(5630),Ce=G(8654),jt=G(1684),Jt=G(32441),Ht=G(17313),de=G(83116),De=G(37613);const $t=W=>{const{componentCls:Zt,antCls:ze}=W,Me=`${Zt}-group`;return{[Me]:Object.assign(Object.assign({},(0,Ht.Wf)(W)),{display:"inline-block",fontSize:0,[`&${Me}-rtl`]:{direction:"rtl"},[`${ze}-badge ${ze}-badge-count`]:{zIndex:1},[`> ${ze}-badge:not(:first-child) > ${ze}-button-wrapper`]:{borderInlineStart:"none"}})}},Xt=W=>{const{componentCls:Zt,wrapperMarginInlineEnd:ze,colorPrimary:Me,radioSize:ye,motionDurationSlow:se,motionDurationMid:Ue,motionEaseInOutCirc:Fi,colorBgContainer:wi,colorBorder:Ai,lineWidth:ri,dotSize:sn,colorBgContainerDisabled:Zi,colorTextDisabled:j,paddingXS:P,dotColorDisabled:E,lineType:B,radioDotDisabledSize:U,wireframe:D,colorWhite:St}=W,ae=`${Zt}-inner`;return{[`${Zt}-wrapper`]:Object.assign(Object.assign({},(0,Ht.Wf)(W)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:ze,cursor:"pointer",[`&${Zt}-wrapper-rtl`]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:W.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},[`${Zt}-checked::after`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:`${ri}px ${B} ${Me}`,borderRadius:"50%",visibility:"hidden",content:'""'},[Zt]:Object.assign(Object.assign({},(0,Ht.Wf)(W)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),[`${Zt}-wrapper:hover &,
&:hover ${ae}`]:{borderColor:Me},[`${Zt}-input:focus-visible + ${ae}`]:Object.assign({},(0,Ht.oN)(W)),[`${Zt}:hover::after, ${Zt}-wrapper:hover &::after`]:{visibility:"visible"},[`${Zt}-inner`]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:ye,height:ye,marginBlockStart:ye/-2,marginInlineStart:ye/-2,backgroundColor:D?Me:St,borderBlockStart:0,borderInlineStart:0,borderRadius:ye,transform:"scale(0)",opacity:0,transition:`all ${se} ${Fi}`,content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:ye,height:ye,backgroundColor:wi,borderColor:Ai,borderStyle:"solid",borderWidth:ri,borderRadius:"50%",transition:`all ${Ue}`},[`${Zt}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0},[`${Zt}-checked`]:{[ae]:{borderColor:Me,backgroundColor:D?wi:Me,"&::after":{transform:`scale(${sn/ye})`,opacity:1,transition:`all ${se} ${Fi}`}}},[`${Zt}-disabled`]:{cursor:"not-allowed",[ae]:{backgroundColor:Zi,borderColor:Ai,cursor:"not-allowed","&::after":{backgroundColor:E}},[`${Zt}-input`]:{cursor:"not-allowed"},[`${Zt}-disabled + span`]:{color:j,cursor:"not-allowed"},[`&${Zt}-checked`]:{[ae]:{"&::after":{transform:`scale(${U/ye})`}}}},[`span${Zt} + *`]:{paddingInlineStart:P,paddingInlineEnd:P}})}},Ct=W=>{const{buttonColor:Zt,controlHeight:ze,componentCls:Me,lineWidth:ye,lineType:se,colorBorder:Ue,motionDurationSlow:Fi,motionDurationMid:wi,buttonPaddingInline:Ai,fontSize:ri,buttonBg:sn,fontSizeLG:Zi,controlHeightLG:j,controlHeightSM:P,paddingXS:E,borderRadius:B,borderRadiusSM:U,borderRadiusLG:D,buttonCheckedBg:St,buttonSolidCheckedColor:ae,colorTextDisabled:$e,colorBgContainerDisabled:Ae,buttonCheckedBgDisabled:Qe,buttonCheckedColorDisabled:He,colorPrimary:Si,colorPrimaryHover:Ei,colorPrimaryActive:Ci,buttonSolidCheckedBg:qt,buttonSolidCheckedHoverBg:ei,buttonSolidCheckedActiveBg:ln}=W;return{[`${Me}-button-wrapper`]:{position:"relative",display:"inline-block",height:ze,margin:0,paddingInline:Ai,paddingBlock:0,color:Zt,fontSize:ri,lineHeight:`${ze-ye*2}px`,background:sn,border:`${ye}px ${se} ${Ue}`,borderBlockStartWidth:ye+.02,borderInlineStartWidth:0,borderInlineEndWidth:ye,cursor:"pointer",transition:[`color ${wi}`,`background ${wi}`,`box-shadow ${wi}`].join(","),a:{color:Zt},[`> ${Me}-button`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:first-child)":{"&::before":{position:"absolute",insetBlockStart:-ye,insetInlineStart:-ye,display:"block",boxSizing:"content-box",width:1,height:"100%",paddingBlock:ye,paddingInline:0,backgroundColor:Ue,transition:`background-color ${Fi}`,content:'""'}},"&:first-child":{borderInlineStart:`${ye}px ${se} ${Ue}`,borderStartStartRadius:B,borderEndStartRadius:B},"&:last-child":{borderStartEndRadius:B,borderEndEndRadius:B},"&:first-child:last-child":{borderRadius:B},[`${Me}-group-large &`]:{height:j,fontSize:Zi,lineHeight:`${j-ye*2}px`,"&:first-child":{borderStartStartRadius:D,borderEndStartRadius:D},"&:last-child":{borderStartEndRadius:D,borderEndEndRadius:D}},[`${Me}-group-small &`]:{height:P,paddingInline:E-ye,paddingBlock:0,lineHeight:`${P-ye*2}px`,"&:first-child":{borderStartStartRadius:U,borderEndStartRadius:U},"&:last-child":{borderStartEndRadius:U,borderEndEndRadius:U}},"&:hover":{position:"relative",color:Si},"&:has(:focus-visible)":Object.assign({},(0,Ht.oN)(W)),[`${Me}-inner, input[type='checkbox'], input[type='radio']`]:{width:0,height:0,opacity:0,pointerEvents:"none"},[`&-checked:not(${Me}-button-wrapper-disabled)`]:{zIndex:1,color:Si,background:St,borderColor:Si,"&::before":{backgroundColor:Si},"&:first-child":{borderColor:Si},"&:hover":{color:Ei,borderColor:Ei,"&::before":{backgroundColor:Ei}},"&:active":{color:Ci,borderColor:Ci,"&::before":{backgroundColor:Ci}}},[`${Me}-group-solid &-checked:not(${Me}-button-wrapper-disabled)`]:{color:ae,background:qt,borderColor:qt,"&:hover":{color:ae,background:ei,borderColor:ei},"&:active":{color:ae,background:ln,borderColor:ln}},"&-disabled":{color:$e,backgroundColor:Ae,borderColor:Ue,cursor:"not-allowed","&:first-child, &:hover":{color:$e,backgroundColor:Ae,borderColor:Ue}},[`&-disabled${Me}-button-wrapper-checked`]:{color:He,backgroundColor:Qe,borderColor:Ue,boxShadow:"none"}}}},q=W=>W-4*2;var Et=(0,de.Z)("Radio",W=>{const{controlOutline:Zt,controlOutlineWidth:ze,radioSize:Me}=W,ye=`0 0 0 ${ze}px ${Zt}`,se=ye,Ue=q(Me),Fi=(0,De.TS)(W,{radioDotDisabledSize:Ue,radioFocusShadow:ye,radioButtonFocusShadow:se});return[$t(Fi),Xt(Fi),Ct(Fi)]},W=>{const{wireframe:Zt,padding:ze,marginXS:Me,lineWidth:ye,fontSizeLG:se,colorText:Ue,colorBgContainer:Fi,colorTextDisabled:wi,controlItemBgActiveDisabled:Ai,colorTextLightSolid:ri,colorPrimary:sn,colorPrimaryHover:Zi,colorPrimaryActive:j}=W,P=4,E=se,B=Zt?q(E):E-(P+ye)*2;return{radioSize:E,dotSize:B,dotColorDisabled:wi,buttonSolidCheckedColor:ri,buttonSolidCheckedBg:sn,buttonSolidCheckedHoverBg:Zi,buttonSolidCheckedActiveBg:j,buttonBg:Fi,buttonCheckedBg:Fi,buttonColor:Ue,buttonCheckedBgDisabled:Ai,buttonCheckedColorDisabled:wi,buttonPaddingInline:ze-ye,wrapperMarginInlineEnd:Me}}),Bt=G(14088),ve=G(4572),Vt=function(W,Zt){var ze={};for(var Me in W)Object.prototype.hasOwnProperty.call(W,Me)&&Zt.indexOf(Me)<0&&(ze[Me]=W[Me]);if(W!=null&&typeof Object.getOwnPropertySymbols=="function")for(var ye=0,Me=Object.getOwnPropertySymbols(W);ye<Me.length;ye++)Zt.indexOf(Me[ye])<0&&Object.prototype.propertyIsEnumerable.call(W,Me[ye])&&(ze[Me[ye]]=W[Me[ye]]);return ze};const We=(W,Zt)=>{var ze,Me;const ye=ut.useContext(yt),se=ut.useContext(be),{getPrefixCls:Ue,direction:Fi,radio:wi}=ut.useContext(ft.E_),Ai=ut.useRef(null),ri=(0,Ce.sQ)(Zt,Ai),{isFormItemInput:sn}=ut.useContext(Jt.aM),Zi=Ci=>{var qt,ei;(qt=W.onChange)===null||qt===void 0||qt.call(W,Ci),(ei=ye==null?void 0:ye.onChange)===null||ei===void 0||ei.call(ye,Ci)},{prefixCls:j,className:P,rootClassName:E,children:B,style:U}=W,D=Vt(W,["prefixCls","className","rootClassName","children","style"]),St=Ue("radio",j),ae=((ye==null?void 0:ye.optionType)||se)==="button",$e=ae?`${St}-button`:St,[Ae,Qe]=Et(St),He=Object.assign({},D),Si=ut.useContext(jt.Z);ye&&(He.name=ye.name,He.onChange=Zi,He.checked=W.value===ye.value,He.disabled=(ze=He.disabled)!==null&&ze!==void 0?ze:ye.disabled),He.disabled=(Me=He.disabled)!==null&&Me!==void 0?Me:Si;const Ei=kt()(`${$e}-wrapper`,{[`${$e}-wrapper-checked`]:He.checked,[`${$e}-wrapper-disabled`]:He.disabled,[`${$e}-wrapper-rtl`]:Fi==="rtl",[`${$e}-wrapper-in-form-item`]:sn},wi==null?void 0:wi.className,P,E,Qe);return Ae(ut.createElement(Bt.Z,{component:"Radio",disabled:He.disabled},ut.createElement("label",{className:Ei,style:Object.assign(Object.assign({},wi==null?void 0:wi.style),U),onMouseEnter:W.onMouseEnter,onMouseLeave:W.onMouseLeave},ut.createElement(Rt.Z,Object.assign({},He,{className:kt()(He.className,!ae&&ve.A),type:"radio",prefixCls:$e,ref:ri})),B!==void 0?ut.createElement("span",null,B):null)))};var xe=ut.forwardRef(We);const Nt=ut.forwardRef((W,Zt)=>{const{getPrefixCls:ze,direction:Me}=ut.useContext(ft.E_),[ye,se]=(0,vt.Z)(W.defaultValue,{value:W.value}),Ue=qt=>{const ei=ye,ln=qt.target.value;"value"in W||se(ln);const{onChange:Ft}=W;Ft&&ln!==ei&&Ft(qt)},{prefixCls:Fi,className:wi,rootClassName:Ai,options:ri,buttonStyle:sn="outline",disabled:Zi,children:j,size:P,style:E,id:B,onMouseEnter:U,onMouseLeave:D,onFocus:St,onBlur:ae}=W,$e=ze("radio",Fi),Ae=`${$e}-group`,[Qe,He]=Et($e);let Si=j;ri&&ri.length>0&&(Si=ri.map(qt=>typeof qt=="string"||typeof qt=="number"?ut.createElement(xe,{key:qt.toString(),prefixCls:$e,disabled:Zi,value:qt,checked:ye===qt},qt):ut.createElement(xe,{key:`radio-group-value-options-${qt.value}`,prefixCls:$e,disabled:qt.disabled||Zi,value:qt.value,checked:ye===qt.value,title:qt.title,style:qt.style},qt.label)));const Ei=(0,Pt.Z)(P),Ci=kt()(Ae,`${Ae}-${sn}`,{[`${Ae}-${Ei}`]:Ei,[`${Ae}-rtl`]:Me==="rtl"},wi,Ai,He);return Qe(ut.createElement("div",Object.assign({},(0,le.Z)(W,{aria:!0,data:!0}),{className:Ci,style:E,onMouseEnter:U,onMouseLeave:D,onFocus:St,onBlur:ae,id:B,ref:Zt}),ut.createElement(rt,{value:{onChange:Ue,value:ye,disabled:W.disabled,name:W.name,optionType:W.optionType}},Si)))});var _e=ut.memo(Nt),ti=function(W,Zt){var ze={};for(var Me in W)Object.prototype.hasOwnProperty.call(W,Me)&&Zt.indexOf(Me)<0&&(ze[Me]=W[Me]);if(W!=null&&typeof Object.getOwnPropertySymbols=="function")for(var ye=0,Me=Object.getOwnPropertySymbols(W);ye<Me.length;ye++)Zt.indexOf(Me[ye])<0&&Object.prototype.propertyIsEnumerable.call(W,Me[ye])&&(ze[Me[ye]]=W[Me[ye]]);return ze};const je=(W,Zt)=>{const{getPrefixCls:ze}=ut.useContext(ft.E_),{prefixCls:Me}=W,ye=ti(W,["prefixCls"]),se=ze("radio",Me);return ut.createElement(pt,{value:"button"},ut.createElement(xe,Object.assign({prefixCls:se},ye,{type:"radio",ref:Zt})))};var Be=ut.forwardRef(je);const Se=xe;Se.Button=Be,Se.Group=_e,Se.__ANT_RADIO=!0;var dt=Se},57809:function(qn,Li,G){"use strict";var Mt=G(92310),kt=G.n(Mt),vt=G(77861),le=G(2738),ut=G(59301),ft=G(53487),Pt=G(62892),Q=G(19080),rt=G(36355),yt=G(1684),be=G(93891),pt=G(19716),Rt=G(32441),Ce=G(33234),jt=G(14154),Jt=G(58582),Ht=G(84443),de=G(66339),De=function(Et,Bt){var ve={};for(var Vt in Et)Object.prototype.hasOwnProperty.call(Et,Vt)&&Bt.indexOf(Vt)<0&&(ve[Vt]=Et[Vt]);if(Et!=null&&typeof Object.getOwnPropertySymbols=="function")for(var We=0,Vt=Object.getOwnPropertySymbols(Et);We<Vt.length;We++)Bt.indexOf(Vt[We])<0&&Object.prototype.propertyIsEnumerable.call(Et,Vt[We])&&(ve[Vt[We]]=Et[Vt[We]]);return ve};const $t="SECRET_COMBOBOX_MODE_DO_NOT_USE",Xt=(Et,Bt)=>{var ve,{prefixCls:Vt,bordered:We=!0,className:ee,rootClassName:xe,getPopupContainer:Nt,popupClassName:_e,dropdownClassName:ti,listHeight:je=256,placement:Be,listItemHeight:Se=24,size:dt,disabled:W,notFoundContent:Zt,status:ze,builtinPlacements:Me,dropdownMatchSelectWidth:ye,popupMatchSelectWidth:se,direction:Ue,style:Fi,allowClear:wi}=Et,Ai=De(Et,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear"]);const{getPopupContainer:ri,getPrefixCls:sn,renderEmpty:Zi,direction:j,virtual:P,popupMatchSelectWidth:E,popupOverflow:B,select:U}=ut.useContext(rt.E_),D=sn("select",Vt),St=sn(),ae=Ue!=null?Ue:j,{compactSize:$e,compactItemClassnames:Ae}=(0,Ce.ri)(D,ae),[Qe,He]=(0,jt.Z)(D),Si=ut.useMemo(()=>{const{mode:Ir}=Ai;if(Ir!=="combobox")return Ir===$t?"combobox":Ir},[Ai.mode]),Ei=Si==="multiple"||Si==="tags",Ci=(0,Ht.Z)(Ai.suffixIcon,Ai.showArrow),qt=(ve=se!=null?se:ye)!==null&&ve!==void 0?ve:E,{status:ei,hasFeedback:ln,isFormItemInput:Ft,feedbackIcon:oe}=ut.useContext(Rt.aM),we=(0,Q.F)(ei,ze);let Ii;Zt!==void 0?Ii=Zt:Si==="combobox"?Ii=null:Ii=(Zi==null?void 0:Zi("Select"))||ut.createElement(be.Z,{componentName:"Select"});const{suffixIcon:Pi,itemIcon:_i,removeIcon:hn,clearIcon:mn}=(0,de.Z)(Object.assign(Object.assign({},Ai),{multiple:Ei,hasFeedback:ln,feedbackIcon:oe,showSuffixIcon:Ci,prefixCls:D,showArrow:Ai.showArrow,componentName:"Select"})),Ln=wi===!0?{clearIcon:mn}:wi,jn=(0,le.Z)(Ai,["suffixIcon","itemIcon"]),On=kt()(_e||ti,{[`${D}-dropdown-${ae}`]:ae==="rtl"},xe,He),rn=(0,pt.Z)(Ir=>{var T;return(T=dt!=null?dt:$e)!==null&&T!==void 0?T:Ir}),ir=ut.useContext(yt.Z),tr=W!=null?W:ir,hr=kt()({[`${D}-lg`]:rn==="large",[`${D}-sm`]:rn==="small",[`${D}-rtl`]:ae==="rtl",[`${D}-borderless`]:!We,[`${D}-in-form-item`]:Ft},(0,Q.Z)(D,we,ln),Ae,U==null?void 0:U.className,ee,xe,He),Er=ut.useMemo(()=>Be!==void 0?Be:ae==="rtl"?"bottomRight":"bottomLeft",[Be,ae]),Hn=(0,Jt.Z)(Me,B);return Qe(ut.createElement(vt.ZP,Object.assign({ref:Bt,virtual:P,showSearch:U==null?void 0:U.showSearch},jn,{style:Object.assign(Object.assign({},U==null?void 0:U.style),Fi),dropdownMatchSelectWidth:qt,builtinPlacements:Hn,transitionName:(0,Pt.m)(St,"slide-up",Ai.transitionName),listHeight:je,listItemHeight:Se,mode:Si,prefixCls:D,placement:Er,direction:ae,suffixIcon:Pi,menuItemSelectedIcon:_i,removeIcon:hn,allowClear:Ln,notFoundContent:Ii,className:hr,getPopupContainer:Nt||ri,dropdownClassName:On,disabled:tr})))},Ct=ut.forwardRef(Xt),q=(0,ft.Z)(Ct);Ct.SECRET_COMBOBOX_MODE_DO_NOT_USE=$t,Ct.Option=vt.Wx,Ct.OptGroup=vt.Xo,Ct._InternalPanelDoNotUseOrYouWillBeFired=q,Li.default=Ct},14154:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Ct}});var Mt=G(17313),kt=G(74207),vt=G(37613),le=G(83116),ut=G(13826),ft=G(92899);const Pt=q=>{const{optionHeight:Et,optionFontSize:Bt,optionLineHeight:ve,optionPadding:Vt}=q;return{position:"relative",display:"block",minHeight:Et,padding:Vt,color:q.colorText,fontWeight:"normal",fontSize:Bt,lineHeight:ve,boxSizing:"border-box"}};var rt=q=>{const{antCls:Et,componentCls:Bt}=q,ve=`${Bt}-item`,Vt=`&${Et}-slide-up-enter${Et}-slide-up-enter-active`,We=`&${Et}-slide-up-appear${Et}-slide-up-appear-active`,ee=`&${Et}-slide-up-leave${Et}-slide-up-leave-active`,xe=`${Bt}-dropdown-placement-`;return[{[`${Bt}-dropdown`]:Object.assign(Object.assign({},(0,Mt.Wf)(q)),{position:"absolute",top:-9999,zIndex:q.zIndexPopup,boxSizing:"border-box",padding:q.paddingXXS,overflow:"hidden",fontSize:q.fontSize,fontVariant:"initial",backgroundColor:q.colorBgElevated,borderRadius:q.borderRadiusLG,outline:"none",boxShadow:q.boxShadowSecondary,[`
${Vt}${xe}bottomLeft,
${We}${xe}bottomLeft
`]:{animationName:ut.fJ},[`
${Vt}${xe}topLeft,
${We}${xe}topLeft,
${Vt}${xe}topRight,
${We}${xe}topRight
`]:{animationName:ut.Qt},[`${ee}${xe}bottomLeft`]:{animationName:ut.Uw},[`
${ee}${xe}topLeft,
${ee}${xe}topRight
`]:{animationName:ut.ly},"&-hidden":{display:"none"},[`${ve}`]:Object.assign(Object.assign({},Pt(q)),{cursor:"pointer",transition:`background ${q.motionDurationSlow} ease`,borderRadius:q.borderRadiusSM,"&-group":{color:q.colorTextDescription,fontSize:q.fontSizeSM,cursor:"default"},"&-option":{display:"flex","&-content":Object.assign({flex:"auto"},Mt.vS),"&-state":{flex:"none",display:"flex",alignItems:"center"},[`&-active:not(${ve}-option-disabled)`]:{backgroundColor:q.optionActiveBg},[`&-selected:not(${ve}-option-disabled)`]:{color:q.optionSelectedColor,fontWeight:q.optionSelectedFontWeight,backgroundColor:q.optionSelectedBg,[`${ve}-option-state`]:{color:q.colorPrimary}},"&-disabled":{[`&${ve}-option-selected`]:{backgroundColor:q.colorBgContainerDisabled},color:q.colorTextDisabled,cursor:"not-allowed"},"&-grouped":{paddingInlineStart:q.controlPaddingHorizontal*2}}}),"&-rtl":{direction:"rtl"}})},(0,ut.oN)(q,"slide-up"),(0,ut.oN)(q,"slide-down"),(0,ft.Fm)(q,"move-up"),(0,ft.Fm)(q,"move-down")]};const yt=2,be=q=>{let{controlHeightSM:Et,controlHeight:Bt,lineWidth:ve}=q;const Vt=(Bt-Et)/2-ve,We=Math.ceil(Vt/2);return[Vt,We]};function pt(q,Et){const{componentCls:Bt,iconCls:ve}=q,Vt=`${Bt}-selection-overflow`,We=q.multipleSelectItemHeight,[ee]=be(q),xe=Et?`${Bt}-${Et}`:"";return{[`${Bt}-multiple${xe}`]:{fontSize:q.fontSize,[Vt]:{position:"relative",display:"flex",flex:"auto",flexWrap:"wrap",maxWidth:"100%","&-item":{flex:"none",alignSelf:"center",maxWidth:"100%",display:"inline-flex"}},[`${Bt}-selector`]:{display:"flex",flexWrap:"wrap",alignItems:"center",padding:`${ee-yt}px ${yt*2}px`,borderRadius:q.borderRadius,[`${Bt}-show-search&`]:{cursor:"text"},[`${Bt}-disabled&`]:{background:q.multipleSelectorBgDisabled,cursor:"not-allowed"},"&:after":{display:"inline-block",width:0,margin:`${yt}px 0`,lineHeight:`${We}px`,visibility:"hidden",content:'"\\a0"'}},[`
&${Bt}-show-arrow ${Bt}-selector,
&${Bt}-allow-clear ${Bt}-selector
`]:{paddingInlineEnd:q.fontSizeIcon+q.controlPaddingHorizontal},[`${Bt}-selection-item`]:{position:"relative",display:"flex",flex:"none",boxSizing:"border-box",maxWidth:"100%",height:We,marginTop:yt,marginBottom:yt,lineHeight:`${We-q.lineWidth*2}px`,background:q.multipleItemBg,border:`${q.lineWidth}px ${q.lineType} ${q.multipleItemBorderColor}`,borderRadius:q.borderRadiusSM,cursor:"default",transition:`font-size ${q.motionDurationSlow}, line-height ${q.motionDurationSlow}, height ${q.motionDurationSlow}`,userSelect:"none",marginInlineEnd:yt*2,paddingInlineStart:q.paddingXS,paddingInlineEnd:q.paddingXS/2,[`${Bt}-disabled&`]:{color:q.multipleItemColorDisabled,borderColor:q.multipleItemBorderColorDisabled,cursor:"not-allowed"},"&-content":{display:"inline-block",marginInlineEnd:q.paddingXS/2,overflow:"hidden",whiteSpace:"pre",textOverflow:"ellipsis"},"&-remove":Object.assign(Object.assign({},(0,Mt.Ro)()),{display:"inline-flex",alignItems:"center",color:q.colorIcon,fontWeight:"bold",fontSize:10,lineHeight:"inherit",cursor:"pointer",[`> ${ve}`]:{verticalAlign:"-0.2em"},"&:hover":{color:q.colorIconHover}})},[`${Vt}-item + ${Vt}-item`]:{[`${Bt}-selection-search`]:{marginInlineStart:0}},[`${Bt}-selection-search`]:{display:"inline-flex",position:"relative",maxWidth:"100%",marginInlineStart:q.inputPaddingHorizontalBase-ee,"\n &-input,\n &-mirror\n ":{height:We,fontFamily:q.fontFamily,lineHeight:`${We}px`,transition:`all ${q.motionDurationSlow}`},"&-input":{width:"100%",minWidth:4.1},"&-mirror":{position:"absolute",top:0,insetInlineStart:0,insetInlineEnd:"auto",zIndex:999,whiteSpace:"pre",visibility:"hidden"}},[`${Bt}-selection-placeholder `]:{position:"absolute",top:"50%",insetInlineStart:q.inputPaddingHorizontalBase,insetInlineEnd:q.inputPaddingHorizontalBase,transform:"translateY(-50%)",transition:`all ${q.motionDurationSlow}`}}}}var Ce=q=>{const{componentCls:Et}=q,Bt=(0,vt.TS)(q,{controlHeight:q.controlHeightSM,multipleSelectItemHeight:q.controlHeightXS,borderRadius:q.borderRadiusSM,borderRadiusSM:q.borderRadiusXS}),ve=(0,vt.TS)(q,{fontSize:q.fontSizeLG,controlHeight:q.controlHeightLG,multipleSelectItemHeight:q.multipleItemHeightLG,borderRadius:q.borderRadiusLG,borderRadiusSM:q.borderRadius}),[,Vt]=be(q);return[pt(q),pt(Bt,"sm"),{[`${Et}-multiple${Et}-sm`]:{[`${Et}-selection-placeholder`]:{insetInline:q.controlPaddingHorizontalSM-q.lineWidth},[`${Et}-selection-search`]:{marginInlineStart:Vt}}},pt(ve,"lg")]};function jt(q,Et){const{componentCls:Bt,inputPaddingHorizontalBase:ve,borderRadius:Vt}=q,We=q.controlHeight-q.lineWidth*2,ee=Math.ceil(q.fontSize*1.25),xe=Et?`${Bt}-${Et}`:"";return{[`${Bt}-single${xe}`]:{fontSize:q.fontSize,[`${Bt}-selector`]:Object.assign(Object.assign({},(0,Mt.Wf)(q)),{display:"flex",borderRadius:Vt,[`${Bt}-selection-search`]:{position:"absolute",top:0,insetInlineStart:ve,insetInlineEnd:ve,bottom:0,"&-input":{width:"100%"}},[`
${Bt}-selection-item,
${Bt}-selection-placeholder
`]:{padding:0,lineHeight:`${We}px`,transition:`all ${q.motionDurationSlow}, visibility 0s`,"@supports (-moz-appearance: meterbar)":{lineHeight:`${We}px`}},[`${Bt}-selection-item`]:{position:"relative",userSelect:"none"},[`${Bt}-selection-placeholder`]:{transition:"none",pointerEvents:"none"},[["&:after",`${Bt}-selection-item:after`,`${Bt}-selection-placeholder:after`].join(",")]:{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'}}),[`
&${Bt}-show-arrow ${Bt}-selection-item,
&${Bt}-show-arrow ${Bt}-selection-placeholder
`]:{paddingInlineEnd:ee},[`&${Bt}-open ${Bt}-selection-item`]:{color:q.colorTextPlaceholder},[`&:not(${Bt}-customize-input)`]:{[`${Bt}-selector`]:{width:"100%",height:q.controlHeight,padding:`0 ${ve}px`,[`${Bt}-selection-search-input`]:{height:We},"&:after":{lineHeight:`${We}px`}}},[`&${Bt}-customize-input`]:{[`${Bt}-selector`]:{"&:after":{display:"none"},[`${Bt}-selection-search`]:{position:"static",width:"100%"},[`${Bt}-selection-placeholder`]:{position:"absolute",insetInlineStart:0,insetInlineEnd:0,padding:`0 ${ve}px`,"&:after":{display:"none"}}}}}}}function Jt(q){const{componentCls:Et}=q,Bt=q.controlPaddingHorizontalSM-q.lineWidth;return[jt(q),jt((0,vt.TS)(q,{controlHeight:q.controlHeightSM,borderRadius:q.borderRadiusSM}),"sm"),{[`${Et}-single${Et}-sm`]:{[`&:not(${Et}-customize-input)`]:{[`${Et}-selection-search`]:{insetInlineStart:Bt,insetInlineEnd:Bt},[`${Et}-selector`]:{padding:`0 ${Bt}px`},[`&${Et}-show-arrow ${Et}-selection-search`]:{insetInlineEnd:Bt+q.fontSize*1.5},[`
&${Et}-show-arrow ${Et}-selection-item,
&${Et}-show-arrow ${Et}-selection-placeholder
`]:{paddingInlineEnd:q.fontSize*1.5}}}},jt((0,vt.TS)(q,{controlHeight:q.singleItemHeightLG,fontSize:q.fontSizeLG,borderRadius:q.borderRadiusLG}),"lg")]}const Ht=q=>{const{componentCls:Et,selectorBg:Bt}=q;return{position:"relative",backgroundColor:Bt,border:`${q.lineWidth}px ${q.lineType} ${q.colorBorder}`,transition:`all ${q.motionDurationMid} ${q.motionEaseInOut}`,input:{cursor:"pointer"},[`${Et}-show-search&`]:{cursor:"text",input:{cursor:"auto",color:"inherit"}},[`${Et}-disabled&`]:{color:q.colorTextDisabled,background:q.colorBgContainerDisabled,cursor:"not-allowed",[`${Et}-multiple&`]:{background:q.multipleSelectorBgDisabled},input:{cursor:"not-allowed"}}}},de=function(q,Et){let Bt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{componentCls:ve,borderHoverColor:Vt,outlineColor:We,antCls:ee}=Et,xe=Bt?{[`${ve}-selector`]:{borderColor:Vt}}:{};return{[q]:{[`&:not(${ve}-disabled):not(${ve}-customize-input):not(${ee}-pagination-size-changer)`]:Object.assign(Object.assign({},xe),{[`${ve}-focused& ${ve}-selector`]:{borderColor:Vt,boxShadow:`0 0 0 ${Et.controlOutlineWidth}px ${We}`,outline:0},[`&:hover ${ve}-selector`]:{borderColor:Vt}})}}},De=q=>{const{componentCls:Et}=q;return{[`${Et}-selection-search-input`]:{margin:0,padding:0,background:"transparent",border:"none",outline:"none",appearance:"none","&::-webkit-search-cancel-button":{display:"none","-webkit-appearance":"none"}}}},$t=q=>{const{componentCls:Et,inputPaddingHorizontalBase:Bt,iconCls:ve}=q;return{[Et]:Object.assign(Object.assign({},(0,Mt.Wf)(q)),{position:"relative",display:"inline-block",cursor:"pointer",[`&:not(${Et}-customize-input) ${Et}-selector`]:Object.assign(Object.assign({},Ht(q)),De(q)),[`${Et}-selection-item`]:Object.assign({flex:1,fontWeight:"normal"},Mt.vS),[`${Et}-selection-placeholder`]:Object.assign(Object.assign({},Mt.vS),{flex:1,color:q.colorTextPlaceholder,pointerEvents:"none"}),[`${Et}-arrow`]:Object.assign(Object.assign({},(0,Mt.Ro)()),{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:Bt,height:q.fontSizeIcon,marginTop:-q.fontSizeIcon/2,color:q.colorTextQuaternary,fontSize:q.fontSizeIcon,lineHeight:1,textAlign:"center",pointerEvents:"none",display:"flex",alignItems:"center",[ve]:{verticalAlign:"top",transition:`transform ${q.motionDurationSlow}`,"> svg":{verticalAlign:"top"},[`&:not(${Et}-suffix)`]:{pointerEvents:"auto"}},[`${Et}-disabled &`]:{cursor:"not-allowed"},"> *:not(:last-child)":{marginInlineEnd:8}}),[`${Et}-clear`]:{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:Bt,zIndex:1,display:"inline-block",width:q.fontSizeIcon,height:q.fontSizeIcon,marginTop:-q.fontSizeIcon/2,color:q.colorTextQuaternary,fontSize:q.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",background:q.clearBg,cursor:"pointer",opacity:0,transition:`color ${q.motionDurationMid} ease, opacity ${q.motionDurationSlow} ease`,textRendering:"auto","&:before":{display:"block"},"&:hover":{color:q.colorTextTertiary}},"&:hover":{[`${Et}-clear`]:{opacity:1}}}),[`${Et}-has-feedback`]:{[`${Et}-clear`]:{insetInlineEnd:Bt+q.fontSize+q.paddingXS}}}},Xt=q=>{const{componentCls:Et}=q;return[{[Et]:{[`&-borderless ${Et}-selector`]:{backgroundColor:"transparent !important",borderColor:"transparent !important",boxShadow:"none !important"},[`&${Et}-in-form-item`]:{width:"100%"}}},$t(q),Jt(q),Ce(q),rt(q),{[`${Et}-rtl`]:{direction:"rtl"}},de(Et,(0,vt.TS)(q,{borderHoverColor:q.colorPrimaryHover,outlineColor:q.controlOutline})),de(`${Et}-status-error`,(0,vt.TS)(q,{borderHoverColor:q.colorErrorHover,outlineColor:q.colorErrorOutline}),!0),de(`${Et}-status-warning`,(0,vt.TS)(q,{borderHoverColor:q.colorWarningHover,outlineColor:q.colorWarningOutline}),!0),(0,kt.c)(q,{borderElCls:`${Et}-selector`,focusElCls:`${Et}-focused`})]};var Ct=(0,le.Z)("Select",(q,Et)=>{let{rootPrefixCls:Bt}=Et;const ve=(0,vt.TS)(q,{rootPrefixCls:Bt,inputPaddingHorizontalBase:q.paddingSM-1,multipleSelectItemHeight:q.multipleItemHeight});return[Xt(ve)]},q=>{const{fontSize:Et,lineHeight:Bt,controlHeight:ve,controlPaddingHorizontal:Vt,zIndexPopupBase:We,colorText:ee,fontWeightStrong:xe,controlItemBgActive:Nt,controlItemBgHover:_e,colorBgContainer:ti,colorFillSecondary:je,controlHeightLG:Be,controlHeightSM:Se,colorBgContainerDisabled:dt,colorTextDisabled:W}=q;return{zIndexPopup:We+50,optionSelectedColor:ee,optionSelectedFontWeight:xe,optionSelectedBg:Nt,optionActiveBg:_e,optionPadding:`${(ve-Et*Bt)/2}px ${Vt}px`,optionFontSize:Et,optionLineHeight:Bt,optionHeight:ve,selectorBg:ti,clearBg:ti,singleItemHeightLG:Be,multipleItemBg:je,multipleItemBorderColor:"transparent",multipleItemHeight:Se,multipleItemHeightLG:ve,multipleSelectorBgDisabled:dt,multipleItemColorDisabled:W,multipleItemBorderColorDisabled:"transparent"}})},58582:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return kt}});const Mt=vt=>{const ut={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:vt==="scroll"?"scroll":"visible",_experimental:{dynamicInset:!0}};return{bottomLeft:Object.assign(Object.assign({},ut),{points:["tl","bl"],offset:[0,4]}),bottomRight:Object.assign(Object.assign({},ut),{points:["tr","br"],offset:[0,4]}),topLeft:Object.assign(Object.assign({},ut),{points:["bl","tl"],offset:[0,-4]}),topRight:Object.assign(Object.assign({},ut),{points:["br","tr"],offset:[0,-4]})}};function kt(vt,le){return vt||Mt(le)}},84443:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Mt}});function Mt(kt,vt){return vt!==void 0?vt:kt!==null}},66339:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Q}});var Mt=G(40001),kt=G(19248),vt=G(99267),le=G(84105),ut=G(58617),ft=G(47472),Pt=G(59301);function Q(rt){let{suffixIcon:yt,clearIcon:be,menuItemSelectedIcon:pt,removeIcon:Rt,loading:Ce,multiple:jt,hasFeedback:Jt,prefixCls:Ht,showSuffixIcon:de,feedbackIcon:De,showArrow:$t,componentName:Xt}=rt;const Ct=be!=null?be:Pt.createElement(kt.Z,null),q=Vt=>yt===null&&!Jt&&!$t?null:Pt.createElement(Pt.Fragment,null,de!==!1&&Vt,Jt&&De);let Et=null;if(yt!==void 0)Et=q(yt);else if(Ce)Et=q(Pt.createElement(ut.Z,{spin:!0}));else{const Vt=`${Ht}-suffix`;Et=We=>{let{open:ee,showSearch:xe}=We;return q(ee&&xe?Pt.createElement(ft.Z,{className:Vt}):Pt.createElement(le.Z,{className:Vt}))}}let Bt=null;pt!==void 0?Bt=pt:jt?Bt=Pt.createElement(Mt.Z,null):Bt=null;let ve=null;return Rt!==void 0?ve=Rt:ve=Pt.createElement(vt.Z,null),{clearIcon:Ct,suffixIcon:Et,itemIcon:Bt,removeIcon:ve}}},81327:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Ht}});var Mt=G(59301),kt=G(92310),vt=G.n(kt),le=G(11592),ut=G(36355),ft=G(33234);const Pt=Mt.createContext({latestIndex:0}),Q=Pt.Provider;var yt=de=>{let{className:De,index:$t,children:Xt,split:Ct,style:q}=de;const{latestIndex:Et}=Mt.useContext(Pt);return Xt==null?null:Mt.createElement(Mt.Fragment,null,Mt.createElement("div",{className:De,style:q},Xt),$t<Et&&Ct&&Mt.createElement("span",{className:`${De}-split`},Ct))},be=G(2856);function pt(de){return["small","middle","large"].includes(de)}function Rt(de){return de?typeof de=="number"&&!Number.isNaN(de):!1}var Ce=function(de,De){var $t={};for(var Xt in de)Object.prototype.hasOwnProperty.call(de,Xt)&&De.indexOf(Xt)<0&&($t[Xt]=de[Xt]);if(de!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Ct=0,Xt=Object.getOwnPropertySymbols(de);Ct<Xt.length;Ct++)De.indexOf(Xt[Ct])<0&&Object.prototype.propertyIsEnumerable.call(de,Xt[Ct])&&($t[Xt[Ct]]=de[Xt[Ct]]);return $t};const Jt=Mt.forwardRef((de,De)=>{var $t,Xt;const{getPrefixCls:Ct,space:q,direction:Et}=Mt.useContext(ut.E_),{size:Bt=(q==null?void 0:q.size)||"small",align:ve,className:Vt,rootClassName:We,children:ee,direction:xe="horizontal",prefixCls:Nt,split:_e,style:ti,wrap:je=!1,classNames:Be,styles:Se}=de,dt=Ce(de,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[W,Zt]=Array.isArray(Bt)?Bt:[Bt,Bt],ze=pt(Zt),Me=pt(W),ye=Rt(Zt),se=Rt(W),Ue=(0,le.Z)(ee,{keepEmpty:!0}),Fi=ve===void 0&&xe==="horizontal"?"center":ve,wi=Ct("space",Nt),[Ai,ri]=(0,be.Z)(wi),sn=vt()(wi,q==null?void 0:q.className,ri,`${wi}-${xe}`,{[`${wi}-rtl`]:Et==="rtl",[`${wi}-align-${Fi}`]:Fi,[`${wi}-gap-row-${Zt}`]:ze,[`${wi}-gap-col-${W}`]:Me},Vt,We),Zi=vt()(`${wi}-item`,($t=Be==null?void 0:Be.item)!==null&&$t!==void 0?$t:(Xt=q==null?void 0:q.classNames)===null||Xt===void 0?void 0:Xt.item);let j=0;const P=Ue.map((U,D)=>{var St,ae;U!=null&&(j=D);const $e=U&&U.key||`${Zi}-${D}`;return Mt.createElement(yt,{className:Zi,key:$e,index:D,split:_e,style:(St=Se==null?void 0:Se.item)!==null&&St!==void 0?St:(ae=q==null?void 0:q.styles)===null||ae===void 0?void 0:ae.item},U)}),E=Mt.useMemo(()=>({latestIndex:j}),[j]);if(Ue.length===0)return null;const B={};return je&&(B.flexWrap="wrap"),!Me&&se&&(B.columnGap=W),!ze&&ye&&(B.rowGap=Zt),Ai(Mt.createElement("div",Object.assign({ref:De,className:sn,style:Object.assign(Object.assign(Object.assign({},B),q==null?void 0:q.style),ti)},dt),Mt.createElement(Q,{value:E},P)))});Jt.Compact=ft.ZP;var Ht=Jt},8378:function(qn,Li){"use strict";const G=Mt=>({[Mt.componentCls]:{[`${Mt.antCls}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`height ${Mt.motionDurationMid} ${Mt.motionEaseInOut},
opacity ${Mt.motionDurationMid} ${Mt.motionEaseInOut} !important`}},[`${Mt.antCls}-motion-collapse`]:{overflow:"hidden",transition:`height ${Mt.motionDurationMid} ${Mt.motionEaseInOut},
opacity ${Mt.motionDurationMid} ${Mt.motionEaseInOut} !important`}}});Li.Z=G},92899:function(qn,Li,G){"use strict";G.d(Li,{Fm:function(){return pt}});var Mt=G(36237),kt=G(95406);const vt=new Mt.Keyframes("antMoveDownIn",{"0%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),le=new Mt.Keyframes("antMoveDownOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0}}),ut=new Mt.Keyframes("antMoveLeftIn",{"0%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),ft=new Mt.Keyframes("antMoveLeftOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),Pt=new Mt.Keyframes("antMoveRightIn",{"0%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),Q=new Mt.Keyframes("antMoveRightOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),rt=new Mt.Keyframes("antMoveUpIn",{"0%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),yt=new Mt.Keyframes("antMoveUpOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0}}),be={"move-up":{inKeyframes:rt,outKeyframes:yt},"move-down":{inKeyframes:vt,outKeyframes:le},"move-left":{inKeyframes:ut,outKeyframes:ft},"move-right":{inKeyframes:Pt,outKeyframes:Q}},pt=(Rt,Ce)=>{const{antCls:jt}=Rt,Jt=`${jt}-${Ce}`,{inKeyframes:Ht,outKeyframes:de}=be[Ce];return[(0,kt.R)(Jt,Ht,de,Rt.motionDurationMid),{[`
${Jt}-enter,
${Jt}-appear
`]:{opacity:0,animationTimingFunction:Rt.motionEaseOutCirc},[`${Jt}-leave`]:{animationTimingFunction:Rt.motionEaseInOutCirc}}]}},13826:function(qn,Li,G){"use strict";G.d(Li,{Qt:function(){return ut},Uw:function(){return le},fJ:function(){return vt},ly:function(){return ft},oN:function(){return pt}});var Mt=G(36237),kt=G(95406);const vt=new Mt.Keyframes("antSlideUpIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1}}),le=new Mt.Keyframes("antSlideUpOut",{"0%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0}}),ut=new Mt.Keyframes("antSlideDownIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1}}),ft=new Mt.Keyframes("antSlideDownOut",{"0%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0}}),Pt=new Mt.Keyframes("antSlideLeftIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1}}),Q=new Mt.Keyframes("antSlideLeftOut",{"0%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0}}),rt=new Mt.Keyframes("antSlideRightIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1}}),yt=new Mt.Keyframes("antSlideRightOut",{"0%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0}}),be={"slide-up":{inKeyframes:vt,outKeyframes:le},"slide-down":{inKeyframes:ut,outKeyframes:ft},"slide-left":{inKeyframes:Pt,outKeyframes:Q},"slide-right":{inKeyframes:rt,outKeyframes:yt}},pt=(Rt,Ce)=>{const{antCls:jt}=Rt,Jt=`${jt}-${Ce}`,{inKeyframes:Ht,outKeyframes:de}=be[Ce];return[(0,kt.R)(Jt,Ht,de,Rt.motionDurationMid),{[`
${Jt}-enter,
${Jt}-appear
`]:{transform:"scale(0)",transformOrigin:"0% 0%",opacity:0,animationTimingFunction:Rt.motionEaseOutQuint,"&-prepare":{transform:"scale(1)"}},[`${Jt}-leave`]:{animationTimingFunction:Rt.motionEaseInQuint}}]}},49770:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return xe}});var Mt=G(58617),kt=G(92310),vt=G.n(kt),le=G(32855),ut=G(74430),ft=G(11913),Pt=G(43079),Q=G(59301),rt=G(18929),yt=G(10228),be=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],pt=Q.forwardRef(function(Nt,_e){var ti,je=Nt.prefixCls,Be=je===void 0?"rc-switch":je,Se=Nt.className,dt=Nt.checked,W=Nt.defaultChecked,Zt=Nt.disabled,ze=Nt.loadingIcon,Me=Nt.checkedChildren,ye=Nt.unCheckedChildren,se=Nt.onClick,Ue=Nt.onChange,Fi=Nt.onKeyDown,wi=(0,Pt.Z)(Nt,be),Ai=(0,rt.Z)(!1,{value:dt,defaultValue:W}),ri=(0,ft.Z)(Ai,2),sn=ri[0],Zi=ri[1];function j(U,D){var St=sn;return Zt||(St=U,Zi(St),Ue==null||Ue(St,D)),St}function P(U){U.which===yt.Z.LEFT?j(!1,U):U.which===yt.Z.RIGHT&&j(!0,U),Fi==null||Fi(U)}function E(U){var D=j(!sn,U);se==null||se(D,U)}var B=vt()(Be,Se,(ti={},(0,ut.Z)(ti,"".concat(Be,"-checked"),sn),(0,ut.Z)(ti,"".concat(Be,"-disabled"),Zt),ti));return Q.createElement("button",(0,le.Z)({},wi,{type:"button",role:"switch","aria-checked":sn,disabled:Zt,className:B,ref:_e,onKeyDown:P,onClick:E}),ze,Q.createElement("span",{className:"".concat(Be,"-inner")},Q.createElement("span",{className:"".concat(Be,"-inner-checked")},Me),Q.createElement("span",{className:"".concat(Be,"-inner-unchecked")},ye)))});pt.displayName="Switch";var Rt=pt,Ce=G(14088),jt=G(36355),Jt=G(1684),Ht=G(19716),de=G(64993),De=G(17313),$t=G(83116),Xt=G(37613);const Ct=Nt=>{const{componentCls:_e,trackHeightSM:ti,trackPadding:je,trackMinWidthSM:Be,innerMinMarginSM:Se,innerMaxMarginSM:dt,handleSizeSM:W}=Nt,Zt=`${_e}-inner`;return{[_e]:{[`&${_e}-small`]:{minWidth:Be,height:ti,lineHeight:`${ti}px`,[`${_e}-inner`]:{paddingInlineStart:dt,paddingInlineEnd:Se,[`${Zt}-checked`]:{marginInlineStart:`calc(-100% + ${W+je*2}px - ${dt*2}px)`,marginInlineEnd:`calc(100% - ${W+je*2}px + ${dt*2}px)`},[`${Zt}-unchecked`]:{marginTop:-ti,marginInlineStart:0,marginInlineEnd:0}},[`${_e}-handle`]:{width:W,height:W},[`${_e}-loading-icon`]:{top:(W-Nt.switchLoadingIconSize)/2,fontSize:Nt.switchLoadingIconSize},[`&${_e}-checked`]:{[`${_e}-inner`]:{paddingInlineStart:Se,paddingInlineEnd:dt,[`${Zt}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${Zt}-unchecked`]:{marginInlineStart:`calc(100% - ${W+je*2}px + ${dt*2}px)`,marginInlineEnd:`calc(-100% + ${W+je*2}px - ${dt*2}px)`}},[`${_e}-handle`]:{insetInlineStart:`calc(100% - ${W+je}px)`}},[`&:not(${_e}-disabled):active`]:{[`&:not(${_e}-checked) ${Zt}`]:{[`${Zt}-unchecked`]:{marginInlineStart:Nt.marginXXS/2,marginInlineEnd:-Nt.marginXXS/2}},[`&${_e}-checked ${Zt}`]:{[`${Zt}-checked`]:{marginInlineStart:-Nt.marginXXS/2,marginInlineEnd:Nt.marginXXS/2}}}}}}},q=Nt=>{const{componentCls:_e,handleSize:ti}=Nt;return{[_e]:{[`${_e}-loading-icon${Nt.iconCls}`]:{position:"relative",top:(ti-Nt.fontSize)/2,color:Nt.switchLoadingIconColor,verticalAlign:"top"},[`&${_e}-checked ${_e}-loading-icon`]:{color:Nt.switchColor}}}},Et=Nt=>{const{componentCls:_e,motion:ti,trackPadding:je,handleBg:Be,handleShadow:Se,handleSize:dt}=Nt,W=`${_e}-handle`;return{[_e]:{[W]:{position:"absolute",top:je,insetInlineStart:je,width:dt,height:dt,transition:`all ${Nt.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:Be,borderRadius:dt/2,boxShadow:Se,transition:`all ${Nt.switchDuration} ease-in-out`,content:'""'}},[`&${_e}-checked ${W}`]:{insetInlineStart:`calc(100% - ${dt+je}px)`},[`&:not(${_e}-disabled):active`]:ti?{[`${W}::before`]:{insetInlineEnd:Nt.switchHandleActiveInset,insetInlineStart:0},[`&${_e}-checked ${W}::before`]:{insetInlineEnd:0,insetInlineStart:Nt.switchHandleActiveInset}}:{}}}},Bt=Nt=>{const{componentCls:_e,trackHeight:ti,trackPadding:je,innerMinMargin:Be,innerMaxMargin:Se,handleSize:dt}=Nt,W=`${_e}-inner`;return{[_e]:{[W]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:Se,paddingInlineEnd:Be,transition:`padding-inline-start ${Nt.switchDuration} ease-in-out, padding-inline-end ${Nt.switchDuration} ease-in-out`,[`${W}-checked, ${W}-unchecked`]:{display:"block",color:Nt.colorTextLightSolid,fontSize:Nt.fontSizeSM,transition:`margin-inline-start ${Nt.switchDuration} ease-in-out, margin-inline-end ${Nt.switchDuration} ease-in-out`,pointerEvents:"none"},[`${W}-checked`]:{marginInlineStart:`calc(-100% + ${dt+je*2}px - ${Se*2}px)`,marginInlineEnd:`calc(100% - ${dt+je*2}px + ${Se*2}px)`},[`${W}-unchecked`]:{marginTop:-ti,marginInlineStart:0,marginInlineEnd:0}},[`&${_e}-checked ${W}`]:{paddingInlineStart:Be,paddingInlineEnd:Se,[`${W}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${W}-unchecked`]:{marginInlineStart:`calc(100% - ${dt+je*2}px + ${Se*2}px)`,marginInlineEnd:`calc(-100% + ${dt+je*2}px - ${Se*2}px)`}},[`&:not(${_e}-disabled):active`]:{[`&:not(${_e}-checked) ${W}`]:{[`${W}-unchecked`]:{marginInlineStart:je*2,marginInlineEnd:-je*2}},[`&${_e}-checked ${W}`]:{[`${W}-checked`]:{marginInlineStart:-je*2,marginInlineEnd:je*2}}}}}},ve=Nt=>{const{componentCls:_e,trackHeight:ti,trackMinWidth:je}=Nt;return{[_e]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,De.Wf)(Nt)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:je,height:ti,lineHeight:`${ti}px`,verticalAlign:"middle",background:Nt.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${Nt.motionDurationMid}`,userSelect:"none",[`&:hover:not(${_e}-disabled)`]:{background:Nt.colorTextTertiary}}),(0,De.Qy)(Nt)),{[`&${_e}-checked`]:{background:Nt.switchColor,[`&:hover:not(${_e}-disabled)`]:{background:Nt.colorPrimaryHover}},[`&${_e}-loading, &${_e}-disabled`]:{cursor:"not-allowed",opacity:Nt.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${_e}-rtl`]:{direction:"rtl"}})}};var Vt=(0,$t.Z)("Switch",Nt=>{const _e=(0,Xt.TS)(Nt,{switchDuration:Nt.motionDurationMid,switchColor:Nt.colorPrimary,switchDisabledOpacity:Nt.opacityLoading,switchLoadingIconSize:Nt.fontSizeIcon*.75,switchLoadingIconColor:`rgba(0, 0, 0, ${Nt.opacityLoading})`,switchHandleActiveInset:"-30%"});return[ve(_e),Bt(_e),Et(_e),q(_e),Ct(_e)]},Nt=>{const{fontSize:_e,lineHeight:ti,controlHeight:je,colorWhite:Be}=Nt,Se=_e*ti,dt=je/2,W=2,Zt=Se-W*2,ze=dt-W*2;return{trackHeight:Se,trackHeightSM:dt,trackMinWidth:Zt*2+W*4,trackMinWidthSM:ze*2+W*2,trackPadding:W,handleBg:Be,handleSize:Zt,handleSizeSM:ze,handleShadow:`0 2px 4px 0 ${new de.C("#00230b").setAlpha(.2).toRgbString()}`,innerMinMargin:Zt/2,innerMaxMargin:Zt+W+W*2,innerMinMarginSM:ze/2,innerMaxMarginSM:ze+W+W*2}}),We=function(Nt,_e){var ti={};for(var je in Nt)Object.prototype.hasOwnProperty.call(Nt,je)&&_e.indexOf(je)<0&&(ti[je]=Nt[je]);if(Nt!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Be=0,je=Object.getOwnPropertySymbols(Nt);Be<je.length;Be++)_e.indexOf(je[Be])<0&&Object.prototype.propertyIsEnumerable.call(Nt,je[Be])&&(ti[je[Be]]=Nt[je[Be]]);return ti};const ee=Q.forwardRef((Nt,_e)=>{const{prefixCls:ti,size:je,disabled:Be,loading:Se,className:dt,rootClassName:W,style:Zt}=Nt,ze=We(Nt,["prefixCls","size","disabled","loading","className","rootClassName","style"]),{getPrefixCls:Me,direction:ye,switch:se}=Q.useContext(jt.E_),Ue=Q.useContext(Jt.Z),Fi=(Be!=null?Be:Ue)||Se,wi=Me("switch",ti),Ai=Q.createElement("div",{className:`${wi}-handle`},Se&&Q.createElement(Mt.Z,{className:`${wi}-loading-icon`})),[ri,sn]=Vt(wi),Zi=(0,Ht.Z)(je),j=vt()(se==null?void 0:se.className,{[`${wi}-small`]:Zi==="small",[`${wi}-loading`]:Se,[`${wi}-rtl`]:ye==="rtl"},dt,W,sn),P=Object.assign(Object.assign({},se==null?void 0:se.style),Zt);return ri(Q.createElement(Ce.Z,{component:"Switch"},Q.createElement(Rt,Object.assign({},ze,{prefixCls:wi,className:j,style:P,disabled:Fi,ref:_e,loadingIcon:Ai}))))});ee.__ANT_SWITCH=!0;var xe=ee},99313:function(qn,Li,G){"use strict";G.d(Li,{default:function(){return ct}});var Mt=G(99267),kt=G(18785),vt=G(62772),le=G(92310),ut=G.n(le),ft=G(32855),Pt=G(74430),Q=G(27247),rt=G(11913),yt=G(34666),be=G(43079),pt=G(59301),Rt=G(49658),Ce=G(18929),jt=G(77900),Jt=(0,pt.createContext)(null),Ht=pt.forwardRef(function(J,ot){var nt=J.prefixCls,Z=J.className,xt=J.style,Ot=J.id,ge=J.active,te=J.tabKey,lt=J.children;return pt.createElement("div",{id:Ot&&"".concat(Ot,"-panel-").concat(te),role:"tabpanel",tabIndex:ge?0:-1,"aria-labelledby":Ot&&"".concat(Ot,"-tab-").concat(te),"aria-hidden":!ge,style:xt,className:ut()(nt,ge&&"".concat(nt,"-active"),Z),ref:ot},lt)}),de=Ht,De=["key","forceRender","style","className"];function $t(J){var ot=J.id,nt=J.activeKey,Z=J.animated,xt=J.tabPosition,Ot=J.destroyInactiveTabPane,ge=pt.useContext(Jt),te=ge.prefixCls,lt=ge.tabs,Qt=Z.tabPane,me="".concat(te,"-tabpane");return pt.createElement("div",{className:ut()("".concat(te,"-content-holder"))},pt.createElement("div",{className:ut()("".concat(te,"-content"),"".concat(te,"-content-").concat(xt),(0,Pt.Z)({},"".concat(te,"-content-animated"),Qt))},lt.map(function(Fe){var Tt=Fe.key,ce=Fe.forceRender,bi=Fe.style,li=Fe.className,Mi=(0,be.Z)(Fe,De),Pe=Tt===nt;return pt.createElement(jt.default,(0,ft.Z)({key:Tt,visible:Pe,forceRender:ce,removeOnLeave:!!Ot,leavedClassName:"".concat(me,"-hidden")},Z.tabPaneMotion),function(qe,Re){var ni=qe.style,Ut=qe.className;return pt.createElement(de,(0,ft.Z)({},Mi,{prefixCls:me,id:ot,tabKey:Tt,animated:Qt,active:Pe,style:(0,Q.Z)((0,Q.Z)({},bi),ni),className:ut()(li,Ut),ref:Re}))})})))}var Xt=G(3300),Ct=G(29301),q=G(6089),Et=G(8654),Bt={width:0,height:0,left:0,top:0};function ve(J,ot,nt){return(0,pt.useMemo)(function(){for(var Z,xt=new Map,Ot=ot.get((Z=J[0])===null||Z===void 0?void 0:Z.key)||Bt,ge=Ot.left+Ot.width,te=0;te<J.length;te+=1){var lt=J[te].key,Qt=ot.get(lt);if(!Qt){var me;Qt=ot.get((me=J[te-1])===null||me===void 0?void 0:me.key)||Bt}var Fe=xt.get(lt)||(0,Q.Z)({},Qt);Fe.right=ge-Fe.left-Fe.width,xt.set(lt,Fe)}return xt},[J.map(function(Z){return Z.key}).join("_"),ot,nt])}function Vt(J,ot){var nt=pt.useRef(J),Z=pt.useState({}),xt=(0,rt.Z)(Z,2),Ot=xt[1];function ge(te){var lt=typeof te=="function"?te(nt.current):te;lt!==nt.current&&ot(lt,nt.current),nt.current=lt,Ot({})}return[nt.current,ge]}var We=.1,ee=.01,xe=20,Nt=Math.pow(.995,xe);function _e(J,ot){var nt=(0,pt.useState)(),Z=(0,rt.Z)(nt,2),xt=Z[0],Ot=Z[1],ge=(0,pt.useState)(0),te=(0,rt.Z)(ge,2),lt=te[0],Qt=te[1],me=(0,pt.useState)(0),Fe=(0,rt.Z)(me,2),Tt=Fe[0],ce=Fe[1],bi=(0,pt.useState)(),li=(0,rt.Z)(bi,2),Mi=li[0],Pe=li[1],qe=(0,pt.useRef)();function Re(re){var Ie=re.touches[0],mt=Ie.screenX,Xe=Ie.screenY;Ot({x:mt,y:Xe}),window.clearInterval(qe.current)}function ni(re){if(xt){re.preventDefault();var Ie=re.touches[0],mt=Ie.screenX,Xe=Ie.screenY;Ot({x:mt,y:Xe});var pi=mt-xt.x,ci=Xe-xt.y;ot(pi,ci);var Ui=Date.now();Qt(Ui),ce(Ui-lt),Pe({x:pi,y:ci})}}function Ut(){if(xt&&(Ot(null),Pe(null),Mi)){var re=Mi.x/Tt,Ie=Mi.y/Tt,mt=Math.abs(re),Xe=Math.abs(Ie);if(Math.max(mt,Xe)<We)return;var pi=re,ci=Ie;qe.current=window.setInterval(function(){if(Math.abs(pi)<ee&&Math.abs(ci)<ee){window.clearInterval(qe.current);return}pi*=Nt,ci*=Nt,ot(pi*xe,ci*xe)},xe)}}var Wt=(0,pt.useRef)();function Dt(re){var Ie=re.deltaX,mt=re.deltaY,Xe=0,pi=Math.abs(Ie),ci=Math.abs(mt);pi===ci?Xe=Wt.current==="x"?Ie:mt:pi>ci?(Xe=Ie,Wt.current="x"):(Xe=mt,Wt.current="y"),ot(-Xe,-Xe)&&re.preventDefault()}var ke=(0,pt.useRef)(null);ke.current={onTouchStart:Re,onTouchMove:ni,onTouchEnd:Ut,onWheel:Dt},pt.useEffect(function(){function re(pi){ke.current.onTouchStart(pi)}function Ie(pi){ke.current.onTouchMove(pi)}function mt(pi){ke.current.onTouchEnd(pi)}function Xe(pi){ke.current.onWheel(pi)}return document.addEventListener("touchmove",Ie,{passive:!1}),document.addEventListener("touchend",mt,{passive:!1}),J.current.addEventListener("touchstart",re,{passive:!1}),J.current.addEventListener("wheel",Xe),function(){document.removeEventListener("touchmove",Ie),document.removeEventListener("touchend",mt)}},[])}var ti=G(34280);function je(J){var ot=(0,pt.useState)(0),nt=(0,rt.Z)(ot,2),Z=nt[0],xt=nt[1],Ot=(0,pt.useRef)(0),ge=(0,pt.useRef)();return ge.current=J,(0,ti.o)(function(){var te;(te=ge.current)===null||te===void 0||te.call(ge)},[Z]),function(){Ot.current===Z&&(Ot.current+=1,xt(Ot.current))}}function Be(J){var ot=(0,pt.useRef)([]),nt=(0,pt.useState)({}),Z=(0,rt.Z)(nt,2),xt=Z[1],Ot=(0,pt.useRef)(typeof J=="function"?J():J),ge=je(function(){var lt=Ot.current;ot.current.forEach(function(Qt){lt=Qt(lt)}),ot.current=[],Ot.current=lt,xt({})});function te(lt){ot.current.push(lt),ge()}return[Ot.current,te]}var Se={width:0,height:0,left:0,top:0,right:0};function dt(J,ot,nt,Z,xt,Ot,ge){var te=ge.tabs,lt=ge.tabPosition,Qt=ge.rtl,me,Fe,Tt;return["top","bottom"].includes(lt)?(me="width",Fe=Qt?"right":"left",Tt=Math.abs(nt)):(me="height",Fe="top",Tt=-nt),(0,pt.useMemo)(function(){if(!te.length)return[0,0];for(var ce=te.length,bi=ce,li=0;li<ce;li+=1){var Mi=J.get(te[li].key)||Se;if(Mi[Fe]+Mi[me]>Tt+ot){bi=li-1;break}}for(var Pe=0,qe=ce-1;qe>=0;qe-=1){var Re=J.get(te[qe].key)||Se;if(Re[Fe]<Tt){Pe=qe+1;break}}return Pe>=bi?[0,0]:[Pe,bi]},[J,ot,Z,xt,Ot,Tt,lt,te.map(function(ce){return ce.key}).join("_"),Qt])}function W(J){var ot;return J instanceof Map?(ot={},J.forEach(function(nt,Z){ot[Z]=nt})):ot=J,JSON.stringify(ot)}var Zt="TABS_DQ";function ze(J){return String(J).replace(/"/g,Zt)}function Me(J,ot,nt,Z){return!(!nt||Z||J===!1||J===void 0&&(ot===!1||ot===null))}function ye(J,ot){var nt=J.prefixCls,Z=J.editable,xt=J.locale,Ot=J.style;return!Z||Z.showAdd===!1?null:pt.createElement("button",{ref:ot,type:"button",className:"".concat(nt,"-nav-add"),style:Ot,"aria-label":(xt==null?void 0:xt.addAriaLabel)||"Add tab",onClick:function(te){Z.onEdit("add",{event:te})}},Z.addIcon||"+")}var se=pt.forwardRef(ye),Ue=pt.forwardRef(function(J,ot){var nt=J.position,Z=J.prefixCls,xt=J.extra;if(!xt)return null;var Ot,ge={};return(0,yt.Z)(xt)==="object"&&!pt.isValidElement(xt)?ge=xt:ge.right=xt,nt==="right"&&(Ot=ge.right),nt==="left"&&(Ot=ge.left),Ot?pt.createElement("div",{className:"".concat(Z,"-extra-content"),ref:ot},Ot):null}),Fi=Ue,wi=G(31561),Ai=G(15285),ri=G(10228);function sn(J,ot){var nt=J.prefixCls,Z=J.id,xt=J.tabs,Ot=J.locale,ge=J.mobile,te=J.moreIcon,lt=te===void 0?"More":te,Qt=J.moreTransitionName,me=J.style,Fe=J.className,Tt=J.editable,ce=J.tabBarGutter,bi=J.rtl,li=J.removeAriaLabel,Mi=J.onTabClick,Pe=J.getPopupContainer,qe=J.popupClassName,Re=(0,pt.useState)(!1),ni=(0,rt.Z)(Re,2),Ut=ni[0],Wt=ni[1],Dt=(0,pt.useState)(null),ke=(0,rt.Z)(Dt,2),re=ke[0],Ie=ke[1],mt="".concat(Z,"-more-popup"),Xe="".concat(nt,"-dropdown"),pi=re!==null?"".concat(mt,"-").concat(re):null,ci=Ot==null?void 0:Ot.dropdownAriaLabel;function Ui(Ri,At){Ri.preventDefault(),Ri.stopPropagation(),Tt.onEdit("remove",{key:At,event:Ri})}var Ni=pt.createElement(Ai.ZP,{onClick:function(At){var vi=At.key,Qi=At.domEvent;Mi(vi,Qi),Wt(!1)},prefixCls:"".concat(Xe,"-menu"),id:mt,tabIndex:-1,role:"listbox","aria-activedescendant":pi,selectedKeys:[re],"aria-label":ci!==void 0?ci:"expanded dropdown"},xt.map(function(Ri){var At=Ri.closable,vi=Ri.disabled,Qi=Ri.closeIcon,Ti=Ri.key,gn=Ri.label,Mn=Me(At,Qi,Tt,vi);return pt.createElement(Ai.sN,{key:Ti,id:"".concat(mt,"-").concat(Ti),role:"option","aria-controls":Z&&"".concat(Z,"-panel-").concat(Ti),disabled:vi},pt.createElement("span",null,gn),Mn&&pt.createElement("button",{type:"button","aria-label":li||"remove",tabIndex:0,className:"".concat(Xe,"-menu-item-remove"),onClick:function(Ye){Ye.stopPropagation(),Ui(Ye,Ti)}},Qi||Tt.removeIcon||"\xD7"))}));function Gi(Ri){for(var At=xt.filter(function(Mn){return!Mn.disabled}),vi=At.findIndex(function(Mn){return Mn.key===re})||0,Qi=At.length,Ti=0;Ti<Qi;Ti+=1){vi=(vi+Ri+Qi)%Qi;var gn=At[vi];if(!gn.disabled){Ie(gn.key);return}}}function ki(Ri){var At=Ri.which;if(!Ut){[ri.Z.DOWN,ri.Z.SPACE,ri.Z.ENTER].includes(At)&&(Wt(!0),Ri.preventDefault());return}switch(At){case ri.Z.UP:Gi(-1),Ri.preventDefault();break;case ri.Z.DOWN:Gi(1),Ri.preventDefault();break;case ri.Z.ESC:Wt(!1);break;case ri.Z.SPACE:case ri.Z.ENTER:re!==null&&Mi(re,Ri);break}}(0,pt.useEffect)(function(){var Ri=document.getElementById(pi);Ri&&Ri.scrollIntoView&&Ri.scrollIntoView(!1)},[re]),(0,pt.useEffect)(function(){Ut||Ie(null)},[Ut]);var di=(0,Pt.Z)({},bi?"marginRight":"marginLeft",ce);xt.length||(di.visibility="hidden",di.order=1);var Ki=ut()((0,Pt.Z)({},"".concat(Xe,"-rtl"),bi)),Kt=ge?null:pt.createElement(wi.Z,{prefixCls:Xe,overlay:Ni,trigger:["hover"],visible:xt.length?Ut:!1,transitionName:Qt,onVisibleChange:Wt,overlayClassName:ut()(Ki,qe),mouseEnterDelay:.1,mouseLeaveDelay:.1,getPopupContainer:Pe},pt.createElement("button",{type:"button",className:"".concat(nt,"-nav-more"),style:di,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":mt,id:"".concat(Z,"-more"),"aria-expanded":Ut,onKeyDown:ki},lt));return pt.createElement("div",{className:ut()("".concat(nt,"-nav-operations"),Fe),style:me,ref:ot},Kt,pt.createElement(se,{prefixCls:nt,locale:Ot,editable:Tt}))}var Zi=pt.memo(pt.forwardRef(sn),function(J,ot){return ot.tabMoving});function j(J){var ot,nt=J.prefixCls,Z=J.id,xt=J.active,Ot=J.tab,ge=Ot.key,te=Ot.label,lt=Ot.disabled,Qt=Ot.closeIcon,me=J.closable,Fe=J.renderWrapper,Tt=J.removeAriaLabel,ce=J.editable,bi=J.onClick,li=J.onFocus,Mi=J.style,Pe="".concat(nt,"-tab"),qe=Me(me,Qt,ce,lt);function Re(Wt){lt||bi(Wt)}function ni(Wt){Wt.preventDefault(),Wt.stopPropagation(),ce.onEdit("remove",{key:ge,event:Wt})}var Ut=pt.createElement("div",{key:ge,"data-node-key":ze(ge),className:ut()(Pe,(ot={},(0,Pt.Z)(ot,"".concat(Pe,"-with-remove"),qe),(0,Pt.Z)(ot,"".concat(Pe,"-active"),xt),(0,Pt.Z)(ot,"".concat(Pe,"-disabled"),lt),ot)),style:Mi,onClick:Re},pt.createElement("div",{role:"tab","aria-selected":xt,id:Z&&"".concat(Z,"-tab-").concat(ge),className:"".concat(Pe,"-btn"),"aria-controls":Z&&"".concat(Z,"-panel-").concat(ge),"aria-disabled":lt,tabIndex:lt?null:0,onClick:function(Dt){Dt.stopPropagation(),Re(Dt)},onKeyDown:function(Dt){[ri.Z.SPACE,ri.Z.ENTER].includes(Dt.which)&&(Dt.preventDefault(),Re(Dt))},onFocus:li},te),qe&&pt.createElement("button",{type:"button","aria-label":Tt||"remove",tabIndex:0,className:"".concat(Pe,"-remove"),onClick:function(Dt){Dt.stopPropagation(),ni(Dt)}},Qt||ce.removeIcon||"\xD7"));return Fe?Fe(Ut):Ut}var P=j,E=G(16089),B=function(ot){var nt=ot.activeTabOffset,Z=ot.horizontal,xt=ot.rtl,Ot=ot.indicatorSize,ge=(0,pt.useState)(),te=(0,rt.Z)(ge,2),lt=te[0],Qt=te[1],me=(0,pt.useRef)(),Fe=function(bi){return typeof Ot=="function"?Ot(bi):typeof Ot=="number"?Ot:bi};function Tt(){E.Z.cancel(me.current)}return(0,pt.useEffect)(function(){var ce={};return nt&&(Z?(xt?(ce.right=nt.right+nt.width/2,ce.transform="translateX(50%)"):(ce.left=nt.left+nt.width/2,ce.transform="translateX(-50%)"),ce.width=Fe(nt.width)):(ce.top=nt.top+nt.height/2,ce.transform="translateY(-50%)",ce.height=Fe(nt.height))),Tt(),me.current=(0,E.Z)(function(){Qt(ce)}),Tt},[nt,Z,xt,Ot]),{style:lt}},U=B,D=function(ot){var nt=ot.current||{},Z=nt.offsetWidth,xt=Z===void 0?0:Z,Ot=nt.offsetHeight,ge=Ot===void 0?0:Ot;return[xt,ge]},St=function(ot,nt){return ot[nt?0:1]};function ae(J,ot){var nt,Z=pt.useContext(Jt),xt=Z.prefixCls,Ot=Z.tabs,ge=J.className,te=J.style,lt=J.id,Qt=J.animated,me=J.activeKey,Fe=J.rtl,Tt=J.extra,ce=J.editable,bi=J.locale,li=J.tabPosition,Mi=J.tabBarGutter,Pe=J.children,qe=J.onTabClick,Re=J.onTabScroll,ni=J.indicatorSize,Ut=(0,pt.useRef)(),Wt=(0,pt.useRef)(),Dt=(0,pt.useRef)(),ke=(0,pt.useRef)(),re=(0,pt.useRef)(),Ie=(0,pt.useRef)(),mt=(0,pt.useRef)(),Xe=li==="top"||li==="bottom",pi=Vt(0,function(Nn,An){Xe&&Re&&Re({direction:Nn>An?"left":"right"})}),ci=(0,rt.Z)(pi,2),Ui=ci[0],Ni=ci[1],Gi=Vt(0,function(Nn,An){!Xe&&Re&&Re({direction:Nn>An?"top":"bottom"})}),ki=(0,rt.Z)(Gi,2),di=ki[0],Ki=ki[1],Kt=(0,pt.useState)([0,0]),Ri=(0,rt.Z)(Kt,2),At=Ri[0],vi=Ri[1],Qi=(0,pt.useState)([0,0]),Ti=(0,rt.Z)(Qi,2),gn=Ti[0],Mn=Ti[1],mi=(0,pt.useState)([0,0]),Ye=(0,rt.Z)(mi,2),Je=Ye[0],Oi=Ye[1],pe=(0,pt.useState)([0,0]),z=(0,rt.Z)(pe,2),fn=z[0],vn=z[1],Qn=Be(new Map),Kn=(0,rt.Z)(Qn,2),Ar=Kn[0],tn=Kn[1],Hi=ve(Ot,Ar,gn[0]),Sn=St(At,Xe),Ji=St(gn,Xe),Fn=St(Je,Xe),Xr=St(fn,Xe),no=Sn<Ji+Fn,Jn=no?Sn-Xr:Sn-Fn,ii="".concat(xt,"-nav-operations-hidden"),xr=0,wr=0;Xe&&Fe?(xr=0,wr=Math.max(0,Ji-Jn)):(xr=Math.min(0,Jn-Ji),wr=0);function ko(Nn){return Nn<xr?xr:Nn>wr?wr:Nn}var br=(0,pt.useRef)(),po=(0,pt.useState)(),ds=(0,rt.Z)(po,2),Ps=ds[0],xs=ds[1];function Ns(){xs(Date.now())}function ws(){window.clearTimeout(br.current)}_e(ke,function(Nn,An){function Rr(Io,Oo){Io(function(on){var Il=ko(on+Oo);return Il})}return no?(Xe?Rr(Ni,Nn):Rr(Ki,An),ws(),Ns(),!0):!1}),(0,pt.useEffect)(function(){return ws(),Ps&&(br.current=window.setTimeout(function(){xs(0)},100)),ws},[Ps]);var It=dt(Hi,Jn,Xe?Ui:di,Ji,Fn,Xr,(0,Q.Z)((0,Q.Z)({},J),{},{tabs:Ot})),Lo=(0,rt.Z)(It,2),Va=Lo[0],Ia=Lo[1],Xs=(0,q.Z)(function(){var Nn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:me,An=Hi.get(Nn)||{width:0,height:0,left:0,right:0,top:0};if(Xe){var Rr=Ui;Fe?An.right<Ui?Rr=An.right:An.right+An.width>Ui+Jn&&(Rr=An.right+An.width-Jn):An.left<-Ui?Rr=-An.left:An.left+An.width>-Ui+Jn&&(Rr=-(An.left+An.width-Jn)),Ki(0),Ni(ko(Rr))}else{var Io=di;An.top<-di?Io=-An.top:An.top+An.height>-di+Jn&&(Io=-(An.top+An.height-Jn)),Ni(0),Ki(ko(Io))}}),Ao={};li==="top"||li==="bottom"?Ao[Fe?"marginRight":"marginLeft"]=Mi:Ao.marginTop=Mi;var al=Ot.map(function(Nn,An){var Rr=Nn.key;return pt.createElement(P,{id:lt,prefixCls:xt,key:Rr,tab:Nn,style:An===0?void 0:Ao,closable:Nn.closable,editable:ce,active:Rr===me,renderWrapper:Pe,removeAriaLabel:bi==null?void 0:bi.removeAriaLabel,onClick:function(Oo){qe(Rr,Oo)},onFocus:function(){Xs(Rr),Ns(),ke.current&&(Fe||(ke.current.scrollLeft=0),ke.current.scrollTop=0)}})}),oa=function(){return tn(function(){var An=new Map;return Ot.forEach(function(Rr){var Io,Oo=Rr.key,on=(Io=re.current)===null||Io===void 0?void 0:Io.querySelector('[data-node-key="'.concat(ze(Oo),'"]'));on&&An.set(Oo,{width:on.offsetWidth,height:on.offsetHeight,left:on.offsetLeft,top:on.offsetTop})}),An})};(0,pt.useEffect)(function(){oa()},[Ot.map(function(Nn){return Nn.key}).join("_")]);var vr=je(function(){var Nn=D(Ut),An=D(Wt),Rr=D(Dt);vi([Nn[0]-An[0]-Rr[0],Nn[1]-An[1]-Rr[1]]);var Io=D(mt);Oi(Io);var Oo=D(Ie);vn(Oo);var on=D(re);Mn([on[0]-Io[0],on[1]-Io[1]]),oa()}),jr=Ot.slice(0,Va),ya=Ot.slice(Ia+1),yn=[].concat((0,Xt.Z)(jr),(0,Xt.Z)(ya)),Xn=Hi.get(me),Pn=U({activeTabOffset:Xn,horizontal:Xe,rtl:Fe,indicatorSize:ni}),ai=Pn.style;(0,pt.useEffect)(function(){Xs()},[me,xr,wr,W(Xn),W(Hi),Xe]),(0,pt.useEffect)(function(){vr()},[Fe]);var cr=!!yn.length,_r="".concat(xt,"-nav-wrap"),ro,Eo,Do,Ze;return Xe?Fe?(Eo=Ui>0,ro=Ui!==wr):(ro=Ui<0,Eo=Ui!==xr):(Do=di<0,Ze=di!==xr),pt.createElement(Ct.Z,{onResize:vr},pt.createElement("div",{ref:(0,Et.x1)(ot,Ut),role:"tablist",className:ut()("".concat(xt,"-nav"),ge),style:te,onKeyDown:function(){Ns()}},pt.createElement(Fi,{ref:Wt,position:"left",extra:Tt,prefixCls:xt}),pt.createElement(Ct.Z,{onResize:vr},pt.createElement("div",{className:ut()(_r,(nt={},(0,Pt.Z)(nt,"".concat(_r,"-ping-left"),ro),(0,Pt.Z)(nt,"".concat(_r,"-ping-right"),Eo),(0,Pt.Z)(nt,"".concat(_r,"-ping-top"),Do),(0,Pt.Z)(nt,"".concat(_r,"-ping-bottom"),Ze),nt)),ref:ke},pt.createElement(Ct.Z,{onResize:vr},pt.createElement("div",{ref:re,className:"".concat(xt,"-nav-list"),style:{transform:"translate(".concat(Ui,"px, ").concat(di,"px)"),transition:Ps?"none":void 0}},al,pt.createElement(se,{ref:mt,prefixCls:xt,locale:bi,editable:ce,style:(0,Q.Z)((0,Q.Z)({},al.length===0?void 0:Ao),{},{visibility:cr?"hidden":null})}),pt.createElement("div",{className:ut()("".concat(xt,"-ink-bar"),(0,Pt.Z)({},"".concat(xt,"-ink-bar-animated"),Qt.inkBar)),style:ai}))))),pt.createElement(Zi,(0,ft.Z)({},J,{removeAriaLabel:bi==null?void 0:bi.removeAriaLabel,ref:Ie,prefixCls:xt,tabs:yn,className:!cr&&ii,tabMoving:!!Ps})),pt.createElement(Fi,{ref:Dt,position:"right",extra:Tt,prefixCls:xt})))}var $e=pt.forwardRef(ae),Ae=["renderTabBar"],Qe=["label","key"];function He(J){var ot=J.renderTabBar,nt=(0,be.Z)(J,Ae),Z=pt.useContext(Jt),xt=Z.tabs;if(ot){var Ot=(0,Q.Z)((0,Q.Z)({},nt),{},{panes:xt.map(function(ge){var te=ge.label,lt=ge.key,Qt=(0,be.Z)(ge,Qe);return pt.createElement(de,(0,ft.Z)({tab:te,key:lt,tabKey:lt},Qt))})});return ot(Ot,$e)}return pt.createElement($e,nt)}var Si=G(48736);function Ei(){var J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},ot;return J===!1?ot={inkBar:!1,tabPane:!1}:J===!0?ot={inkBar:!0,tabPane:!1}:ot=(0,Q.Z)({inkBar:!0},(0,yt.Z)(J)==="object"?J:{}),ot.tabPaneMotion&&ot.tabPane===void 0&&(ot.tabPane=!0),!ot.tabPaneMotion&&ot.tabPane&&(ot.tabPane=!1),ot}var Ci=["id","prefixCls","className","items","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll","getPopupContainer","popupClassName","indicatorSize"],qt=0;function ei(J,ot){var nt,Z=J.id,xt=J.prefixCls,Ot=xt===void 0?"rc-tabs":xt,ge=J.className,te=J.items,lt=J.direction,Qt=J.activeKey,me=J.defaultActiveKey,Fe=J.editable,Tt=J.animated,ce=J.tabPosition,bi=ce===void 0?"top":ce,li=J.tabBarGutter,Mi=J.tabBarStyle,Pe=J.tabBarExtraContent,qe=J.locale,Re=J.moreIcon,ni=J.moreTransitionName,Ut=J.destroyInactiveTabPane,Wt=J.renderTabBar,Dt=J.onChange,ke=J.onTabClick,re=J.onTabScroll,Ie=J.getPopupContainer,mt=J.popupClassName,Xe=J.indicatorSize,pi=(0,be.Z)(J,Ci),ci=pt.useMemo(function(){return(te||[]).filter(function(vn){return vn&&(0,yt.Z)(vn)==="object"&&"key"in vn})},[te]),Ui=lt==="rtl",Ni=Ei(Tt),Gi=(0,pt.useState)(!1),ki=(0,rt.Z)(Gi,2),di=ki[0],Ki=ki[1];(0,pt.useEffect)(function(){Ki((0,Rt.Z)())},[]);var Kt=(0,Ce.Z)(function(){var vn;return(vn=ci[0])===null||vn===void 0?void 0:vn.key},{value:Qt,defaultValue:me}),Ri=(0,rt.Z)(Kt,2),At=Ri[0],vi=Ri[1],Qi=(0,pt.useState)(function(){return ci.findIndex(function(vn){return vn.key===At})}),Ti=(0,rt.Z)(Qi,2),gn=Ti[0],Mn=Ti[1];(0,pt.useEffect)(function(){var vn=ci.findIndex(function(Kn){return Kn.key===At});if(vn===-1){var Qn;vn=Math.max(0,Math.min(gn,ci.length-1)),vi((Qn=ci[vn])===null||Qn===void 0?void 0:Qn.key)}Mn(vn)},[ci.map(function(vn){return vn.key}).join("_"),At,gn]);var mi=(0,Ce.Z)(null,{value:Z}),Ye=(0,rt.Z)(mi,2),Je=Ye[0],Oi=Ye[1];(0,pt.useEffect)(function(){Z||(Oi("rc-tabs-".concat(qt)),qt+=1)},[]);function pe(vn,Qn){ke==null||ke(vn,Qn);var Kn=vn!==At;vi(vn),Kn&&(Dt==null||Dt(vn))}var z={id:Je,activeKey:At,animated:Ni,tabPosition:bi,rtl:Ui,mobile:di},fn=(0,Q.Z)((0,Q.Z)({},z),{},{editable:Fe,locale:qe,moreIcon:Re,moreTransitionName:ni,tabBarGutter:li,onTabClick:pe,onTabScroll:re,extra:Pe,style:Mi,panes:null,getPopupContainer:Ie,popupClassName:mt,indicatorSize:Xe});return pt.createElement(Jt.Provider,{value:{tabs:ci,prefixCls:Ot}},pt.createElement("div",(0,ft.Z)({ref:ot,id:Z,className:ut()(Ot,"".concat(Ot,"-").concat(bi),(nt={},(0,Pt.Z)(nt,"".concat(Ot,"-mobile"),di),(0,Pt.Z)(nt,"".concat(Ot,"-editable"),Fe),(0,Pt.Z)(nt,"".concat(Ot,"-rtl"),Ui),nt),ge)},pi),pt.createElement(He,(0,ft.Z)({},fn,{renderTabBar:Wt})),pt.createElement($t,(0,ft.Z)({destroyInactiveTabPane:Ut},z,{animated:Ni}))))}var ln=pt.forwardRef(ei),Ft=ln,oe=Ft,we=G(36355),Ii=G(19716),_i=()=>null,hn=G(62892);const mn={motionAppear:!1,motionEnter:!0,motionLeave:!0};function Ln(J){let ot=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{inkBar:!0,tabPane:!1},nt;return ot===!1?nt={inkBar:!1,tabPane:!1}:ot===!0?nt={inkBar:!0,tabPane:!0}:nt=Object.assign({inkBar:!0},typeof ot=="object"?ot:{}),nt.tabPane&&(nt.tabPaneMotion=Object.assign(Object.assign({},mn),{motionName:(0,hn.m)(J,"switch")})),nt}var jn=G(11592),On=function(J,ot){var nt={};for(var Z in J)Object.prototype.hasOwnProperty.call(J,Z)&&ot.indexOf(Z)<0&&(nt[Z]=J[Z]);if(J!=null&&typeof Object.getOwnPropertySymbols=="function")for(var xt=0,Z=Object.getOwnPropertySymbols(J);xt<Z.length;xt++)ot.indexOf(Z[xt])<0&&Object.prototype.propertyIsEnumerable.call(J,Z[xt])&&(nt[Z[xt]]=J[Z[xt]]);return nt};function rn(J){return J.filter(ot=>ot)}function ir(J,ot){if(J)return J;const nt=(0,jn.Z)(ot).map(Z=>{if(pt.isValidElement(Z)){const{key:xt,props:Ot}=Z,ge=Ot||{},{tab:te}=ge,lt=On(ge,["tab"]);return Object.assign(Object.assign({key:String(xt)},lt),{label:te})}return null});return rn(nt)}var tr=G(17313),hr=G(83116),Er=G(37613),Hn=G(13826),T=J=>{const{componentCls:ot,motionDurationSlow:nt}=J;return[{[ot]:{[`${ot}-switch`]:{"&-appear, &-enter":{transition:"none","&-start":{opacity:0},"&-active":{opacity:1,transition:`opacity ${nt}`}},"&-leave":{position:"absolute",transition:"none",inset:0,"&-start":{opacity:1},"&-active":{opacity:0,transition:`opacity ${nt}`}}}}},[(0,Hn.oN)(J,"slide-up"),(0,Hn.oN)(J,"slide-down")]]};const ur=J=>{const{componentCls:ot,tabsCardPadding:nt,cardBg:Z,cardGutter:xt,colorBorderSecondary:Ot,itemSelectedColor:ge}=J;return{[`${ot}-card`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{[`${ot}-tab`]:{margin:0,padding:nt,background:Z,border:`${J.lineWidth}px ${J.lineType} ${Ot}`,transition:`all ${J.motionDurationSlow} ${J.motionEaseInOut}`},[`${ot}-tab-active`]:{color:ge,background:J.colorBgContainer},[`${ot}-ink-bar`]:{visibility:"hidden"}},[`&${ot}-top, &${ot}-bottom`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{[`${ot}-tab + ${ot}-tab`]:{marginLeft:{_skip_check_:!0,value:`${xt}px`}}}},[`&${ot}-top`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{[`${ot}-tab`]:{borderRadius:`${J.borderRadiusLG}px ${J.borderRadiusLG}px 0 0`},[`${ot}-tab-active`]:{borderBottomColor:J.colorBgContainer}}},[`&${ot}-bottom`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{[`${ot}-tab`]:{borderRadius:`0 0 ${J.borderRadiusLG}px ${J.borderRadiusLG}px`},[`${ot}-tab-active`]:{borderTopColor:J.colorBgContainer}}},[`&${ot}-left, &${ot}-right`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{[`${ot}-tab + ${ot}-tab`]:{marginTop:`${xt}px`}}},[`&${ot}-left`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{[`${ot}-tab`]:{borderRadius:{_skip_check_:!0,value:`${J.borderRadiusLG}px 0 0 ${J.borderRadiusLG}px`}},[`${ot}-tab-active`]:{borderRightColor:{_skip_check_:!0,value:J.colorBgContainer}}}},[`&${ot}-right`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{[`${ot}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${J.borderRadiusLG}px ${J.borderRadiusLG}px 0`}},[`${ot}-tab-active`]:{borderLeftColor:{_skip_check_:!0,value:J.colorBgContainer}}}}}}},$n=J=>{const{componentCls:ot,itemHoverColor:nt,dropdownEdgeChildVerticalPadding:Z}=J;return{[`${ot}-dropdown`]:Object.assign(Object.assign({},(0,tr.Wf)(J)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:J.zIndexPopup,display:"block","&-hidden":{display:"none"},[`${ot}-dropdown-menu`]:{maxHeight:J.tabsDropdownHeight,margin:0,padding:`${Z}px 0`,overflowX:"hidden",overflowY:"auto",textAlign:{_skip_check_:!0,value:"left"},listStyleType:"none",backgroundColor:J.colorBgContainer,backgroundClip:"padding-box",borderRadius:J.borderRadiusLG,outline:"none",boxShadow:J.boxShadowSecondary,"&-item":Object.assign(Object.assign({},tr.vS),{display:"flex",alignItems:"center",minWidth:J.tabsDropdownWidth,margin:0,padding:`${J.paddingXXS}px ${J.paddingSM}px`,color:J.colorText,fontWeight:"normal",fontSize:J.fontSize,lineHeight:J.lineHeight,cursor:"pointer",transition:`all ${J.motionDurationSlow}`,"> span":{flex:1,whiteSpace:"nowrap"},"&-remove":{flex:"none",marginLeft:{_skip_check_:!0,value:J.marginSM},color:J.colorTextDescription,fontSize:J.fontSizeSM,background:"transparent",border:0,cursor:"pointer","&:hover":{color:nt}},"&:hover":{background:J.controlItemBgHover},"&-disabled":{"&, &:hover":{color:J.colorTextDisabled,background:"transparent",cursor:"not-allowed"}}})}})}},Yn=J=>{const{componentCls:ot,margin:nt,colorBorderSecondary:Z,horizontalMargin:xt,verticalItemPadding:Ot,verticalItemMargin:ge}=J;return{[`${ot}-top, ${ot}-bottom`]:{flexDirection:"column",[`> ${ot}-nav, > div > ${ot}-nav`]:{margin:xt,"&::before":{position:"absolute",right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},borderBottom:`${J.lineWidth}px ${J.lineType} ${Z}`,content:"''"},[`${ot}-ink-bar`]:{height:J.lineWidthBold,"&-animated":{transition:`width ${J.motionDurationSlow}, left ${J.motionDurationSlow},
right ${J.motionDurationSlow}`}},[`${ot}-nav-wrap`]:{"&::before, &::after":{top:0,bottom:0,width:J.controlHeight},"&::before":{left:{_skip_check_:!0,value:0},boxShadow:J.boxShadowTabsOverflowLeft},"&::after":{right:{_skip_check_:!0,value:0},boxShadow:J.boxShadowTabsOverflowRight},[`&${ot}-nav-wrap-ping-left::before`]:{opacity:1},[`&${ot}-nav-wrap-ping-right::after`]:{opacity:1}}}},[`${ot}-top`]:{[`> ${ot}-nav,
> div > ${ot}-nav`]:{"&::before":{bottom:0},[`${ot}-ink-bar`]:{bottom:0}}},[`${ot}-bottom`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{order:1,marginTop:`${nt}px`,marginBottom:0,"&::before":{top:0},[`${ot}-ink-bar`]:{top:0}},[`> ${ot}-content-holder, > div > ${ot}-content-holder`]:{order:0}},[`${ot}-left, ${ot}-right`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{flexDirection:"column",minWidth:J.controlHeight*1.25,[`${ot}-tab`]:{padding:Ot,textAlign:"center"},[`${ot}-tab + ${ot}-tab`]:{margin:ge},[`${ot}-nav-wrap`]:{flexDirection:"column","&::before, &::after":{right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},height:J.controlHeight},"&::before":{top:0,boxShadow:J.boxShadowTabsOverflowTop},"&::after":{bottom:0,boxShadow:J.boxShadowTabsOverflowBottom},[`&${ot}-nav-wrap-ping-top::before`]:{opacity:1},[`&${ot}-nav-wrap-ping-bottom::after`]:{opacity:1}},[`${ot}-ink-bar`]:{width:J.lineWidthBold,"&-animated":{transition:`height ${J.motionDurationSlow}, top ${J.motionDurationSlow}`}},[`${ot}-nav-list, ${ot}-nav-operations`]:{flex:"1 0 auto",flexDirection:"column"}}},[`${ot}-left`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{[`${ot}-ink-bar`]:{right:{_skip_check_:!0,value:0}}},[`> ${ot}-content-holder, > div > ${ot}-content-holder`]:{marginLeft:{_skip_check_:!0,value:`-${J.lineWidth}px`},borderLeft:{_skip_check_:!0,value:`${J.lineWidth}px ${J.lineType} ${J.colorBorder}`},[`> ${ot}-content > ${ot}-tabpane`]:{paddingLeft:{_skip_check_:!0,value:J.paddingLG}}}},[`${ot}-right`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{order:1,[`${ot}-ink-bar`]:{left:{_skip_check_:!0,value:0}}},[`> ${ot}-content-holder, > div > ${ot}-content-holder`]:{order:0,marginRight:{_skip_check_:!0,value:-J.lineWidth},borderRight:{_skip_check_:!0,value:`${J.lineWidth}px ${J.lineType} ${J.colorBorder}`},[`> ${ot}-content > ${ot}-tabpane`]:{paddingRight:{_skip_check_:!0,value:J.paddingLG}}}}}},Nr=J=>{const{componentCls:ot,cardPaddingSM:nt,cardPaddingLG:Z,horizontalItemPaddingSM:xt,horizontalItemPaddingLG:Ot}=J;return{[ot]:{"&-small":{[`> ${ot}-nav`]:{[`${ot}-tab`]:{padding:xt,fontSize:J.titleFontSizeSM}}},"&-large":{[`> ${ot}-nav`]:{[`${ot}-tab`]:{padding:Ot,fontSize:J.titleFontSizeLG}}}},[`${ot}-card`]:{[`&${ot}-small`]:{[`> ${ot}-nav`]:{[`${ot}-tab`]:{padding:nt}},[`&${ot}-bottom`]:{[`> ${ot}-nav ${ot}-tab`]:{borderRadius:`0 0 ${J.borderRadius}px ${J.borderRadius}px`}},[`&${ot}-top`]:{[`> ${ot}-nav ${ot}-tab`]:{borderRadius:`${J.borderRadius}px ${J.borderRadius}px 0 0`}},[`&${ot}-right`]:{[`> ${ot}-nav ${ot}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${J.borderRadius}px ${J.borderRadius}px 0`}}},[`&${ot}-left`]:{[`> ${ot}-nav ${ot}-tab`]:{borderRadius:{_skip_check_:!0,value:`${J.borderRadius}px 0 0 ${J.borderRadius}px`}}}},[`&${ot}-large`]:{[`> ${ot}-nav`]:{[`${ot}-tab`]:{padding:Z}}}}}},Gn=J=>{const{componentCls:ot,itemActiveColor:nt,itemHoverColor:Z,iconCls:xt,tabsHorizontalItemMargin:Ot,horizontalItemPadding:ge,itemSelectedColor:te,itemColor:lt}=J,Qt=`${ot}-tab`;return{[Qt]:{position:"relative",WebkitTouchCallout:"none",WebkitTapHighlightColor:"transparent",display:"inline-flex",alignItems:"center",padding:ge,fontSize:J.titleFontSize,background:"transparent",border:0,outline:"none",cursor:"pointer",color:lt,"&-btn, &-remove":Object.assign({"&:focus:not(:focus-visible), &:active":{color:nt}},(0,tr.Qy)(J)),"&-btn":{outline:"none",transition:"all 0.3s"},"&-remove":{flex:"none",marginRight:{_skip_check_:!0,value:-J.marginXXS},marginLeft:{_skip_check_:!0,value:J.marginXS},color:J.colorTextDescription,fontSize:J.fontSizeSM,background:"transparent",border:"none",outline:"none",cursor:"pointer",transition:`all ${J.motionDurationSlow}`,"&:hover":{color:J.colorTextHeading}},"&:hover":{color:Z},[`&${Qt}-active ${Qt}-btn`]:{color:te,textShadow:J.tabsActiveTextShadow},[`&${Qt}-disabled`]:{color:J.colorTextDisabled,cursor:"not-allowed"},[`&${Qt}-disabled ${Qt}-btn, &${Qt}-disabled ${ot}-remove`]:{"&:focus, &:active":{color:J.colorTextDisabled}},[`& ${Qt}-remove ${xt}`]:{margin:0},[xt]:{marginRight:{_skip_check_:!0,value:J.marginSM}}},[`${Qt} + ${Qt}`]:{margin:{_skip_check_:!0,value:Ot}}}},uo=J=>{const{componentCls:ot,tabsHorizontalItemMarginRTL:nt,iconCls:Z,cardGutter:xt}=J;return{[`${ot}-rtl`]:{direction:"rtl",[`${ot}-nav`]:{[`${ot}-tab`]:{margin:{_skip_check_:!0,value:nt},[`${ot}-tab:last-of-type`]:{marginLeft:{_skip_check_:!0,value:0}},[Z]:{marginRight:{_skip_check_:!0,value:0},marginLeft:{_skip_check_:!0,value:`${J.marginSM}px`}},[`${ot}-tab-remove`]:{marginRight:{_skip_check_:!0,value:`${J.marginXS}px`},marginLeft:{_skip_check_:!0,value:`-${J.marginXXS}px`},[Z]:{margin:0}}}},[`&${ot}-left`]:{[`> ${ot}-nav`]:{order:1},[`> ${ot}-content-holder`]:{order:0}},[`&${ot}-right`]:{[`> ${ot}-nav`]:{order:0},[`> ${ot}-content-holder`]:{order:1}},[`&${ot}-card${ot}-top, &${ot}-card${ot}-bottom`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{[`${ot}-tab + ${ot}-tab`]:{marginRight:{_skip_check_:!0,value:xt},marginLeft:{_skip_check_:!0,value:0}}}}},[`${ot}-dropdown-rtl`]:{direction:"rtl"},[`${ot}-menu-item`]:{[`${ot}-dropdown-rtl`]:{textAlign:{_skip_check_:!0,value:"right"}}}}},zo=J=>{const{componentCls:ot,tabsCardPadding:nt,cardHeight:Z,cardGutter:xt,itemHoverColor:Ot,itemActiveColor:ge,colorBorderSecondary:te}=J;return{[ot]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,tr.Wf)(J)),{display:"flex",[`> ${ot}-nav, > div > ${ot}-nav`]:{position:"relative",display:"flex",flex:"none",alignItems:"center",[`${ot}-nav-wrap`]:{position:"relative",display:"flex",flex:"auto",alignSelf:"stretch",overflow:"hidden",whiteSpace:"nowrap",transform:"translate(0)","&::before, &::after":{position:"absolute",zIndex:1,opacity:0,transition:`opacity ${J.motionDurationSlow}`,content:"''",pointerEvents:"none"}},[`${ot}-nav-list`]:{position:"relative",display:"flex",transition:`opacity ${J.motionDurationSlow}`},[`${ot}-nav-operations`]:{display:"flex",alignSelf:"stretch"},[`${ot}-nav-operations-hidden`]:{position:"absolute",visibility:"hidden",pointerEvents:"none"},[`${ot}-nav-more`]:{position:"relative",padding:nt,background:"transparent",border:0,color:J.colorText,"&::after":{position:"absolute",right:{_skip_check_:!0,value:0},bottom:0,left:{_skip_check_:!0,value:0},height:J.controlHeightLG/8,transform:"translateY(100%)",content:"''"}},[`${ot}-nav-add`]:Object.assign({minWidth:Z,marginLeft:{_skip_check_:!0,value:xt},padding:`0 ${J.paddingXS}px`,background:"transparent",border:`${J.lineWidth}px ${J.lineType} ${te}`,borderRadius:`${J.borderRadiusLG}px ${J.borderRadiusLG}px 0 0`,outline:"none",cursor:"pointer",color:J.colorText,transition:`all ${J.motionDurationSlow} ${J.motionEaseInOut}`,"&:hover":{color:Ot},"&:active, &:focus:not(:focus-visible)":{color:ge}},(0,tr.Qy)(J))},[`${ot}-extra-content`]:{flex:"none"},[`${ot}-ink-bar`]:{position:"absolute",background:J.inkBarColor,pointerEvents:"none"}}),Gn(J)),{[`${ot}-content`]:{position:"relative",width:"100%"},[`${ot}-content-holder`]:{flex:"auto",minWidth:0,minHeight:0},[`${ot}-tabpane`]:{outline:"none","&-hidden":{display:"none"}}}),[`${ot}-centered`]:{[`> ${ot}-nav, > div > ${ot}-nav`]:{[`${ot}-nav-wrap`]:{[`&:not([class*='${ot}-nav-wrap-ping'])`]:{justifyContent:"center"}}}}}};var gr=(0,hr.Z)("Tabs",J=>{const ot=(0,Er.TS)(J,{tabsCardPadding:J.cardPadding||`${(J.cardHeight-Math.round(J.fontSize*J.lineHeight))/2-J.lineWidth}px ${J.padding}px`,dropdownEdgeChildVerticalPadding:J.paddingXXS,tabsActiveTextShadow:"0 0 0.25px currentcolor",tabsDropdownHeight:200,tabsDropdownWidth:120,tabsHorizontalItemMargin:`0 0 0 ${J.horizontalItemGutter}px`,tabsHorizontalItemMarginRTL:`0 0 0 ${J.horizontalItemGutter}px`});return[Nr(ot),uo(ot),Yn(ot),$n(ot),ur(ot),zo(ot),T(ot)]},J=>{const ot=J.controlHeightLG;return{zIndexPopup:J.zIndexPopupBase+50,cardBg:J.colorFillAlter,cardHeight:ot,cardPadding:"",cardPaddingSM:`${J.paddingXXS*1.5}px ${J.padding}px`,cardPaddingLG:`${J.paddingXS}px ${J.padding}px ${J.paddingXXS*1.5}px`,titleFontSize:J.fontSize,titleFontSizeLG:J.fontSizeLG,titleFontSizeSM:J.fontSize,inkBarColor:J.colorPrimary,horizontalMargin:`0 0 ${J.margin}px 0`,horizontalItemGutter:32,horizontalItemMargin:"",horizontalItemMarginRTL:"",horizontalItemPadding:`${J.paddingSM}px 0`,horizontalItemPaddingSM:`${J.paddingXS}px 0`,horizontalItemPaddingLG:`${J.padding}px 0`,verticalItemPadding:`${J.paddingXS}px ${J.paddingLG}px`,verticalItemMargin:`${J.margin}px 0 0 0`,itemColor:J.colorText,itemSelectedColor:J.colorPrimary,itemHoverColor:J.colorPrimaryHover,itemActiveColor:J.colorPrimaryActive,cardGutter:J.marginXXS/2}}),pn=function(J,ot){var nt={};for(var Z in J)Object.prototype.hasOwnProperty.call(J,Z)&&ot.indexOf(Z)<0&&(nt[Z]=J[Z]);if(J!=null&&typeof Object.getOwnPropertySymbols=="function")for(var xt=0,Z=Object.getOwnPropertySymbols(J);xt<Z.length;xt++)ot.indexOf(Z[xt])<0&&Object.prototype.propertyIsEnumerable.call(J,Z[xt])&&(nt[Z[xt]]=J[Z[xt]]);return nt};const gi=J=>{const{type:ot,className:nt,rootClassName:Z,size:xt,onEdit:Ot,hideAdd:ge,centered:te,addIcon:lt,popupClassName:Qt,children:me,items:Fe,animated:Tt,style:ce,indicatorSize:bi}=J,li=pn(J,["type","className","rootClassName","size","onEdit","hideAdd","centered","addIcon","popupClassName","children","items","animated","style","indicatorSize"]),{prefixCls:Mi,moreIcon:Pe=pt.createElement(kt.Z,null)}=li,{direction:qe,tabs:Re,getPrefixCls:ni,getPopupContainer:Ut}=pt.useContext(we.E_),Wt=ni("tabs",Mi),[Dt,ke]=gr(Wt);let re;ot==="editable-card"&&(re={onEdit:(Ui,Ni)=>{let{key:Gi,event:ki}=Ni;Ot==null||Ot(Ui==="add"?ki:Gi,Ui)},removeIcon:pt.createElement(Mt.Z,null),addIcon:lt||pt.createElement(vt.Z,null),showAdd:ge!==!0});const Ie=ni(),mt=ir(Fe,me),Xe=Ln(Wt,Tt),pi=(0,Ii.Z)(xt),ci=Object.assign(Object.assign({},Re==null?void 0:Re.style),ce);return Dt(pt.createElement(oe,Object.assign({direction:qe,getPopupContainer:Ut,moreTransitionName:`${Ie}-slide-up`},li,{items:mt,className:ut()({[`${Wt}-${pi}`]:pi,[`${Wt}-card`]:["card","editable-card"].includes(ot),[`${Wt}-editable-card`]:ot==="editable-card",[`${Wt}-centered`]:te},Re==null?void 0:Re.className,nt,Z,ke),popupClassName:ut()(Qt,ke),style:ci,editable:re,moreIcon:Pe,prefixCls:Wt,animated:Xe,indicatorSize:bi!=null?bi:Re==null?void 0:Re.indicatorSize})))};gi.TabPane=_i;var ct=gi},99498:function(qn,Li,G){(function(Mt){Mt(G(89780))})(function(Mt){Mt.defineOption("placeholder","",function(Q,rt,yt){var be=yt&&yt!=Mt.Init;if(rt&&!be)Q.on("blur",ut),Q.on("change",ft),Q.on("swapDoc",ft),Mt.on(Q.getInputField(),"compositionupdate",Q.state.placeholderCompose=function(){le(Q)}),ft(Q);else if(!rt&&be){Q.off("blur",ut),Q.off("change",ft),Q.off("swapDoc",ft),Mt.off(Q.getInputField(),"compositionupdate",Q.state.placeholderCompose),kt(Q);var pt=Q.getWrapperElement();pt.className=pt.className.replace(" CodeMirror-empty","")}rt&&!Q.hasFocus()&&ut(Q)});function kt(Q){Q.state.placeholder&&(Q.state.placeholder.parentNode.removeChild(Q.state.placeholder),Q.state.placeholder=null)}function vt(Q){kt(Q);var rt=Q.state.placeholder=document.createElement("pre");rt.style.cssText="height: 0; overflow: visible",rt.style.direction=Q.getOption("direction"),rt.className="CodeMirror-placeholder CodeMirror-line-like";var yt=Q.getOption("placeholder");typeof yt=="string"&&(yt=document.createTextNode(yt)),rt.appendChild(yt),Q.display.lineSpace.insertBefore(rt,Q.display.lineSpace.firstChild)}function le(Q){setTimeout(function(){var rt=!1,yt=Q.getInputField();yt.nodeName=="TEXTAREA"?rt=!yt.value:Q.lineCount()==1&&(rt=!/[^\u200b]/.test(yt.querySelector(".CodeMirror-line").textContent)),rt?vt(Q):kt(Q)},20)}function ut(Q){Pt(Q)&&vt(Q)}function ft(Q){var rt=Q.getWrapperElement(),yt=Pt(Q);rt.className=rt.className.replace(" CodeMirror-empty","")+(yt?" CodeMirror-empty":""),yt?vt(Q):kt(Q)}function Pt(Q){return Q.lineCount()===1&&Q.getLine(0)===""}})},25717:function(qn,Li,G){(function(Mt){Mt(G(89780))})(function(Mt){var kt={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},vt=Mt.Pos;Mt.defineOption("autoCloseBrackets",!1,function(jt,Jt,Ht){Ht&&Ht!=Mt.Init&&(jt.removeKeyMap(ut),jt.state.closeBrackets=null),Jt&&(ft(le(Jt,"pairs")),jt.state.closeBrackets=Jt,jt.addKeyMap(ut))});function le(jt,Jt){return Jt=="pairs"&&typeof jt=="string"?jt:typeof jt=="object"&&jt[Jt]!=null?jt[Jt]:kt[Jt]}var ut={Backspace:rt,Enter:yt};function ft(jt){for(var Jt=0;Jt<jt.length;Jt++){var Ht=jt.charAt(Jt),de="'"+Ht+"'";ut[de]||(ut[de]=Pt(Ht))}}ft(kt.pairs+"`");function Pt(jt){return function(Jt){return pt(Jt,jt)}}function Q(jt){var Jt=jt.state.closeBrackets;if(!Jt||Jt.override)return Jt;var Ht=jt.getModeAt(jt.getCursor());return Ht.closeBrackets||Jt}function rt(jt){var Jt=Q(jt);if(!Jt||jt.getOption("disableInput"))return Mt.Pass;for(var Ht=le(Jt,"pairs"),de=jt.listSelections(),De=0;De<de.length;De++){if(!de[De].empty())return Mt.Pass;var $t=Rt(jt,de[De].head);if(!$t||Ht.indexOf($t)%2!=0)return Mt.Pass}for(var De=de.length-1;De>=0;De--){var Xt=de[De].head;jt.replaceRange("",vt(Xt.line,Xt.ch-1),vt(Xt.line,Xt.ch+1),"+delete")}}function yt(jt){var Jt=Q(jt),Ht=Jt&&le(Jt,"explode");if(!Ht||jt.getOption("disableInput"))return Mt.Pass;for(var de=jt.listSelections(),De=0;De<de.length;De++){if(!de[De].empty())return Mt.Pass;var $t=Rt(jt,de[De].head);if(!$t||Ht.indexOf($t)%2!=0)return Mt.Pass}jt.operation(function(){var Xt=jt.lineSeparator()||`
`;jt.replaceSelection(Xt+Xt,null),jt.execCommand("goCharLeft"),de=jt.listSelections();for(var Ct=0;Ct<de.length;Ct++){var q=de[Ct].head.line;jt.indentLine(q,null,!0),jt.indentLine(q+1,null,!0)}})}function be(jt){var Jt=Mt.cmpPos(jt.anchor,jt.head)>0;return{anchor:new vt(jt.anchor.line,jt.anchor.ch+(Jt?-1:1)),head:new vt(jt.head.line,jt.head.ch+(Jt?1:-1))}}function pt(jt,Jt){var Ht=Q(jt);if(!Ht||jt.getOption("disableInput"))return Mt.Pass;var de=le(Ht,"pairs"),De=de.indexOf(Jt);if(De==-1)return Mt.Pass;for(var $t=le(Ht,"closeBefore"),Xt=le(Ht,"triples"),Ct=de.charAt(De+1)==Jt,q=jt.listSelections(),Et=De%2==0,Bt,ve=0;ve<q.length;ve++){var Vt=q[ve],We=Vt.head,ee,xe=jt.getRange(We,vt(We.line,We.ch+1));if(Et&&!Vt.empty())ee="surround";else if((Ct||!Et)&&xe==Jt)Ct&&Ce(jt,We)?ee="both":Xt.indexOf(Jt)>=0&&jt.getRange(We,vt(We.line,We.ch+3))==Jt+Jt+Jt?ee="skipThree":ee="skip";else if(Ct&&We.ch>1&&Xt.indexOf(Jt)>=0&&jt.getRange(vt(We.line,We.ch-2),We)==Jt+Jt){if(We.ch>2&&/\bstring/.test(jt.getTokenTypeAt(vt(We.line,We.ch-2))))return Mt.Pass;ee="addFour"}else if(Ct){var Nt=We.ch==0?" ":jt.getRange(vt(We.line,We.ch-1),We);if(!Mt.isWordChar(xe)&&Nt!=Jt&&!Mt.isWordChar(Nt))ee="both";else return Mt.Pass}else if(Et&&(xe.length===0||/\s/.test(xe)||$t.indexOf(xe)>-1))ee="both";else return Mt.Pass;if(!Bt)Bt=ee;else if(Bt!=ee)return Mt.Pass}var _e=De%2?de.charAt(De-1):Jt,ti=De%2?Jt:de.charAt(De+1);jt.operation(function(){if(Bt=="skip")jt.execCommand("goCharRight");else if(Bt=="skipThree")for(var je=0;je<3;je++)jt.execCommand("goCharRight");else if(Bt=="surround"){for(var Be=jt.getSelections(),je=0;je<Be.length;je++)Be[je]=_e+Be[je]+ti;jt.replaceSelections(Be,"around"),Be=jt.listSelections().slice();for(var je=0;je<Be.length;je++)Be[je]=be(Be[je]);jt.setSelections(Be)}else Bt=="both"?(jt.replaceSelection(_e+ti,null),jt.triggerElectric(_e+ti),jt.execCommand("goCharLeft")):Bt=="addFour"&&(jt.replaceSelection(_e+_e+_e+_e,"before"),jt.execCommand("goCharRight"))})}function Rt(jt,Jt){var Ht=jt.getRange(vt(Jt.line,Jt.ch-1),vt(Jt.line,Jt.ch+1));return Ht.length==2?Ht:null}function Ce(jt,Jt){var Ht=jt.getTokenAt(vt(Jt.line,Jt.ch+1));return/\bstring/.test(Ht.type)&&Ht.start==Jt.ch&&(Jt.ch==0||!/\bstring/.test(jt.getTokenTypeAt(Jt)))}})},6313:function(qn,Li,G){(function(Mt){Mt(G(89780),G(52730))})(function(Mt){Mt.defineOption("autoCloseTags",!1,function(rt,yt,be){if(be!=Mt.Init&&be&&rt.removeKeyMap("autoCloseTags"),!!yt){var pt={name:"autoCloseTags"};(typeof yt!="object"||yt.whenClosing!==!1)&&(pt["'/'"]=function(Rt){return ft(Rt)}),(typeof yt!="object"||yt.whenOpening!==!1)&&(pt["'>'"]=function(Rt){return le(Rt)}),rt.addKeyMap(pt)}});var kt=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],vt=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function le(rt){if(rt.getOption("disableInput"))return Mt.Pass;for(var yt=rt.listSelections(),be=[],pt=rt.getOption("autoCloseTags"),Rt=0;Rt<yt.length;Rt++){if(!yt[Rt].empty())return Mt.Pass;var Ce=yt[Rt].head,jt=rt.getTokenAt(Ce),Jt=Mt.innerMode(rt.getMode(),jt.state),Ht=Jt.state,de=Jt.mode.xmlCurrentTag&&Jt.mode.xmlCurrentTag(Ht),De=de&&de.name;if(!De)return Mt.Pass;var $t=Jt.mode.configuration=="html",Xt=typeof pt=="object"&&pt.dontCloseTags||$t&&kt,Ct=typeof pt=="object"&&pt.indentTags||$t&&vt;jt.end>Ce.ch&&(De=De.slice(0,De.length-jt.end+Ce.ch));var q=De.toLowerCase();if(!De||jt.type=="string"&&(jt.end!=Ce.ch||!/[\"\']/.test(jt.string.charAt(jt.string.length-1))||jt.string.length==1)||jt.type=="tag"&&de.close||jt.string.indexOf("/")==Ce.ch-jt.start-1||Xt&&Pt(Xt,q)>-1||Q(rt,Jt.mode.xmlCurrentContext&&Jt.mode.xmlCurrentContext(Ht)||[],De,Ce,!0))return Mt.Pass;var Et=typeof pt=="object"&&pt.emptyTags;if(Et&&Pt(Et,De)>-1){be[Rt]={text:"/>",newPos:Mt.Pos(Ce.line,Ce.ch+2)};continue}var Bt=Ct&&Pt(Ct,q)>-1;be[Rt]={indent:Bt,text:">"+(Bt?`
`:"")+"</"+De+">",newPos:Bt?Mt.Pos(Ce.line+1,0):Mt.Pos(Ce.line,Ce.ch+1)}}for(var ve=typeof pt=="object"&&pt.dontIndentOnAutoClose,Rt=yt.length-1;Rt>=0;Rt--){var Vt=be[Rt];rt.replaceRange(Vt.text,yt[Rt].head,yt[Rt].anchor,"+insert");var We=rt.listSelections().slice(0);We[Rt]={head:Vt.newPos,anchor:Vt.newPos},rt.setSelections(We),!ve&&Vt.indent&&(rt.indentLine(Vt.newPos.line,null,!0),rt.indentLine(Vt.newPos.line+1,null,!0))}}function ut(rt,yt){for(var be=rt.listSelections(),pt=[],Rt=yt?"/":"</",Ce=rt.getOption("autoCloseTags"),jt=typeof Ce=="object"&&Ce.dontIndentOnSlash,Jt=0;Jt<be.length;Jt++){if(!be[Jt].empty())return Mt.Pass;var Ht=be[Jt].head,de=rt.getTokenAt(Ht),De=Mt.innerMode(rt.getMode(),de.state),$t=De.state;if(yt&&(de.type=="string"||de.string.charAt(0)!="<"||de.start!=Ht.ch-1))return Mt.Pass;var Xt,Ct=De.mode.name!="xml"&&rt.getMode().name=="htmlmixed";if(Ct&&De.mode.name=="javascript")Xt=Rt+"script";else if(Ct&&De.mode.name=="css")Xt=Rt+"style";else{var q=De.mode.xmlCurrentContext&&De.mode.xmlCurrentContext($t);if(!q||q.length&&Q(rt,q,q[q.length-1],Ht))return Mt.Pass;Xt=Rt+q[q.length-1]}rt.getLine(Ht.line).charAt(de.end)!=">"&&(Xt+=">"),pt[Jt]=Xt}if(rt.replaceSelections(pt),be=rt.listSelections(),!jt)for(var Jt=0;Jt<be.length;Jt++)(Jt==be.length-1||be[Jt].head.line<be[Jt+1].head.line)&&rt.indentLine(be[Jt].head.line)}function ft(rt){return rt.getOption("disableInput")?Mt.Pass:ut(rt,!0)}Mt.commands.closeTag=function(rt){return ut(rt)};function Pt(rt,yt){if(rt.indexOf)return rt.indexOf(yt);for(var be=0,pt=rt.length;be<pt;++be)if(rt[be]==yt)return be;return-1}function Q(rt,yt,be,pt,Rt){if(!Mt.scanForClosingTag)return!1;var Ce=Math.min(rt.lastLine()+1,pt.line+500),jt=Mt.scanForClosingTag(rt,pt,null,Ce);if(!jt||jt.tag!=be)return!1;for(var Jt=Rt?1:0,Ht=yt.length-1;Ht>=0&&yt[Ht]==be;Ht--)++Jt;pt=jt.to;for(var Ht=1;Ht<Jt;Ht++){var de=Mt.scanForClosingTag(rt,pt,null,Ce);if(!de||de.tag!=be)return!1;pt=de.to}return!0}})},52730:function(qn,Li,G){(function(Mt){Mt(G(89780))})(function(Mt){"use strict";var kt=Mt.Pos;function vt(Ht,de){return Ht.line-de.line||Ht.ch-de.ch}var le="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",ut=le+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",ft=new RegExp("<(/?)(["+le+"]["+ut+"]*)","g");function Pt(Ht,de,De,$t){this.line=de,this.ch=De,this.cm=Ht,this.text=Ht.getLine(de),this.min=$t?Math.max($t.from,Ht.firstLine()):Ht.firstLine(),this.max=$t?Math.min($t.to-1,Ht.lastLine()):Ht.lastLine()}function Q(Ht,de){var De=Ht.cm.getTokenTypeAt(kt(Ht.line,de));return De&&/\btag\b/.test(De)}function rt(Ht){if(!(Ht.line>=Ht.max))return Ht.ch=0,Ht.text=Ht.cm.getLine(++Ht.line),!0}function yt(Ht){if(!(Ht.line<=Ht.min))return Ht.text=Ht.cm.getLine(--Ht.line),Ht.ch=Ht.text.length,!0}function be(Ht){for(;;){var de=Ht.text.indexOf(">",Ht.ch);if(de==-1){if(rt(Ht))continue;return}if(!Q(Ht,de+1)){Ht.ch=de+1;continue}var De=Ht.text.lastIndexOf("/",de),$t=De>-1&&!/\S/.test(Ht.text.slice(De+1,de));return Ht.ch=de+1,$t?"selfClose":"regular"}}function pt(Ht){for(;;){var de=Ht.ch?Ht.text.lastIndexOf("<",Ht.ch-1):-1;if(de==-1){if(yt(Ht))continue;return}if(!Q(Ht,de+1)){Ht.ch=de;continue}ft.lastIndex=de,Ht.ch=de;var De=ft.exec(Ht.text);if(De&&De.index==de)return De}}function Rt(Ht){for(;;){ft.lastIndex=Ht.ch;var de=ft.exec(Ht.text);if(!de){if(rt(Ht))continue;return}if(!Q(Ht,de.index+1)){Ht.ch=de.index+1;continue}return Ht.ch=de.index+de[0].length,de}}function Ce(Ht){for(;;){var de=Ht.ch?Ht.text.lastIndexOf(">",Ht.ch-1):-1;if(de==-1){if(yt(Ht))continue;return}if(!Q(Ht,de+1)){Ht.ch=de;continue}var De=Ht.text.lastIndexOf("/",de),$t=De>-1&&!/\S/.test(Ht.text.slice(De+1,de));return Ht.ch=de+1,$t?"selfClose":"regular"}}function jt(Ht,de){for(var De=[];;){var $t=Rt(Ht),Xt,Ct=Ht.line,q=Ht.ch-($t?$t[0].length:0);if(!$t||!(Xt=be(Ht)))return;if(Xt!="selfClose")if($t[1]){for(var Et=De.length-1;Et>=0;--Et)if(De[Et]==$t[2]){De.length=Et;break}if(Et<0&&(!de||de==$t[2]))return{tag:$t[2],from:kt(Ct,q),to:kt(Ht.line,Ht.ch)}}else De.push($t[2])}}function Jt(Ht,de){for(var De=[];;){var $t=Ce(Ht);if(!$t)return;if($t=="selfClose"){pt(Ht);continue}var Xt=Ht.line,Ct=Ht.ch,q=pt(Ht);if(!q)return;if(q[1])De.push(q[2]);else{for(var Et=De.length-1;Et>=0;--Et)if(De[Et]==q[2]){De.length=Et;break}if(Et<0&&(!de||de==q[2]))return{tag:q[2],from:kt(Ht.line,Ht.ch),to:kt(Xt,Ct)}}}}Mt.registerHelper("fold","xml",function(Ht,de){for(var De=new Pt(Ht,de.line,0);;){var $t=Rt(De);if(!$t||De.line!=de.line)return;var Xt=be(De);if(!Xt)return;if(!$t[1]&&Xt!="selfClose"){var Ct=kt(De.line,De.ch),q=jt(De,$t[2]);return q&&vt(q.from,Ct)>0?{from:Ct,to:q.from}:null}}}),Mt.findMatchingTag=function(Ht,de,De){var $t=new Pt(Ht,de.line,de.ch,De);if(!($t.text.indexOf(">")==-1&&$t.text.indexOf("<")==-1)){var Xt=be($t),Ct=Xt&&kt($t.line,$t.ch),q=Xt&&pt($t);if(!(!Xt||!q||vt($t,de)>0)){var Et={from:kt($t.line,$t.ch),to:Ct,tag:q[2]};return Xt=="selfClose"?{open:Et,close:null,at:"open"}:q[1]?{open:Jt($t,q[2]),close:Et,at:"close"}:($t=new Pt(Ht,Ct.line,Ct.ch,De),{open:Et,close:jt($t,q[2]),at:"open"})}}},Mt.findEnclosingTag=function(Ht,de,De,$t){for(var Xt=new Pt(Ht,de.line,de.ch,De);;){var Ct=Jt(Xt,$t);if(!Ct)break;var q=new Pt(Ht,de.line,de.ch,De),Et=jt(q,Ct.tag);if(Et)return{open:Ct,close:Et}}},Mt.scanForClosingTag=function(Ht,de,De,$t){var Xt=new Pt(Ht,de.line,de.ch,$t?{from:0,to:$t}:null);return jt(Xt,De)}})},89780:function(qn){(function(Li,G){qn.exports=G()})(this,function(){"use strict";var Li=navigator.userAgent,G=navigator.platform,Mt=/gecko\/\d/i.test(Li),kt=/MSIE \d/.test(Li),vt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Li),le=/Edge\/(\d+)/.exec(Li),ut=kt||vt||le,ft=ut&&(kt?document.documentMode||6:+(le||vt)[1]),Pt=!le&&/WebKit\//.test(Li),Q=Pt&&/Qt\/\d+\.\d+/.test(Li),rt=!le&&/Chrome\//.test(Li),yt=/Opera\//.test(Li),be=/Apple Computer/.test(navigator.vendor),pt=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Li),Rt=/PhantomJS/.test(Li),Ce=!le&&/AppleWebKit/.test(Li)&&/Mobile\/\w+/.test(Li),jt=/Android/.test(Li),Jt=Ce||jt||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Li),Ht=Ce||/Mac/.test(G),de=/\bCrOS\b/.test(Li),De=/win/i.test(G),$t=yt&&Li.match(/Version\/(\d*\.\d*)/);$t&&($t=Number($t[1])),$t&&$t>=15&&(yt=!1,Pt=!0);var Xt=Ht&&(Q||yt&&($t==null||$t<12.11)),Ct=Mt||ut&&ft>=9;function q(h){return new RegExp("(^|\\s)"+h+"(?:$|\\s)\\s*")}var Et=function(h,p){var x=h.className,y=q(p).exec(x);if(y){var S=x.slice(y.index+y[0].length);h.className=x.slice(0,y.index)+(S?y[1]+S:"")}};function Bt(h){for(var p=h.childNodes.length;p>0;--p)h.removeChild(h.firstChild);return h}function ve(h,p){return Bt(h).appendChild(p)}function Vt(h,p,x,y){var S=document.createElement(h);if(x&&(S.className=x),y&&(S.style.cssText=y),typeof p=="string")S.appendChild(document.createTextNode(p));else if(p)for(var _=0;_<p.length;++_)S.appendChild(p[_]);return S}function We(h,p,x,y){var S=Vt(h,p,x,y);return S.setAttribute("role","presentation"),S}var ee;document.createRange?ee=function(h,p,x,y){var S=document.createRange();return S.setEnd(y||h,x),S.setStart(h,p),S}:ee=function(h,p,x){var y=document.body.createTextRange();try{y.moveToElementText(h.parentNode)}catch(S){return y}return y.collapse(!0),y.moveEnd("character",x),y.moveStart("character",p),y};function xe(h,p){if(p.nodeType==3&&(p=p.parentNode),h.contains)return h.contains(p);do if(p.nodeType==11&&(p=p.host),p==h)return!0;while(p=p.parentNode)}function Nt(){var h;try{h=document.activeElement}catch(p){h=document.body||null}for(;h&&h.shadowRoot&&h.shadowRoot.activeElement;)h=h.shadowRoot.activeElement;return h}function _e(h,p){var x=h.className;q(p).test(x)||(h.className+=(x?" ":"")+p)}function ti(h,p){for(var x=h.split(" "),y=0;y<x.length;y++)x[y]&&!q(x[y]).test(p)&&(p+=" "+x[y]);return p}var je=function(h){h.select()};Ce?je=function(h){h.selectionStart=0,h.selectionEnd=h.value.length}:ut&&(je=function(h){try{h.select()}catch(p){}});function Be(h){var p=Array.prototype.slice.call(arguments,1);return function(){return h.apply(null,p)}}function Se(h,p,x){p||(p={});for(var y in h)h.hasOwnProperty(y)&&(x!==!1||!p.hasOwnProperty(y))&&(p[y]=h[y]);return p}function dt(h,p,x,y,S){p==null&&(p=h.search(/[^\s\u00a0]/),p==-1&&(p=h.length));for(var _=y||0,O=S||0;;){var V=h.indexOf(" ",_);if(V<0||V>=p)return O+(p-_);O+=V-_,O+=x-O%x,_=V+1}}var W=function(){this.id=null,this.f=null,this.time=0,this.handler=Be(this.onTimeout,this)};W.prototype.onTimeout=function(h){h.id=0,h.time<=+new Date?h.f():setTimeout(h.handler,h.time-+new Date)},W.prototype.set=function(h,p){this.f=p;var x=+new Date+h;(!this.id||x<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,h),this.time=x)};function Zt(h,p){for(var x=0;x<h.length;++x)if(h[x]==p)return x;return-1}var ze=50,Me={toString:function(){return"CodeMirror.Pass"}},ye={scroll:!1},se={origin:"*mouse"},Ue={origin:"+move"};function Fi(h,p,x){for(var y=0,S=0;;){var _=h.indexOf(" ",y);_==-1&&(_=h.length);var O=_-y;if(_==h.length||S+O>=p)return y+Math.min(O,p-S);if(S+=_-y,S+=x-S%x,y=_+1,S>=p)return y}}var wi=[""];function Ai(h){for(;wi.length<=h;)wi.push(ri(wi)+" ");return wi[h]}function ri(h){return h[h.length-1]}function sn(h,p){for(var x=[],y=0;y<h.length;y++)x[y]=p(h[y],y);return x}function Zi(h,p,x){for(var y=0,S=x(p);y<h.length&&x(h[y])<=S;)y++;h.splice(y,0,p)}function j(){}function P(h,p){var x;return Object.create?x=Object.create(h):(j.prototype=h,x=new j),p&&Se(p,x),x}var E=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function B(h){return/\w/.test(h)||h>"\x80"&&(h.toUpperCase()!=h.toLowerCase()||E.test(h))}function U(h,p){return p?p.source.indexOf("\\w")>-1&&B(h)?!0:p.test(h):B(h)}function D(h){for(var p in h)if(h.hasOwnProperty(p)&&h[p])return!1;return!0}var St=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ae(h){return h.charCodeAt(0)>=768&&St.test(h)}function $e(h,p,x){for(;(x<0?p>0:p<h.length)&&ae(h.charAt(p));)p+=x;return p}function Ae(h,p,x){for(var y=p>x?-1:1;;){if(p==x)return p;var S=(p+x)/2,_=y<0?Math.ceil(S):Math.floor(S);if(_==p)return h(_)?p:x;h(_)?x=_:p=_+y}}function Qe(h,p,x,y){if(!h)return y(p,x,"ltr",0);for(var S=!1,_=0;_<h.length;++_){var O=h[_];(O.from<x&&O.to>p||p==x&&O.to==p)&&(y(Math.max(O.from,p),Math.min(O.to,x),O.level==1?"rtl":"ltr",_),S=!0)}S||y(p,x,"ltr")}var He=null;function Si(h,p,x){var y;He=null;for(var S=0;S<h.length;++S){var _=h[S];if(_.from<p&&_.to>p)return S;_.to==p&&(_.from!=_.to&&x=="before"?y=S:He=S),_.from==p&&(_.from!=_.to&&x!="before"?y=S:He=S)}return y!=null?y:He}var Ei=function(){var h="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",p="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function x(et){return et<=247?h.charAt(et):1424<=et&&et<=1524?"R":1536<=et&&et<=1785?p.charAt(et-1536):1774<=et&&et<=2220?"r":8192<=et&&et<=8203?"w":et==8204?"b":"L"}var y=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,S=/[stwN]/,_=/[LRr]/,O=/[Lb1n]/,V=/[1n]/;function K(et,Lt,at){this.level=et,this.from=Lt,this.to=at}return function(et,Lt){var at=Lt=="ltr"?"L":"R";if(et.length==0||Lt=="ltr"&&!y.test(et))return!1;for(var ie=et.length,Yt=[],Ge=0;Ge<ie;++Ge)Yt.push(x(et.charCodeAt(Ge)));for(var si=0,yi=at;si<ie;++si){var Vi=Yt[si];Vi=="m"?Yt[si]=yi:yi=Vi}for(var un=0,qi=at;un<ie;++un){var dn=Yt[un];dn=="1"&&qi=="r"?Yt[un]="n":_.test(dn)&&(qi=dn,dn=="r"&&(Yt[un]="R"))}for(var Dn=1,en=Yt[0];Dn<ie-1;++Dn){var lr=Yt[Dn];lr=="+"&&en=="1"&&Yt[Dn+1]=="1"?Yt[Dn]="1":lr==","&&en==Yt[Dn+1]&&(en=="1"||en=="n")&&(Yt[Dn]=en),en=lr}for(var To=0;To<ie;++To){var Ws=Yt[To];if(Ws==",")Yt[To]="N";else if(Ws=="%"){var qo=void 0;for(qo=To+1;qo<ie&&Yt[qo]=="%";++qo);for(var za=To&&Yt[To-1]=="!"||qo<ie&&Yt[qo]=="1"?"1":"N",ka=To;ka<qo;++ka)Yt[ka]=za;To=qo-1}}for(var Os=0,dl=at;Os<ie;++Os){var rr=Yt[Os];dl=="L"&&rr=="1"?Yt[Os]="L":_.test(rr)&&(dl=rr)}for(var gs=0;gs<ie;++gs)if(S.test(Yt[gs])){var Br=void 0;for(Br=gs+1;Br<ie&&S.test(Yt[Br]);++Br);for(var ss=(gs?Yt[gs-1]:at)=="L",Qo=(Br<ie?Yt[Br]:at)=="L",Qs=ss==Qo?ss?"L":"R":at,La=gs;La<Br;++La)Yt[La]=Qs;gs=Br-1}for(var Wo=[],Kr,as=0;as<ie;)if(O.test(Yt[as])){var $d=as;for(++as;as<ie&&O.test(Yt[as]);++as);Wo.push(new K(0,$d,as))}else{var _l=as,Ja=Wo.length,ha=Lt=="rtl"?1:0;for(++as;as<ie&&Yt[as]!="L";++as);for(var Hr=_l;Hr<as;)if(V.test(Yt[Hr])){_l<Hr&&(Wo.splice(Ja,0,new K(1,_l,Hr)),Ja+=ha);var Us=Hr;for(++Hr;Hr<as&&V.test(Yt[Hr]);++Hr);Wo.splice(Ja,0,new K(2,Us,Hr)),Ja+=ha,_l=Hr}else++Hr;_l<as&&Wo.splice(Ja,0,new K(1,_l,as))}return Lt=="ltr"&&(Wo[0].level==1&&(Kr=et.match(/^\s+/))&&(Wo[0].from=Kr[0].length,Wo.unshift(new K(0,0,Kr[0].length))),ri(Wo).level==1&&(Kr=et.match(/\s+$/))&&(ri(Wo).to-=Kr[0].length,Wo.push(new K(0,ie-Kr[0].length,ie)))),Lt=="rtl"?Wo.reverse():Wo}}();function Ci(h,p){var x=h.order;return x==null&&(x=h.order=Ei(h.text,p)),x}var qt=[],ei=function(h,p,x){if(h.addEventListener)h.addEventListener(p,x,!1);else if(h.attachEvent)h.attachEvent("on"+p,x);else{var y=h._handlers||(h._handlers={});y[p]=(y[p]||qt).concat(x)}};function ln(h,p){return h._handlers&&h._handlers[p]||qt}function Ft(h,p,x){if(h.removeEventListener)h.removeEventListener(p,x,!1);else if(h.detachEvent)h.detachEvent("on"+p,x);else{var y=h._handlers,S=y&&y[p];if(S){var _=Zt(S,x);_>-1&&(y[p]=S.slice(0,_).concat(S.slice(_+1)))}}}function oe(h,p){var x=ln(h,p);if(x.length)for(var y=Array.prototype.slice.call(arguments,2),S=0;S<x.length;++S)x[S].apply(null,y)}function we(h,p,x){return typeof p=="string"&&(p={type:p,preventDefault:function(){this.defaultPrevented=!0}}),oe(h,x||p.type,h,p),Ln(p)||p.codemirrorIgnore}function Ii(h){var p=h._handlers&&h._handlers.cursorActivity;if(p)for(var x=h.curOp.cursorActivityHandlers||(h.curOp.cursorActivityHandlers=[]),y=0;y<p.length;++y)Zt(x,p[y])==-1&&x.push(p[y])}function Pi(h,p){return ln(h,p).length>0}function _i(h){h.prototype.on=function(p,x){ei(this,p,x)},h.prototype.off=function(p,x){Ft(this,p,x)}}function hn(h){h.preventDefault?h.preventDefault():h.returnValue=!1}function mn(h){h.stopPropagation?h.stopPropagation():h.cancelBubble=!0}function Ln(h){return h.defaultPrevented!=null?h.defaultPrevented:h.returnValue==!1}function jn(h){hn(h),mn(h)}function On(h){return h.target||h.srcElement}function rn(h){var p=h.which;return p==null&&(h.button&1?p=1:h.button&2?p=3:h.button&4&&(p=2)),Ht&&h.ctrlKey&&p==1&&(p=3),p}var ir=function(){if(ut&&ft<9)return!1;var h=Vt("div");return"draggable"in h||"dragDrop"in h}(),tr;function hr(h){if(tr==null){var p=Vt("span","\u200B");ve(h,Vt("span",[p,document.createTextNode("x")])),h.firstChild.offsetHeight!=0&&(tr=p.offsetWidth<=1&&p.offsetHeight>2&&!(ut&&ft<8))}var x=tr?Vt("span","\u200B"):Vt("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return x.setAttribute("cm-text",""),x}var Er;function Hn(h){if(Er!=null)return Er;var p=ve(h,document.createTextNode("A\u062EA")),x=ee(p,0,1).getBoundingClientRect(),y=ee(p,1,2).getBoundingClientRect();return Bt(h),!x||x.left==x.right?!1:Er=y.right-x.right<3}var Ir=`
b`.split(/\n/).length!=3?function(h){for(var p=0,x=[],y=h.length;p<=y;){var S=h.indexOf(`
`,p);S==-1&&(S=h.length);var _=h.slice(p,h.charAt(S-1)=="\r"?S-1:S),O=_.indexOf("\r");O!=-1?(x.push(_.slice(0,O)),p+=O+1):(x.push(_),p=S+1)}return x}:function(h){return h.split(/\r\n?|\n/)},T=window.getSelection?function(h){try{return h.selectionStart!=h.selectionEnd}catch(p){return!1}}:function(h){var p;try{p=h.ownerDocument.selection.createRange()}catch(x){}return!p||p.parentElement()!=h?!1:p.compareEndPoints("StartToEnd",p)!=0},ur=function(){var h=Vt("div");return"oncopy"in h?!0:(h.setAttribute("oncopy","return;"),typeof h.oncopy=="function")}(),$n=null;function Yn(h){if($n!=null)return $n;var p=ve(h,Vt("span","x")),x=p.getBoundingClientRect(),y=ee(p,0,1).getBoundingClientRect();return $n=Math.abs(x.left-y.left)>1}var Nr={},Gn={};function uo(h,p){arguments.length>2&&(p.dependencies=Array.prototype.slice.call(arguments,2)),Nr[h]=p}function zo(h,p){Gn[h]=p}function gr(h){if(typeof h=="string"&&Gn.hasOwnProperty(h))h=Gn[h];else if(h&&typeof h.name=="string"&&Gn.hasOwnProperty(h.name)){var p=Gn[h.name];typeof p=="string"&&(p={name:p}),h=P(p,h),h.name=p.name}else{if(typeof h=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(h))return gr("application/xml");if(typeof h=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(h))return gr("application/json")}return typeof h=="string"?{name:h}:h||{name:"null"}}function pn(h,p){p=gr(p);var x=Nr[p.name];if(!x)return pn(h,"text/plain");var y=x(h,p);if(gi.hasOwnProperty(p.name)){var S=gi[p.name];for(var _ in S)S.hasOwnProperty(_)&&(y.hasOwnProperty(_)&&(y["_"+_]=y[_]),y[_]=S[_])}if(y.name=p.name,p.helperType&&(y.helperType=p.helperType),p.modeProps)for(var O in p.modeProps)y[O]=p.modeProps[O];return y}var gi={};function ct(h,p){var x=gi.hasOwnProperty(h)?gi[h]:gi[h]={};Se(p,x)}function J(h,p){if(p===!0)return p;if(h.copyState)return h.copyState(p);var x={};for(var y in p){var S=p[y];S instanceof Array&&(S=S.concat([])),x[y]=S}return x}function ot(h,p){for(var x;h.innerMode&&(x=h.innerMode(p),!(!x||x.mode==h));)p=x.state,h=x.mode;return x||{mode:h,state:p}}function nt(h,p,x){return h.startState?h.startState(p,x):!0}var Z=function(h,p,x){this.pos=this.start=0,this.string=h,this.tabSize=p||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=x};Z.prototype.eol=function(){return this.pos>=this.string.length},Z.prototype.sol=function(){return this.pos==this.lineStart},Z.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Z.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Z.prototype.eat=function(h){var p=this.string.charAt(this.pos),x;if(typeof h=="string"?x=p==h:x=p&&(h.test?h.test(p):h(p)),x)return++this.pos,p},Z.prototype.eatWhile=function(h){for(var p=this.pos;this.eat(h););return this.pos>p},Z.prototype.eatSpace=function(){for(var h=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>h},Z.prototype.skipToEnd=function(){this.pos=this.string.length},Z.prototype.skipTo=function(h){var p=this.string.indexOf(h,this.pos);if(p>-1)return this.pos=p,!0},Z.prototype.backUp=function(h){this.pos-=h},Z.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=dt(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?dt(this.string,this.lineStart,this.tabSize):0)},Z.prototype.indentation=function(){return dt(this.string,null,this.tabSize)-(this.lineStart?dt(this.string,this.lineStart,this.tabSize):0)},Z.prototype.match=function(h,p,x){if(typeof h=="string"){var y=function(O){return x?O.toLowerCase():O},S=this.string.substr(this.pos,h.length);if(y(S)==y(h))return p!==!1&&(this.pos+=h.length),!0}else{var _=this.string.slice(this.pos).match(h);return _&&_.index>0?null:(_&&p!==!1&&(this.pos+=_[0].length),_)}},Z.prototype.current=function(){return this.string.slice(this.start,this.pos)},Z.prototype.hideFirstChars=function(h,p){this.lineStart+=h;try{return p()}finally{this.lineStart-=h}},Z.prototype.lookAhead=function(h){var p=this.lineOracle;return p&&p.lookAhead(h)},Z.prototype.baseToken=function(){var h=this.lineOracle;return h&&h.baseToken(this.pos)};function xt(h,p){if(p-=h.first,p<0||p>=h.size)throw new Error("There is no line "+(p+h.first)+" in the document.");for(var x=h;!x.lines;)for(var y=0;;++y){var S=x.children[y],_=S.chunkSize();if(p<_){x=S;break}p-=_}return x.lines[p]}function Ot(h,p,x){var y=[],S=p.line;return h.iter(p.line,x.line+1,function(_){var O=_.text;S==x.line&&(O=O.slice(0,x.ch)),S==p.line&&(O=O.slice(p.ch)),y.push(O),++S}),y}function ge(h,p,x){var y=[];return h.iter(p,x,function(S){y.push(S.text)}),y}function te(h,p){var x=p-h.height;if(x)for(var y=h;y;y=y.parent)y.height+=x}function lt(h){if(h.parent==null)return null;for(var p=h.parent,x=Zt(p.lines,h),y=p.parent;y;p=y,y=y.parent)for(var S=0;y.children[S]!=p;++S)x+=y.children[S].chunkSize();return x+p.first}function Qt(h,p){var x=h.first;t:do{for(var y=0;y<h.children.length;++y){var S=h.children[y],_=S.height;if(p<_){h=S;continue t}p-=_,x+=S.chunkSize()}return x}while(!h.lines);for(var O=0;O<h.lines.length;++O){var V=h.lines[O],K=V.height;if(p<K)break;p-=K}return x+O}function me(h,p){return p>=h.first&&p<h.first+h.size}function Fe(h,p){return String(h.lineNumberFormatter(p+h.firstLineNumber))}function Tt(h,p,x){if(x===void 0&&(x=null),!(this instanceof Tt))return new Tt(h,p,x);this.line=h,this.ch=p,this.sticky=x}function ce(h,p){return h.line-p.line||h.ch-p.ch}function bi(h,p){return h.sticky==p.sticky&&ce(h,p)==0}function li(h){return Tt(h.line,h.ch)}function Mi(h,p){return ce(h,p)<0?p:h}function Pe(h,p){return ce(h,p)<0?h:p}function qe(h,p){return Math.max(h.first,Math.min(p,h.first+h.size-1))}function Re(h,p){if(p.line<h.first)return Tt(h.first,0);var x=h.first+h.size-1;return p.line>x?Tt(x,xt(h,x).text.length):ni(p,xt(h,p.line).text.length)}function ni(h,p){var x=h.ch;return x==null||x>p?Tt(h.line,p):x<0?Tt(h.line,0):h}function Ut(h,p){for(var x=[],y=0;y<p.length;y++)x[y]=Re(h,p[y]);return x}var Wt=function(h,p){this.state=h,this.lookAhead=p},Dt=function(h,p,x,y){this.state=p,this.doc=h,this.line=x,this.maxLookAhead=y||0,this.baseTokens=null,this.baseTokenPos=1};Dt.prototype.lookAhead=function(h){var p=this.doc.getLine(this.line+h);return p!=null&&h>this.maxLookAhead&&(this.maxLookAhead=h),p},Dt.prototype.baseToken=function(h){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=h;)this.baseTokenPos+=2;var p=this.baseTokens[this.baseTokenPos+1];return{type:p&&p.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-h}},Dt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Dt.fromSaved=function(h,p,x){return p instanceof Wt?new Dt(h,J(h.mode,p.state),x,p.lookAhead):new Dt(h,J(h.mode,p),x)},Dt.prototype.save=function(h){var p=h!==!1?J(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Wt(p,this.maxLookAhead):p};function ke(h,p,x,y){var S=[h.state.modeGen],_={};Gi(h,p.text,h.doc.mode,x,function(et,Lt){return S.push(et,Lt)},_,y);for(var O=x.state,V=function(et){x.baseTokens=S;var Lt=h.state.overlays[et],at=1,ie=0;x.state=!0,Gi(h,p.text,Lt.mode,x,function(Yt,Ge){for(var si=at;ie<Yt;){var yi=S[at];yi>Yt&&S.splice(at,1,Yt,S[at+1],yi),at+=2,ie=Math.min(Yt,yi)}if(Ge)if(Lt.opaque)S.splice(si,at-si,Yt,"overlay "+Ge),at=si+2;else for(;si<at;si+=2){var Vi=S[si+1];S[si+1]=(Vi?Vi+" ":"")+"overlay "+Ge}},_),x.state=O,x.baseTokens=null,x.baseTokenPos=1},K=0;K<h.state.overlays.length;++K)V(K);return{styles:S,classes:_.bgClass||_.textClass?_:null}}function re(h,p,x){if(!p.styles||p.styles[0]!=h.state.modeGen){var y=Ie(h,lt(p)),S=p.text.length>h.options.maxHighlightLength&&J(h.doc.mode,y.state),_=ke(h,p,y);S&&(y.state=S),p.stateAfter=y.save(!S),p.styles=_.styles,_.classes?p.styleClasses=_.classes:p.styleClasses&&(p.styleClasses=null),x===h.doc.highlightFrontier&&(h.doc.modeFrontier=Math.max(h.doc.modeFrontier,++h.doc.highlightFrontier))}return p.styles}function Ie(h,p,x){var y=h.doc,S=h.display;if(!y.mode.startState)return new Dt(y,!0,p);var _=ki(h,p,x),O=_>y.first&&xt(y,_-1).stateAfter,V=O?Dt.fromSaved(y,O,_):new Dt(y,nt(y.mode),_);return y.iter(_,p,function(K){mt(h,K.text,V);var et=V.line;K.stateAfter=et==p-1||et%5==0||et>=S.viewFrom&&et<S.viewTo?V.save():null,V.nextLine()}),x&&(y.modeFrontier=V.line),V}function mt(h,p,x,y){var S=h.doc.mode,_=new Z(p,h.options.tabSize,x);for(_.start=_.pos=y||0,p==""&&Xe(S,x.state);!_.eol();)pi(S,_,x.state),_.start=_.pos}function Xe(h,p){if(h.blankLine)return h.blankLine(p);if(h.innerMode){var x=ot(h,p);if(x.mode.blankLine)return x.mode.blankLine(x.state)}}function pi(h,p,x,y){for(var S=0;S<10;S++){y&&(y[0]=ot(h,x).mode);var _=h.token(p,x);if(p.pos>p.start)return _}throw new Error("Mode "+h.name+" failed to advance stream.")}var ci=function(h,p,x){this.start=h.start,this.end=h.pos,this.string=h.current(),this.type=p||null,this.state=x};function Ui(h,p,x,y){var S=h.doc,_=S.mode,O;p=Re(S,p);var V=xt(S,p.line),K=Ie(h,p.line,x),et=new Z(V.text,h.options.tabSize,K),Lt;for(y&&(Lt=[]);(y||et.pos<p.ch)&&!et.eol();)et.start=et.pos,O=pi(_,et,K.state),y&&Lt.push(new ci(et,O,J(S.mode,K.state)));return y?Lt:new ci(et,O,K.state)}function Ni(h,p){if(h)for(;;){var x=h.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!x)break;h=h.slice(0,x.index)+h.slice(x.index+x[0].length);var y=x[1]?"bgClass":"textClass";p[y]==null?p[y]=x[2]:new RegExp("(?:^|\\s)"+x[2]+"(?:$|\\s)").test(p[y])||(p[y]+=" "+x[2])}return h}function Gi(h,p,x,y,S,_,O){var V=x.flattenSpans;V==null&&(V=h.options.flattenSpans);var K=0,et=null,Lt=new Z(p,h.options.tabSize,y),at,ie=h.options.addModeClass&&[null];for(p==""&&Ni(Xe(x,y.state),_);!Lt.eol();){if(Lt.pos>h.options.maxHighlightLength?(V=!1,O&&mt(h,p,y,Lt.pos),Lt.pos=p.length,at=null):at=Ni(pi(x,Lt,y.state,ie),_),ie){var Yt=ie[0].name;Yt&&(at="m-"+(at?Yt+" "+at:Yt))}if(!V||et!=at){for(;K<Lt.start;)K=Math.min(Lt.start,K+5e3),S(K,et);et=at}Lt.start=Lt.pos}for(;K<Lt.pos;){var Ge=Math.min(Lt.pos,K+5e3);S(Ge,et),K=Ge}}function ki(h,p,x){for(var y,S,_=h.doc,O=x?-1:p-(h.doc.mode.innerMode?1e3:100),V=p;V>O;--V){if(V<=_.first)return _.first;var K=xt(_,V-1),et=K.stateAfter;if(et&&(!x||V+(et instanceof Wt?et.lookAhead:0)<=_.modeFrontier))return V;var Lt=dt(K.text,null,h.options.tabSize);(S==null||y>Lt)&&(S=V-1,y=Lt)}return S}function di(h,p){if(h.modeFrontier=Math.min(h.modeFrontier,p),!(h.highlightFrontier<p-10)){for(var x=h.first,y=p-1;y>x;y--){var S=xt(h,y).stateAfter;if(S&&(!(S instanceof Wt)||y+S.lookAhead<p)){x=y+1;break}}h.highlightFrontier=Math.min(h.highlightFrontier,x)}}var Ki=!1,Kt=!1;function Ri(){Ki=!0}function At(){Kt=!0}function vi(h,p,x){this.marker=h,this.from=p,this.to=x}function Qi(h,p){if(h)for(var x=0;x<h.length;++x){var y=h[x];if(y.marker==p)return y}}function Ti(h,p){for(var x,y=0;y<h.length;++y)h[y]!=p&&(x||(x=[])).push(h[y]);return x}function gn(h,p){h.markedSpans=h.markedSpans?h.markedSpans.concat([p]):[p],p.marker.attachLine(h)}function Mn(h,p,x){var y;if(h)for(var S=0;S<h.length;++S){var _=h[S],O=_.marker,V=_.from==null||(O.inclusiveLeft?_.from<=p:_.from<p);if(V||_.from==p&&O.type=="bookmark"&&(!x||!_.marker.insertLeft)){var K=_.to==null||(O.inclusiveRight?_.to>=p:_.to>p);(y||(y=[])).push(new vi(O,_.from,K?null:_.to))}}return y}function mi(h,p,x){var y;if(h)for(var S=0;S<h.length;++S){var _=h[S],O=_.marker,V=_.to==null||(O.inclusiveRight?_.to>=p:_.to>p);if(V||_.from==p&&O.type=="bookmark"&&(!x||_.marker.insertLeft)){var K=_.from==null||(O.inclusiveLeft?_.from<=p:_.from<p);(y||(y=[])).push(new vi(O,K?null:_.from-p,_.to==null?null:_.to-p))}}return y}function Ye(h,p){if(p.full)return null;var x=me(h,p.from.line)&&xt(h,p.from.line).markedSpans,y=me(h,p.to.line)&&xt(h,p.to.line).markedSpans;if(!x&&!y)return null;var S=p.from.ch,_=p.to.ch,O=ce(p.from,p.to)==0,V=Mn(x,S,O),K=mi(y,_,O),et=p.text.length==1,Lt=ri(p.text).length+(et?S:0);if(V)for(var at=0;at<V.length;++at){var ie=V[at];if(ie.to==null){var Yt=Qi(K,ie.marker);Yt?et&&(ie.to=Yt.to==null?null:Yt.to+Lt):ie.to=S}}if(K)for(var Ge=0;Ge<K.length;++Ge){var si=K[Ge];if(si.to!=null&&(si.to+=Lt),si.from==null){var yi=Qi(V,si.marker);yi||(si.from=Lt,et&&(V||(V=[])).push(si))}else si.from+=Lt,et&&(V||(V=[])).push(si)}V&&(V=Je(V)),K&&K!=V&&(K=Je(K));var Vi=[V];if(!et){var un=p.text.length-2,qi;if(un>0&&V)for(var dn=0;dn<V.length;++dn)V[dn].to==null&&(qi||(qi=[])).push(new vi(V[dn].marker,null,null));for(var Dn=0;Dn<un;++Dn)Vi.push(qi);Vi.push(K)}return Vi}function Je(h){for(var p=0;p<h.length;++p){var x=h[p];x.from!=null&&x.from==x.to&&x.marker.clearWhenEmpty!==!1&&h.splice(p--,1)}return h.length?h:null}function Oi(h,p,x){var y=null;if(h.iter(p.line,x.line+1,function(Yt){if(Yt.markedSpans)for(var Ge=0;Ge<Yt.markedSpans.length;++Ge){var si=Yt.markedSpans[Ge].marker;si.readOnly&&(!y||Zt(y,si)==-1)&&(y||(y=[])).push(si)}}),!y)return null;for(var S=[{from:p,to:x}],_=0;_<y.length;++_)for(var O=y[_],V=O.find(0),K=0;K<S.length;++K){var et=S[K];if(!(ce(et.to,V.from)<0||ce(et.from,V.to)>0)){var Lt=[K,1],at=ce(et.from,V.from),ie=ce(et.to,V.to);(at<0||!O.inclusiveLeft&&!at)&&Lt.push({from:et.from,to:V.from}),(ie>0||!O.inclusiveRight&&!ie)&&Lt.push({from:V.to,to:et.to}),S.splice.apply(S,Lt),K+=Lt.length-3}}return S}function pe(h){var p=h.markedSpans;if(p){for(var x=0;x<p.length;++x)p[x].marker.detachLine(h);h.markedSpans=null}}function z(h,p){if(p){for(var x=0;x<p.length;++x)p[x].marker.attachLine(h);h.markedSpans=p}}function fn(h){return h.inclusiveLeft?-1:0}function vn(h){return h.inclusiveRight?1:0}function Qn(h,p){var x=h.lines.length-p.lines.length;if(x!=0)return x;var y=h.find(),S=p.find(),_=ce(y.from,S.from)||fn(h)-fn(p);if(_)return-_;var O=ce(y.to,S.to)||vn(h)-vn(p);return O||p.id-h.id}function Kn(h,p){var x=Kt&&h.markedSpans,y;if(x)for(var S=void 0,_=0;_<x.length;++_)S=x[_],S.marker.collapsed&&(p?S.from:S.to)==null&&(!y||Qn(y,S.marker)<0)&&(y=S.marker);return y}function Ar(h){return Kn(h,!0)}function tn(h){return Kn(h,!1)}function Hi(h,p){var x=Kt&&h.markedSpans,y;if(x)for(var S=0;S<x.length;++S){var _=x[S];_.marker.collapsed&&(_.from==null||_.from<p)&&(_.to==null||_.to>p)&&(!y||Qn(y,_.marker)<0)&&(y=_.marker)}return y}function Sn(h,p,x,y,S){var _=xt(h,p),O=Kt&&_.markedSpans;if(O)for(var V=0;V<O.length;++V){var K=O[V];if(K.marker.collapsed){var et=K.marker.find(0),Lt=ce(et.from,x)||fn(K.marker)-fn(S),at=ce(et.to,y)||vn(K.marker)-vn(S);if(!(Lt>=0&&at<=0||Lt<=0&&at>=0)&&(Lt<=0&&(K.marker.inclusiveRight&&S.inclusiveLeft?ce(et.to,x)>=0:ce(et.to,x)>0)||Lt>=0&&(K.marker.inclusiveRight&&S.inclusiveLeft?ce(et.from,y)<=0:ce(et.from,y)<0)))return!0}}}function Ji(h){for(var p;p=Ar(h);)h=p.find(-1,!0).line;return h}function Fn(h){for(var p;p=tn(h);)h=p.find(1,!0).line;return h}function Xr(h){for(var p,x;p=tn(h);)h=p.find(1,!0).line,(x||(x=[])).push(h);return x}function no(h,p){var x=xt(h,p),y=Ji(x);return x==y?p:lt(y)}function Jn(h,p){if(p>h.lastLine())return p;var x=xt(h,p),y;if(!ii(h,x))return p;for(;y=tn(x);)x=y.find(1,!0).line;return lt(x)+1}function ii(h,p){var x=Kt&&p.markedSpans;if(x){for(var y=void 0,S=0;S<x.length;++S)if(y=x[S],!!y.marker.collapsed){if(y.from==null)return!0;if(!y.marker.widgetNode&&y.from==0&&y.marker.inclusiveLeft&&xr(h,p,y))return!0}}}function xr(h,p,x){if(x.to==null){var y=x.marker.find(1,!0);return xr(h,y.line,Qi(y.line.markedSpans,x.marker))}if(x.marker.inclusiveRight&&x.to==p.text.length)return!0;for(var S=void 0,_=0;_<p.markedSpans.length;++_)if(S=p.markedSpans[_],S.marker.collapsed&&!S.marker.widgetNode&&S.from==x.to&&(S.to==null||S.to!=x.from)&&(S.marker.inclusiveLeft||x.marker.inclusiveRight)&&xr(h,p,S))return!0}function wr(h){h=Ji(h);for(var p=0,x=h.parent,y=0;y<x.lines.length;++y){var S=x.lines[y];if(S==h)break;p+=S.height}for(var _=x.parent;_;x=_,_=x.parent)for(var O=0;O<_.children.length;++O){var V=_.children[O];if(V==x)break;p+=V.height}return p}function ko(h){if(h.height==0)return 0;for(var p=h.text.length,x,y=h;x=Ar(y);){var S=x.find(0,!0);y=S.from.line,p+=S.from.ch-S.to.ch}for(y=h;x=tn(y);){var _=x.find(0,!0);p-=y.text.length-_.from.ch,y=_.to.line,p+=y.text.length-_.to.ch}return p}function br(h){var p=h.display,x=h.doc;p.maxLine=xt(x,x.first),p.maxLineLength=ko(p.maxLine),p.maxLineChanged=!0,x.iter(function(y){var S=ko(y);S>p.maxLineLength&&(p.maxLineLength=S,p.maxLine=y)})}var po=function(h,p,x){this.text=h,z(this,p),this.height=x?x(this):1};po.prototype.lineNo=function(){return lt(this)},_i(po);function ds(h,p,x,y){h.text=p,h.stateAfter&&(h.stateAfter=null),h.styles&&(h.styles=null),h.order!=null&&(h.order=null),pe(h),z(h,x);var S=y?y(h):1;S!=h.height&&te(h,S)}function Ps(h){h.parent=null,pe(h)}var xs={},Ns={};function ws(h,p){if(!h||/^\s*$/.test(h))return null;var x=p.addModeClass?Ns:xs;return x[h]||(x[h]=h.replace(/\S+/g,"cm-$&"))}function It(h,p){var x=We("span",null,null,Pt?"padding-right: .1px":null),y={pre:We("pre",[x],"CodeMirror-line"),content:x,col:0,pos:0,cm:h,trailingSpace:!1,splitSpaces:h.getOption("lineWrapping")};p.measure={};for(var S=0;S<=(p.rest?p.rest.length:0);S++){var _=S?p.rest[S-1]:p.line,O=void 0;y.pos=0,y.addToken=Va,Hn(h.display.measure)&&(O=Ci(_,h.doc.direction))&&(y.addToken=Xs(y.addToken,O)),y.map=[];var V=p!=h.display.externalMeasured&&lt(_);al(_,y,re(h,_,V)),_.styleClasses&&(_.styleClasses.bgClass&&(y.bgClass=ti(_.styleClasses.bgClass,y.bgClass||"")),_.styleClasses.textClass&&(y.textClass=ti(_.styleClasses.textClass,y.textClass||""))),y.map.length==0&&y.map.push(0,0,y.content.appendChild(hr(h.display.measure))),S==0?(p.measure.map=y.map,p.measure.cache={}):((p.measure.maps||(p.measure.maps=[])).push(y.map),(p.measure.caches||(p.measure.caches=[])).push({}))}if(Pt){var K=y.content.lastChild;(/\bcm-tab\b/.test(K.className)||K.querySelector&&K.querySelector(".cm-tab"))&&(y.content.className="cm-tab-wrap-hack")}return oe(h,"renderLine",h,p.line,y.pre),y.pre.className&&(y.textClass=ti(y.pre.className,y.textClass||"")),y}function Lo(h){var p=Vt("span","\u2022","cm-invalidchar");return p.title="\\u"+h.charCodeAt(0).toString(16),p.setAttribute("aria-label",p.title),p}function Va(h,p,x,y,S,_,O){if(p){var V=h.splitSpaces?Ia(p,h.trailingSpace):p,K=h.cm.state.specialChars,et=!1,Lt;if(!K.test(p))h.col+=p.length,Lt=document.createTextNode(V),h.map.push(h.pos,h.pos+p.length,Lt),ut&&ft<9&&(et=!0),h.pos+=p.length;else{Lt=document.createDocumentFragment();for(var at=0;;){K.lastIndex=at;var ie=K.exec(p),Yt=ie?ie.index-at:p.length-at;if(Yt){var Ge=document.createTextNode(V.slice(at,at+Yt));ut&&ft<9?Lt.appendChild(Vt("span",[Ge])):Lt.appendChild(Ge),h.map.push(h.pos,h.pos+Yt,Ge),h.col+=Yt,h.pos+=Yt}if(!ie)break;at+=Yt+1;var si=void 0;if(ie[0]==" "){var yi=h.cm.options.tabSize,Vi=yi-h.col%yi;si=Lt.appendChild(Vt("span",Ai(Vi),"cm-tab")),si.setAttribute("role","presentation"),si.setAttribute("cm-text"," "),h.col+=Vi}else ie[0]=="\r"||ie[0]==`
`?(si=Lt.appendChild(Vt("span",ie[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),si.setAttribute("cm-text",ie[0]),h.col+=1):(si=h.cm.options.specialCharPlaceholder(ie[0]),si.setAttribute("cm-text",ie[0]),ut&&ft<9?Lt.appendChild(Vt("span",[si])):Lt.appendChild(si),h.col+=1);h.map.push(h.pos,h.pos+1,si),h.pos++}}if(h.trailingSpace=V.charCodeAt(p.length-1)==32,x||y||S||et||_||O){var un=x||"";y&&(un+=y),S&&(un+=S);var qi=Vt("span",[Lt],un,_);if(O)for(var dn in O)O.hasOwnProperty(dn)&&dn!="style"&&dn!="class"&&qi.setAttribute(dn,O[dn]);return h.content.appendChild(qi)}h.content.appendChild(Lt)}}function Ia(h,p){if(h.length>1&&!/ /.test(h))return h;for(var x=p,y="",S=0;S<h.length;S++){var _=h.charAt(S);_==" "&&x&&(S==h.length-1||h.charCodeAt(S+1)==32)&&(_="\xA0"),y+=_,x=_==" "}return y}function Xs(h,p){return function(x,y,S,_,O,V,K){S=S?S+" cm-force-border":"cm-force-border";for(var et=x.pos,Lt=et+y.length;;){for(var at=void 0,ie=0;ie<p.length&&(at=p[ie],!(at.to>et&&at.from<=et));ie++);if(at.to>=Lt)return h(x,y,S,_,O,V,K);h(x,y.slice(0,at.to-et),S,_,null,V,K),_=null,y=y.slice(at.to-et),et=at.to}}}function Ao(h,p,x,y){var S=!y&&x.widgetNode;S&&h.map.push(h.pos,h.pos+p,S),!y&&h.cm.display.input.needsContentAttribute&&(S||(S=h.content.appendChild(document.createElement("span"))),S.setAttribute("cm-marker",x.id)),S&&(h.cm.display.input.setUneditable(S),h.content.appendChild(S)),h.pos+=p,h.trailingSpace=!1}function al(h,p,x){var y=h.markedSpans,S=h.text,_=0;if(!y){for(var O=1;O<x.length;O+=2)p.addToken(p,S.slice(_,_=x[O]),ws(x[O+1],p.cm.options));return}for(var V=S.length,K=0,et=1,Lt="",at,ie,Yt=0,Ge,si,yi,Vi,un;;){if(Yt==K){Ge=si=yi=ie="",un=null,Vi=null,Yt=1/0;for(var qi=[],dn=void 0,Dn=0;Dn<y.length;++Dn){var en=y[Dn],lr=en.marker;if(lr.type=="bookmark"&&en.from==K&&lr.widgetNode)qi.push(lr);else if(en.from<=K&&(en.to==null||en.to>K||lr.collapsed&&en.to==K&&en.from==K)){if(en.to!=null&&en.to!=K&&Yt>en.to&&(Yt=en.to,si=""),lr.className&&(Ge+=" "+lr.className),lr.css&&(ie=(ie?ie+";":"")+lr.css),lr.startStyle&&en.from==K&&(yi+=" "+lr.startStyle),lr.endStyle&&en.to==Yt&&(dn||(dn=[])).push(lr.endStyle,en.to),lr.title&&((un||(un={})).title=lr.title),lr.attributes)for(var To in lr.attributes)(un||(un={}))[To]=lr.attributes[To];lr.collapsed&&(!Vi||Qn(Vi.marker,lr)<0)&&(Vi=en)}else en.from>K&&Yt>en.from&&(Yt=en.from)}if(dn)for(var Ws=0;Ws<dn.length;Ws+=2)dn[Ws+1]==Yt&&(si+=" "+dn[Ws]);if(!Vi||Vi.from==K)for(var qo=0;qo<qi.length;++qo)Ao(p,0,qi[qo]);if(Vi&&(Vi.from||0)==K){if(Ao(p,(Vi.to==null?V+1:Vi.to)-K,Vi.marker,Vi.from==null),Vi.to==null)return;Vi.to==K&&(Vi=!1)}}if(K>=V)break;for(var za=Math.min(V,Yt);;){if(Lt){var ka=K+Lt.length;if(!Vi){var Os=ka>za?Lt.slice(0,za-K):Lt;p.addToken(p,Os,at?at+Ge:Ge,yi,K+Os.length==Yt?si:"",ie,un)}if(ka>=za){Lt=Lt.slice(za-K),K=za;break}K=ka,yi=""}Lt=S.slice(_,_=x[et++]),at=ws(x[et++],p.cm.options)}}}function oa(h,p,x){this.line=p,this.rest=Xr(p),this.size=this.rest?lt(ri(this.rest))-x+1:1,this.node=this.text=null,this.hidden=ii(h,p)}function vr(h,p,x){for(var y=[],S,_=p;_<x;_=S){var O=new oa(h.doc,xt(h.doc,_),_);S=_+O.size,y.push(O)}return y}var jr=null;function ya(h){jr?jr.ops.push(h):h.ownsGroup=jr={ops:[h],delayedCallbacks:[]}}function yn(h){var p=h.delayedCallbacks,x=0;do{for(;x<p.length;x++)p[x].call(null);for(var y=0;y<h.ops.length;y++){var S=h.ops[y];if(S.cursorActivityHandlers)for(;S.cursorActivityCalled<S.cursorActivityHandlers.length;)S.cursorActivityHandlers[S.cursorActivityCalled++].call(null,S.cm)}}while(x<p.length)}function Xn(h,p){var x=h.ownsGroup;if(x)try{yn(x)}finally{jr=null,p(x)}}var Pn=null;function ai(h,p){var x=ln(h,p);if(x.length){var y=Array.prototype.slice.call(arguments,2),S;jr?S=jr.delayedCallbacks:Pn?S=Pn:(S=Pn=[],setTimeout(cr,0));for(var _=function(V){S.push(function(){return x[V].apply(null,y)})},O=0;O<x.length;++O)_(O)}}function cr(){var h=Pn;Pn=null;for(var p=0;p<h.length;++p)h[p]()}function _r(h,p,x,y){for(var S=0;S<p.changes.length;S++){var _=p.changes[S];_=="text"?Ze(h,p):_=="gutter"?An(h,p,x,y):_=="class"?Nn(h,p):_=="widget"&&Rr(h,p,y)}p.changes=null}function ro(h){return h.node==h.text&&(h.node=Vt("div",null,null,"position: relative"),h.text.parentNode&&h.text.parentNode.replaceChild(h.node,h.text),h.node.appendChild(h.text),ut&&ft<8&&(h.node.style.zIndex=2)),h.node}function Eo(h,p){var x=p.bgClass?p.bgClass+" "+(p.line.bgClass||""):p.line.bgClass;if(x&&(x+=" CodeMirror-linebackground"),p.background)x?p.background.className=x:(p.background.parentNode.removeChild(p.background),p.background=null);else if(x){var y=ro(p);p.background=y.insertBefore(Vt("div",null,x),y.firstChild),h.display.input.setUneditable(p.background)}}function Do(h,p){var x=h.display.externalMeasured;return x&&x.line==p.line?(h.display.externalMeasured=null,p.measure=x.measure,x.built):It(h,p)}function Ze(h,p){var x=p.text.className,y=Do(h,p);p.text==p.node&&(p.node=y.pre),p.text.parentNode.replaceChild(y.pre,p.text),p.text=y.pre,y.bgClass!=p.bgClass||y.textClass!=p.textClass?(p.bgClass=y.bgClass,p.textClass=y.textClass,Nn(h,p)):x&&(p.text.className=x)}function Nn(h,p){Eo(h,p),p.line.wrapClass?ro(p).className=p.line.wrapClass:p.node!=p.text&&(p.node.className="");var x=p.textClass?p.textClass+" "+(p.line.textClass||""):p.line.textClass;p.text.className=x||""}function An(h,p,x,y){if(p.gutter&&(p.node.removeChild(p.gutter),p.gutter=null),p.gutterBackground&&(p.node.removeChild(p.gutterBackground),p.gutterBackground=null),p.line.gutterClass){var S=ro(p);p.gutterBackground=Vt("div",null,"CodeMirror-gutter-background "+p.line.gutterClass,"left: "+(h.options.fixedGutter?y.fixedPos:-y.gutterTotalWidth)+"px; width: "+y.gutterTotalWidth+"px"),h.display.input.setUneditable(p.gutterBackground),S.insertBefore(p.gutterBackground,p.text)}var _=p.line.gutterMarkers;if(h.options.lineNumbers||_){var O=ro(p),V=p.gutter=Vt("div",null,"CodeMirror-gutter-wrapper","left: "+(h.options.fixedGutter?y.fixedPos:-y.gutterTotalWidth)+"px");if(h.display.input.setUneditable(V),O.insertBefore(V,p.text),p.line.gutterClass&&(V.className+=" "+p.line.gutterClass),h.options.lineNumbers&&(!_||!_["CodeMirror-linenumbers"])&&(p.lineNumber=V.appendChild(Vt("div",Fe(h.options,x),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+y.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+h.display.lineNumInnerWidth+"px"))),_)for(var K=0;K<h.display.gutterSpecs.length;++K){var et=h.display.gutterSpecs[K].className,Lt=_.hasOwnProperty(et)&&_[et];Lt&&V.appendChild(Vt("div",[Lt],"CodeMirror-gutter-elt","left: "+y.gutterLeft[et]+"px; width: "+y.gutterWidth[et]+"px"))}}}function Rr(h,p,x){p.alignable&&(p.alignable=null);for(var y=q("CodeMirror-linewidget"),S=p.node.firstChild,_=void 0;S;S=_)_=S.nextSibling,y.test(S.className)&&p.node.removeChild(S);Oo(h,p,x)}function Io(h,p,x,y){var S=Do(h,p);return p.text=p.node=S.pre,S.bgClass&&(p.bgClass=S.bgClass),S.textClass&&(p.textClass=S.textClass),Nn(h,p),An(h,p,x,y),Oo(h,p,y),p.node}function Oo(h,p,x){if(on(h,p.line,p,x,!0),p.rest)for(var y=0;y<p.rest.length;y++)on(h,p.rest[y],p,x,!1)}function on(h,p,x,y,S){if(p.widgets)for(var _=ro(x),O=0,V=p.widgets;O<V.length;++O){var K=V[O],et=Vt("div",[K.node],"CodeMirror-linewidget"+(K.className?" "+K.className:""));K.handleMouseEvents||et.setAttribute("cm-ignore-events","true"),Il(K,et,x,y),h.display.input.setUneditable(et),S&&K.above?_.insertBefore(et,x.gutter||x.text):_.appendChild(et),ai(K,"redraw")}}function Il(h,p,x,y){if(h.noHScroll){(x.alignable||(x.alignable=[])).push(p);var S=y.wrapperWidth;p.style.left=y.fixedPos+"px",h.coverGutter||(S-=y.gutterTotalWidth,p.style.paddingLeft=y.gutterTotalWidth+"px"),p.style.width=S+"px"}h.coverGutter&&(p.style.zIndex=5,p.style.position="relative",h.noHScroll||(p.style.marginLeft=-y.gutterTotalWidth+"px"))}function Ys(h){if(h.height!=null)return h.height;var p=h.doc.cm;if(!p)return 0;if(!xe(document.body,h.node)){var x="position: relative;";h.coverGutter&&(x+="margin-left: -"+p.display.gutters.offsetWidth+"px;"),h.noHScroll&&(x+="width: "+p.display.wrapper.clientWidth+"px;"),ve(p.display.measure,Vt("div",[h.node],null,x))}return h.height=h.node.parentNode.offsetHeight}function Rs(h,p){for(var x=On(p);x!=h.wrapper;x=x.parentNode)if(!x||x.nodeType==1&&x.getAttribute("cm-ignore-events")=="true"||x.parentNode==h.sizer&&x!=h.mover)return!0}function Go(h){return h.lineSpace.offsetTop}function Ol(h){return h.mover.offsetHeight-h.lineSpace.offsetHeight}function sa(h){if(h.cachedPaddingH)return h.cachedPaddingH;var p=ve(h.measure,Vt("pre","x","CodeMirror-line-like")),x=window.getComputedStyle?window.getComputedStyle(p):p.currentStyle,y={left:parseInt(x.paddingLeft),right:parseInt(x.paddingRight)};return!isNaN(y.left)&&!isNaN(y.right)&&(h.cachedPaddingH=y),y}function fs(h){return ze-h.display.nativeBarWidth}function jo(h){return h.display.scroller.clientWidth-fs(h)-h.display.barWidth}function ll(h){return h.display.scroller.clientHeight-fs(h)-h.display.barHeight}function Ml(h,p,x){var y=h.options.lineWrapping,S=y&&jo(h);if(!p.measure.heights||y&&p.measure.width!=S){var _=p.measure.heights=[];if(y){p.measure.width=S;for(var O=p.text.firstChild.getClientRects(),V=0;V<O.length-1;V++){var K=O[V],et=O[V+1];Math.abs(K.bottom-et.bottom)>2&&_.push((K.bottom+et.top)/2-x.top)}}_.push(x.bottom-x.top)}}function Cl(h,p,x){if(h.line==p)return{map:h.measure.map,cache:h.measure.cache};for(var y=0;y<h.rest.length;y++)if(h.rest[y]==p)return{map:h.measure.maps[y],cache:h.measure.caches[y]};for(var S=0;S<h.rest.length;S++)if(lt(h.rest[S])>x)return{map:h.measure.maps[S],cache:h.measure.caches[S],before:!0}}function yu(h,p){p=Ji(p);var x=lt(p),y=h.display.externalMeasured=new oa(h.doc,p,x);y.lineN=x;var S=y.built=It(h,y);return y.text=S.pre,ve(h.display.lineMeasure,S.pre),y}function Bl(h,p,x,y){return Wr(h,zs(h,p),x,y)}function aa(h,p){if(p>=h.display.viewFrom&&p<h.display.viewTo)return h.display.view[js(h,p)];var x=h.display.externalMeasured;if(x&&p>=x.lineN&&p<x.lineN+x.size)return x}function zs(h,p){var x=lt(p),y=aa(h,x);y&&!y.text?y=null:y&&y.changes&&(_r(h,y,x,Zr(h)),h.curOp.forceUpdate=!0),y||(y=yu(h,p));var S=Cl(y,p,x);return{line:p,view:y,rect:null,map:S.map,cache:S.cache,before:S.before,hasHeights:!1}}function Wr(h,p,x,y,S){p.before&&(x=-1);var _=x+(y||""),O;return p.cache.hasOwnProperty(_)?O=p.cache[_]:(p.rect||(p.rect=p.view.text.getBoundingClientRect()),p.hasHeights||(Ml(h,p.view,p.rect),p.hasHeights=!0),O=zn(h,p,x,y),O.bogus||(p.cache[_]=O)),{left:O.left,right:O.right,top:S?O.rtop:O.top,bottom:S?O.rbottom:O.bottom}}var kl={left:0,right:0,top:0,bottom:0};function xu(h,p,x){for(var y,S,_,O,V,K,et=0;et<h.length;et+=3)if(V=h[et],K=h[et+1],p<V?(S=0,_=1,O="left"):p<K?(S=p-V,_=S+1):(et==h.length-3||p==K&&h[et+3]>p)&&(_=K-V,S=_-1,p>=K&&(O="right")),S!=null){if(y=h[et+2],V==K&&x==(y.insertLeft?"left":"right")&&(O=x),x=="left"&&S==0)for(;et&&h[et-2]==h[et-3]&&h[et-1].insertLeft;)y=h[(et-=3)+2],O="left";if(x=="right"&&S==K-V)for(;et<h.length-3&&h[et+3]==h[et+4]&&!h[et+5].insertLeft;)y=h[(et+=3)+2],O="right";break}return{node:y,start:S,end:_,collapse:O,coverStart:V,coverEnd:K}}function Ll(h,p){var x=kl;if(p=="left")for(var y=0;y<h.length&&(x=h[y]).left==x.right;y++);else for(var S=h.length-1;S>=0&&(x=h[S]).left==x.right;S--);return x}function zn(h,p,x,y){var S=xu(p.map,x,y),_=S.node,O=S.start,V=S.end,K=S.collapse,et;if(_.nodeType==3){for(var Lt=0;Lt<4;Lt++){for(;O&&ae(p.line.text.charAt(S.coverStart+O));)--O;for(;S.coverStart+V<S.coverEnd&&ae(p.line.text.charAt(S.coverStart+V));)++V;if(ut&&ft<9&&O==0&&V==S.coverEnd-S.coverStart?et=_.parentNode.getBoundingClientRect():et=Ll(ee(_,O,V).getClientRects(),y),et.left||et.right||O==0)break;V=O,O=O-1,K="right"}ut&&ft<11&&(et=dr(h.display.measure,et))}else{O>0&&(K=y="right");var at;h.options.lineWrapping&&(at=_.getClientRects()).length>1?et=at[y=="right"?at.length-1:0]:et=_.getBoundingClientRect()}if(ut&&ft<9&&!O&&(!et||!et.left&&!et.right)){var ie=_.parentNode.getClientRects()[0];ie?et={left:ie.left,right:ie.left+$r(h.display),top:ie.top,bottom:ie.bottom}:et=kl}for(var Yt=et.top-p.rect.top,Ge=et.bottom-p.rect.top,si=(Yt+Ge)/2,yi=p.view.measure.heights,Vi=0;Vi<yi.length-1&&!(si<yi[Vi]);Vi++);var un=Vi?yi[Vi-1]:0,qi=yi[Vi],dn={left:(K=="right"?et.right:et.left)-p.rect.left,right:(K=="left"?et.left:et.right)-p.rect.left,top:un,bottom:qi};return!et.left&&!et.right&&(dn.bogus=!0),h.options.singleCursorHeightPerLine||(dn.rtop=Yt,dn.rbottom=Ge),dn}function dr(h,p){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Yn(h))return p;var x=screen.logicalXDPI/screen.deviceXDPI,y=screen.logicalYDPI/screen.deviceYDPI;return{left:p.left*x,right:p.right*x,top:p.top*y,bottom:p.bottom*y}}function ho(h){if(h.measure&&(h.measure.cache={},h.measure.heights=null,h.rest))for(var p=0;p<h.rest.length;p++)h.measure.caches[p]={}}function Ms(h){h.display.externalMeasure=null,Bt(h.display.lineMeasure);for(var p=0;p<h.display.view.length;p++)ho(h.display.view[p])}function _o(h){Ms(h),h.display.cachedCharWidth=h.display.cachedTextHeight=h.display.cachedPaddingH=null,h.options.lineWrapping||(h.display.maxLineChanged=!0),h.display.lineNumChars=null}function oo(){return rt&&jt?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function co(){return rt&&jt?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function so(h){var p=0;if(h.widgets)for(var x=0;x<h.widgets.length;++x)h.widgets[x].above&&(p+=Ys(h.widgets[x]));return p}function ao(h,p,x,y,S){if(!S){var _=so(p);x.top+=_,x.bottom+=_}if(y=="line")return x;y||(y="local");var O=wr(p);if(y=="local"?O+=Go(h.display):O-=h.display.viewOffset,y=="page"||y=="window"){var V=h.display.lineSpace.getBoundingClientRect();O+=V.top+(y=="window"?0:co());var K=V.left+(y=="window"?0:oo());x.left+=K,x.right+=K}return x.top+=O,x.bottom+=O,x}function Oa(h,p,x){if(x=="div")return p;var y=p.left,S=p.top;if(x=="page")y-=oo(),S-=co();else if(x=="local"||!x){var _=h.display.sizer.getBoundingClientRect();y+=_.left,S+=_.top}var O=h.display.lineSpace.getBoundingClientRect();return{left:y-O.left,top:S-O.top}}function Ba(h,p,x,y,S){return y||(y=xt(h.doc,p.line)),ao(h,y,Bl(h,y,p.ch,S),x)}function Ur(h,p,x,y,S,_){y=y||xt(h.doc,p.line),S||(S=zs(h,y));function O(Ge,si){var yi=Wr(h,S,Ge,si?"right":"left",_);return si?yi.left=yi.right:yi.right=yi.left,ao(h,y,yi,x)}var V=Ci(y,h.doc.direction),K=p.ch,et=p.sticky;if(K>=y.text.length?(K=y.text.length,et="before"):K<=0&&(K=0,et="after"),!V)return O(et=="before"?K-1:K,et=="before");function Lt(Ge,si,yi){var Vi=V[si],un=Vi.level==1;return O(yi?Ge-1:Ge,un!=yi)}var at=Si(V,K,et),ie=He,Yt=Lt(K,at,et=="before");return ie!=null&&(Yt.other=Lt(K,ie,et!="before")),Yt}function tc(h,p){var x=0;p=Re(h.doc,p),h.options.lineWrapping||(x=$r(h.display)*p.ch);var y=xt(h.doc,p.line),S=wr(y)+Go(h.display);return{left:x,right:x,top:S,bottom:S+y.height}}function wu(h,p,x,y,S){var _=Tt(h,p,x);return _.xRel=S,y&&(_.outside=y),_}function ec(h,p,x){var y=h.doc;if(x+=h.display.viewOffset,x<0)return wu(y.first,0,null,-1,-1);var S=Qt(y,x),_=y.first+y.size-1;if(S>_)return wu(y.first+y.size-1,xt(y,_).text.length,null,1,1);p<0&&(p=0);for(var O=xt(y,S);;){var V=fe(h,O,S,p,x),K=Hi(O,V.ch+(V.xRel>0||V.outside>0?1:0));if(!K)return V;var et=K.find(1);if(et.line==S)return et;O=xt(y,S=et.line)}}function nn(h,p,x,y){y-=so(p);var S=p.text.length,_=Ae(function(O){return Wr(h,x,O-1).bottom<=y},S,0);return S=Ae(function(O){return Wr(h,x,O).top>y},_,S),{begin:_,end:S}}function kd(h,p,x,y){x||(x=zs(h,p));var S=ao(h,p,Wr(h,x,y),"line").top;return nn(h,p,x,S)}function ht(h,p,x,y){return h.bottom<=x?!1:h.top>x?!0:(y?h.left:h.right)>p}function fe(h,p,x,y,S){S-=wr(p);var _=zs(h,p),O=so(p),V=0,K=p.text.length,et=!0,Lt=Ci(p,h.doc.direction);if(Lt){var at=(h.options.lineWrapping?Rc:ju)(h,p,x,_,Lt,y,S);et=at.level!=1,V=et?at.from:at.to-1,K=et?at.to:at.from-1}var ie=null,Yt=null,Ge=Ae(function(Dn){var en=Wr(h,_,Dn);return en.top+=O,en.bottom+=O,ht(en,y,S,!1)?(en.top<=S&&en.left<=y&&(ie=Dn,Yt=en),!0):!1},V,K),si,yi,Vi=!1;if(Yt){var un=y-Yt.left<Yt.right-y,qi=un==et;Ge=ie+(qi?0:1),yi=qi?"after":"before",si=un?Yt.left:Yt.right}else{!et&&(Ge==K||Ge==V)&&Ge++,yi=Ge==0?"after":Ge==p.text.length?"before":Wr(h,_,Ge-(et?1:0)).bottom+O<=S==et?"after":"before";var dn=Ur(h,Tt(x,Ge,yi),"line",p,_);si=dn.left,Vi=S<dn.top?-1:S>=dn.bottom?1:0}return Ge=$e(p.text,Ge,1),wu(x,Ge,yi,Vi,y-si)}function ju(h,p,x,y,S,_,O){var V=Ae(function(at){var ie=S[at],Yt=ie.level!=1;return ht(Ur(h,Tt(x,Yt?ie.to:ie.from,Yt?"before":"after"),"line",p,y),_,O,!0)},0,S.length-1),K=S[V];if(V>0){var et=K.level!=1,Lt=Ur(h,Tt(x,et?K.from:K.to,et?"after":"before"),"line",p,y);ht(Lt,_,O,!0)&&Lt.top>O&&(K=S[V-1])}return K}function Rc(h,p,x,y,S,_,O){var V=nn(h,p,y,O),K=V.begin,et=V.end;/\s/.test(p.text.charAt(et-1))&&et--;for(var Lt=null,at=null,ie=0;ie<S.length;ie++){var Yt=S[ie];if(!(Yt.from>=et||Yt.to<=K)){var Ge=Yt.level!=1,si=Wr(h,y,Ge?Math.min(et,Yt.to)-1:Math.max(K,Yt.from)).right,yi=si<_?_-si+1e9:si-_;(!Lt||at>yi)&&(Lt=Yt,at=yi)}}return Lt||(Lt=S[S.length-1]),Lt.from<K&&(Lt={from:K,to:Lt.to,level:Lt.level}),Lt.to>et&&(Lt={from:Lt.from,to:et,level:Lt.level}),Lt}var eu;function iu(h){if(h.cachedTextHeight!=null)return h.cachedTextHeight;if(eu==null){eu=Vt("pre",null,"CodeMirror-line-like");for(var p=0;p<49;++p)eu.appendChild(document.createTextNode("x")),eu.appendChild(Vt("br"));eu.appendChild(document.createTextNode("x"))}ve(h.measure,eu);var x=eu.offsetHeight/50;return x>3&&(h.cachedTextHeight=x),Bt(h.measure),x||1}function $r(h){if(h.cachedCharWidth!=null)return h.cachedCharWidth;var p=Vt("span","xxxxxxxxxx"),x=Vt("pre",[p],"CodeMirror-line-like");ve(h.measure,x);var y=p.getBoundingClientRect(),S=(y.right-y.left)/10;return S>2&&(h.cachedCharWidth=S),S||10}function Zr(h){for(var p=h.display,x={},y={},S=p.gutters.clientLeft,_=p.gutters.firstChild,O=0;_;_=_.nextSibling,++O){var V=h.display.gutterSpecs[O].className;x[V]=_.offsetLeft+_.clientLeft+S,y[V]=_.clientWidth}return{fixedPos:fo(p),gutterTotalWidth:p.gutters.offsetWidth,gutterLeft:x,gutterWidth:y,wrapperWidth:p.wrapper.clientWidth}}function fo(h){return h.scroller.getBoundingClientRect().left-h.sizer.getBoundingClientRect().left}function Mr(h){var p=iu(h.display),x=h.options.lineWrapping,y=x&&Math.max(5,h.display.scroller.clientWidth/$r(h.display)-3);return function(S){if(ii(h.doc,S))return 0;var _=0;if(S.widgets)for(var O=0;O<S.widgets.length;O++)S.widgets[O].height&&(_+=S.widgets[O].height);return x?_+(Math.ceil(S.text.length/y)||1)*p:_+p}}function an(h){var p=h.doc,x=Mr(h);p.iter(function(y){var S=x(y);S!=y.height&&te(y,S)})}function Cs(h,p,x,y){var S=h.display;if(!x&&On(p).getAttribute("cm-not-content")=="true")return null;var _,O,V=S.lineSpace.getBoundingClientRect();try{_=p.clientX-V.left,O=p.clientY-V.top}catch(at){return null}var K=ec(h,_,O),et;if(y&&K.xRel>0&&(et=xt(h.doc,K.line).text).length==K.ch){var Lt=dt(et,et.length,h.options.tabSize)-et.length;K=Tt(K.line,Math.max(0,Math.round((_-sa(h.display).left)/$r(h.display))-Lt))}return K}function js(h,p){if(p>=h.display.viewTo||(p-=h.display.viewFrom,p<0))return null;for(var x=h.display.view,y=0;y<x.length;y++)if(p-=x[y].size,p<0)return y}function mo(h,p,x,y){p==null&&(p=h.doc.first),x==null&&(x=h.doc.first+h.doc.size),y||(y=0);var S=h.display;if(y&&x<S.viewTo&&(S.updateLineNumbers==null||S.updateLineNumbers>p)&&(S.updateLineNumbers=p),h.curOp.viewChanged=!0,p>=S.viewTo)Kt&&no(h.doc,p)<S.viewTo&&$o(h);else if(x<=S.viewFrom)Kt&&Jn(h.doc,x+y)>S.viewFrom?$o(h):(S.viewFrom+=y,S.viewTo+=y);else if(p<=S.viewFrom&&x>=S.viewTo)$o(h);else if(p<=S.viewFrom){var _=ps(h,x,x+y,1);_?(S.view=S.view.slice(_.index),S.viewFrom=_.lineN,S.viewTo+=y):$o(h)}else if(x>=S.viewTo){var O=ps(h,p,p,-1);O?(S.view=S.view.slice(0,O.index),S.viewTo=O.lineN):$o(h)}else{var V=ps(h,p,p,-1),K=ps(h,x,x+y,1);V&&K?(S.view=S.view.slice(0,V.index).concat(vr(h,V.lineN,K.lineN)).concat(S.view.slice(K.index)),S.viewTo+=y):$o(h)}var et=S.externalMeasured;et&&(x<et.lineN?et.lineN+=y:p<et.lineN+et.size&&(S.externalMeasured=null))}function er(h,p,x){h.curOp.viewChanged=!0;var y=h.display,S=h.display.externalMeasured;if(S&&p>=S.lineN&&p<S.lineN+S.size&&(y.externalMeasured=null),!(p<y.viewFrom||p>=y.viewTo)){var _=y.view[js(h,p)];if(_.node!=null){var O=_.changes||(_.changes=[]);Zt(O,x)==-1&&O.push(x)}}}function $o(h){h.display.viewFrom=h.display.viewTo=h.doc.first,h.display.view=[],h.display.viewOffset=0}function ps(h,p,x,y){var S=js(h,p),_,O=h.display.view;if(!Kt||x==h.doc.first+h.doc.size)return{index:S,lineN:x};for(var V=h.display.viewFrom,K=0;K<S;K++)V+=O[K].size;if(V!=p){if(y>0){if(S==O.length-1)return null;_=V+O[S].size-p,S++}else _=V-p;p+=_,x+=_}for(;no(h.doc,x)!=x;){if(S==(y<0?0:O.length-1))return null;x+=y*O[S-(y<0?1:0)].size,S+=y}return{index:S,lineN:x}}function Or(h,p,x){var y=h.display,S=y.view;S.length==0||p>=y.viewTo||x<=y.viewFrom?(y.view=vr(h,p,x),y.viewFrom=p):(y.viewFrom>p?y.view=vr(h,p,y.viewFrom).concat(y.view):y.viewFrom<p&&(y.view=y.view.slice(js(h,p))),y.viewFrom=p,y.viewTo<x?y.view=y.view.concat(vr(h,y.viewTo,x)):y.viewTo>x&&(y.view=y.view.slice(0,js(h,x)))),y.viewTo=x}function xa(h){for(var p=h.display.view,x=0,y=0;y<p.length;y++){var S=p[y];!S.hidden&&(!S.node||S.changes)&&++x}return x}function As(h){h.display.input.showSelection(h.display.input.prepareSelection())}function Sh(h,p){p===void 0&&(p=!0);for(var x=h.doc,y={},S=y.cursors=document.createDocumentFragment(),_=y.selection=document.createDocumentFragment(),O=0;O<x.sel.ranges.length;O++)if(!(!p&&O==x.sel.primIndex)){var V=x.sel.ranges[O];if(!(V.from().line>=h.display.viewTo||V.to().line<h.display.viewFrom)){var K=V.empty();(K||h.options.showCursorWhenSelecting)&&Cr(h,V.head,S),K||Sr(h,V,_)}}return y}function Cr(h,p,x){var y=Ur(h,p,"div",null,null,!h.options.singleCursorHeightPerLine),S=x.appendChild(Vt("div","\xA0","CodeMirror-cursor"));if(S.style.left=y.left+"px",S.style.top=y.top+"px",S.style.height=Math.max(0,y.bottom-y.top)*h.options.cursorHeight+"px",y.other){var _=x.appendChild(Vt("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));_.style.display="",_.style.left=y.other.left+"px",_.style.top=y.other.top+"px",_.style.height=(y.other.bottom-y.other.top)*.85+"px"}}function wa(h,p){return h.top-p.top||h.left-p.left}function Sr(h,p,x){var y=h.display,S=h.doc,_=document.createDocumentFragment(),O=sa(h.display),V=O.left,K=Math.max(y.sizerWidth,jo(h)-y.sizer.offsetLeft)-O.right,et=S.direction=="ltr";function Lt(qi,dn,Dn,en){dn<0&&(dn=0),dn=Math.round(dn),en=Math.round(en),_.appendChild(Vt("div",null,"CodeMirror-selected","position: absolute; left: "+qi+`px;
top: `+dn+"px; width: "+(Dn==null?K-qi:Dn)+`px;
height: `+(en-dn)+"px"))}function at(qi,dn,Dn){var en=xt(S,qi),lr=en.text.length,To,Ws;function qo(Os,dl){return Ba(h,Tt(qi,Os),"div",en,dl)}function za(Os,dl,rr){var gs=kd(h,en,null,Os),Br=dl=="ltr"==(rr=="after")?"left":"right",ss=rr=="after"?gs.begin:gs.end-(/\s/.test(en.text.charAt(gs.end-1))?2:1);return qo(ss,Br)[Br]}var ka=Ci(en,S.direction);return Qe(ka,dn||0,Dn==null?lr:Dn,function(Os,dl,rr,gs){var Br=rr=="ltr",ss=qo(Os,Br?"left":"right"),Qo=qo(dl-1,Br?"right":"left"),Qs=dn==null&&Os==0,La=Dn==null&&dl==lr,Wo=gs==0,Kr=!ka||gs==ka.length-1;if(Qo.top-ss.top<=3){var as=(et?Qs:La)&&Wo,$d=(et?La:Qs)&&Kr,_l=as?V:(Br?ss:Qo).left,Ja=$d?K:(Br?Qo:ss).right;Lt(_l,ss.top,Ja-_l,ss.bottom)}else{var ha,Hr,Us,vs;Br?(ha=et&&Qs&&Wo?V:ss.left,Hr=et?K:za(Os,rr,"before"),Us=et?V:za(dl,rr,"after"),vs=et&&La&&Kr?K:Qo.right):(ha=et?za(Os,rr,"before"):V,Hr=!et&&Qs&&Wo?K:ss.right,Us=!et&&La&&Kr?V:Qo.left,vs=et?za(dl,rr,"after"):K),Lt(ha,ss.top,Hr-ha,ss.bottom),ss.bottom<Qo.top&&Lt(V,ss.bottom,null,Qo.top),Lt(Us,Qo.top,vs-Us,Qo.bottom)}(!To||wa(ss,To)<0)&&(To=ss),wa(Qo,To)<0&&(To=Qo),(!Ws||wa(ss,Ws)<0)&&(Ws=ss),wa(Qo,Ws)<0&&(Ws=Qo)}),{start:To,end:Ws}}var ie=p.from(),Yt=p.to();if(ie.line==Yt.line)at(ie.line,ie.ch,Yt.ch);else{var Ge=xt(S,ie.line),si=xt(S,Yt.line),yi=Ji(Ge)==Ji(si),Vi=at(ie.line,ie.ch,yi?Ge.text.length+1:null).end,un=at(Yt.line,yi?0:null,Yt.ch).start;yi&&(Vi.top<un.top-2?(Lt(Vi.right,Vi.top,null,Vi.bottom),Lt(V,un.top,un.left,un.bottom)):Lt(Vi.right,Vi.top,un.left-Vi.right,Vi.bottom)),Vi.bottom<un.top&&Lt(V,Vi.bottom,null,un.top)}x.appendChild(_)}function Yr(h){if(h.state.focused){var p=h.display;clearInterval(p.blinker);var x=!0;p.cursorDiv.style.visibility="",h.options.cursorBlinkRate>0?p.blinker=setInterval(function(){h.hasFocus()||ic(h),p.cursorDiv.style.visibility=(x=!x)?"":"hidden"},h.options.cursorBlinkRate):h.options.cursorBlinkRate<0&&(p.cursorDiv.style.visibility="hidden")}}function Jr(h){h.state.focused||(h.display.input.focus(),Tr(h))}function Bo(h){h.state.delayingBlurEvent=!0,setTimeout(function(){h.state.delayingBlurEvent&&(h.state.delayingBlurEvent=!1,ic(h))},100)}function Tr(h,p){h.state.delayingBlurEvent&&(h.state.delayingBlurEvent=!1),h.options.readOnly!="nocursor"&&(h.state.focused||(oe(h,"focus",h,p),h.state.focused=!0,_e(h.display.wrapper,"CodeMirror-focused"),!h.curOp&&h.display.selForContextMenu!=h.doc.sel&&(h.display.input.reset(),Pt&&setTimeout(function(){return h.display.input.reset(!0)},20)),h.display.input.receivedFocus()),Yr(h))}function ic(h,p){h.state.delayingBlurEvent||(h.state.focused&&(oe(h,"blur",h,p),h.state.focused=!1,Et(h.display.wrapper,"CodeMirror-focused")),clearInterval(h.display.blinker),setTimeout(function(){h.state.focused||(h.display.shift=!1)},150))}function kn(h){for(var p=h.display,x=p.lineDiv.offsetTop,y=0;y<p.view.length;y++){var S=p.view[y],_=h.options.lineWrapping,O=void 0,V=0;if(!S.hidden){if(ut&&ft<8){var K=S.node.offsetTop+S.node.offsetHeight;O=K-x,x=K}else{var et=S.node.getBoundingClientRect();O=et.bottom-et.top,!_&&S.text.firstChild&&(V=S.text.firstChild.getBoundingClientRect().right-et.left-1)}var Lt=S.line.height-O;if((Lt>.005||Lt<-.005)&&(te(S.line,O),K0(S.line),S.rest))for(var at=0;at<S.rest.length;at++)K0(S.rest[at]);if(V>h.display.sizerWidth){var ie=Math.ceil(V/$r(h.display));ie>h.display.maxLineLength&&(h.display.maxLineLength=ie,h.display.maxLine=S.line,h.display.maxLineChanged=!0)}}}}function K0(h){if(h.widgets)for(var p=0;p<h.widgets.length;++p){var x=h.widgets[p],y=x.node.parentNode;y&&(x.height=y.offsetHeight)}}function Vn(h,p,x){var y=x&&x.top!=null?Math.max(0,x.top):h.scroller.scrollTop;y=Math.floor(y-Go(h));var S=x&&x.bottom!=null?x.bottom:y+h.wrapper.clientHeight,_=Qt(p,y),O=Qt(p,S);if(x&&x.ensure){var V=x.ensure.from.line,K=x.ensure.to.line;V<_?(_=V,O=Qt(p,wr(xt(p,V))+h.wrapper.clientHeight)):Math.min(K,p.lastLine())>=O&&(_=Qt(p,wr(xt(p,K))-h.wrapper.clientHeight),O=K)}return{from:_,to:Math.max(O,_+1)}}function $u(h,p){if(!we(h,"scrollCursorIntoView")){var x=h.display,y=x.sizer.getBoundingClientRect(),S=null;if(p.top+y.top<0?S=!0:p.bottom+y.top>(window.innerHeight||document.documentElement.clientHeight)&&(S=!1),S!=null&&!Rt){var _=Vt("div","\u200B",null,`position: absolute;
top: `+(p.top-x.viewOffset-Go(h.display))+`px;
height: `+(p.bottom-p.top+fs(h)+x.barHeight)+`px;
left: `+p.left+"px; width: "+Math.max(2,p.right-p.left)+"px;");h.display.lineSpace.appendChild(_),_.scrollIntoView(S),h.display.lineSpace.removeChild(_)}}}function Fl(h,p,x,y){y==null&&(y=0);var S;!h.options.lineWrapping&&p==x&&(p=p.ch?Tt(p.line,p.sticky=="before"?p.ch-1:p.ch,"after"):p,x=p.sticky=="before"?Tt(p.line,p.ch+1,"before"):p);for(var _=0;_<5;_++){var O=!1,V=Ur(h,p),K=!x||x==p?V:Ur(h,x);S={left:Math.min(V.left,K.left),top:Math.min(V.top,K.top)-y,right:Math.max(V.left,K.left),bottom:Math.max(V.bottom,K.bottom)+y};var et=_f(h,S),Lt=h.doc.scrollTop,at=h.doc.scrollLeft;if(et.scrollTop!=null&&(Hu(h,et.scrollTop),Math.abs(h.doc.scrollTop-Lt)>1&&(O=!0)),et.scrollLeft!=null&&(Vu(h,et.scrollLeft),Math.abs(h.doc.scrollLeft-at)>1&&(O=!0)),!O)break}return S}function Ld(h,p){var x=_f(h,p);x.scrollTop!=null&&Hu(h,x.scrollTop),x.scrollLeft!=null&&Vu(h,x.scrollLeft)}function _f(h,p){var x=h.display,y=iu(h.display);p.top<0&&(p.top=0);var S=h.curOp&&h.curOp.scrollTop!=null?h.curOp.scrollTop:x.scroller.scrollTop,_=ll(h),O={};p.bottom-p.top>_&&(p.bottom=p.top+_);var V=h.doc.height+Ol(x),K=p.top<y,et=p.bottom>V-y;if(p.top<S)O.scrollTop=K?0:p.top;else if(p.bottom>S+_){var Lt=Math.min(p.top,(et?V:p.bottom)-_);Lt!=S&&(O.scrollTop=Lt)}var at=h.options.fixedGutter?0:x.gutters.offsetWidth,ie=h.curOp&&h.curOp.scrollLeft!=null?h.curOp.scrollLeft:x.scroller.scrollLeft-at,Yt=jo(h)-x.gutters.offsetWidth,Ge=p.right-p.left>Yt;return Ge&&(p.right=p.left+Yt),p.left<10?O.scrollLeft=0:p.left<ie?O.scrollLeft=Math.max(0,p.left+at-(Ge?0:10)):p.right>Yt+ie-3&&(O.scrollLeft=p.right+(Ge?0:10)-Yt),O}function Tf(h,p){p!=null&&(bu(h),h.curOp.scrollTop=(h.curOp.scrollTop==null?h.doc.scrollTop:h.curOp.scrollTop)+p)}function Ku(h){bu(h);var p=h.getCursor();h.curOp.scrollToPos={from:p,to:p,margin:h.options.cursorScrollMargin}}function Mh(h,p,x){(p!=null||x!=null)&&bu(h),p!=null&&(h.curOp.scrollLeft=p),x!=null&&(h.curOp.scrollTop=x)}function Pr(h,p){bu(h),h.curOp.scrollToPos=p}function bu(h){var p=h.curOp.scrollToPos;if(p){h.curOp.scrollToPos=null;var x=tc(h,p.from),y=tc(h,p.to);Pf(h,x,y,p.margin)}}function Pf(h,p,x,y){var S=_f(h,{left:Math.min(p.left,x.left),top:Math.min(p.top,x.top)-y,right:Math.max(p.right,x.right),bottom:Math.max(p.bottom,x.bottom)+y});Mh(h,S.scrollLeft,S.scrollTop)}function Hu(h,p){Math.abs(h.doc.scrollTop-p)<2||(Mt||Lh(h,{top:p}),Ip(h,p,!0),Mt&&Lh(h),nc(h,100))}function Ip(h,p,x){p=Math.max(0,Math.min(h.display.scroller.scrollHeight-h.display.scroller.clientHeight,p)),!(h.display.scroller.scrollTop==p&&!x)&&(h.doc.scrollTop=p,h.display.scrollbars.setScrollTop(p),h.display.scroller.scrollTop!=p&&(h.display.scroller.scrollTop=p))}function Vu(h,p,x,y){p=Math.max(0,Math.min(p,h.display.scroller.scrollWidth-h.display.scroller.clientWidth)),!((x?p==h.doc.scrollLeft:Math.abs(h.doc.scrollLeft-p)<2)&&!y)&&(h.doc.scrollLeft=p,Af(h),h.display.scroller.scrollLeft!=p&&(h.display.scroller.scrollLeft=p),h.display.scrollbars.setScrollLeft(p))}function ul(h){var p=h.display,x=p.gutters.offsetWidth,y=Math.round(h.doc.height+Ol(h.display));return{clientHeight:p.scroller.clientHeight,viewHeight:p.wrapper.clientHeight,scrollWidth:p.scroller.scrollWidth,clientWidth:p.scroller.clientWidth,viewWidth:p.wrapper.clientWidth,barLeft:h.options.fixedGutter?x:0,docHeight:y,scrollHeight:y+fs(h)+p.barHeight,nativeBarWidth:p.nativeBarWidth,gutterWidth:x}}var Wu=function(h,p,x){this.cm=x;var y=this.vert=Vt("div",[Vt("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),S=this.horiz=Vt("div",[Vt("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");y.tabIndex=S.tabIndex=-1,h(y),h(S),ei(y,"scroll",function(){y.clientHeight&&p(y.scrollTop,"vertical")}),ei(S,"scroll",function(){S.clientWidth&&p(S.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,ut&&ft<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Wu.prototype.update=function(h){var p=h.scrollWidth>h.clientWidth+1,x=h.scrollHeight>h.clientHeight+1,y=h.nativeBarWidth;if(x){this.vert.style.display="block",this.vert.style.bottom=p?y+"px":"0";var S=h.viewHeight-(p?y:0);this.vert.firstChild.style.height=Math.max(0,h.scrollHeight-h.clientHeight+S)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(p){this.horiz.style.display="block",this.horiz.style.right=x?y+"px":"0",this.horiz.style.left=h.barLeft+"px";var _=h.viewWidth-h.barLeft-(x?y:0);this.horiz.firstChild.style.width=Math.max(0,h.scrollWidth-h.clientWidth+_)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&h.clientHeight>0&&(y==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:x?y:0,bottom:p?y:0}},Wu.prototype.setScrollLeft=function(h){this.horiz.scrollLeft!=h&&(this.horiz.scrollLeft=h),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Wu.prototype.setScrollTop=function(h){this.vert.scrollTop!=h&&(this.vert.scrollTop=h),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Wu.prototype.zeroWidthHack=function(){var h=Ht&&!pt?"12px":"18px";this.horiz.style.height=this.vert.style.width=h,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new W,this.disableVert=new W},Wu.prototype.enableZeroWidthBar=function(h,p,x){h.style.pointerEvents="auto";function y(){var S=h.getBoundingClientRect(),_=x=="vert"?document.elementFromPoint(S.right-1,(S.top+S.bottom)/2):document.elementFromPoint((S.right+S.left)/2,S.bottom-1);_!=h?h.style.pointerEvents="none":p.set(1e3,y)}p.set(1e3,y)},Wu.prototype.clear=function(){var h=this.horiz.parentNode;h.removeChild(this.horiz),h.removeChild(this.vert)};var Js=function(){};Js.prototype.update=function(){return{bottom:0,right:0}},Js.prototype.setScrollLeft=function(){},Js.prototype.setScrollTop=function(){},Js.prototype.clear=function(){};function Uu(h,p){p||(p=ul(h));var x=h.display.barWidth,y=h.display.barHeight;Ed(h,p);for(var S=0;S<4&&x!=h.display.barWidth||y!=h.display.barHeight;S++)x!=h.display.barWidth&&h.options.lineWrapping&&kn(h),Ed(h,ul(h)),x=h.display.barWidth,y=h.display.barHeight}function Ed(h,p){var x=h.display,y=x.scrollbars.update(p);x.sizer.style.paddingRight=(x.barWidth=y.right)+"px",x.sizer.style.paddingBottom=(x.barHeight=y.bottom)+"px",x.heightForcer.style.borderBottom=y.bottom+"px solid transparent",y.right&&y.bottom?(x.scrollbarFiller.style.display="block",x.scrollbarFiller.style.height=y.bottom+"px",x.scrollbarFiller.style.width=y.right+"px"):x.scrollbarFiller.style.display="",y.bottom&&h.options.coverGutterNextToScrollbar&&h.options.fixedGutter?(x.gutterFiller.style.display="block",x.gutterFiller.style.height=y.bottom+"px",x.gutterFiller.style.width=p.gutterWidth+"px"):x.gutterFiller.style.display=""}var Op={native:Wu,null:Js};function Bp(h){h.display.scrollbars&&(h.display.scrollbars.clear(),h.display.scrollbars.addClass&&Et(h.display.wrapper,h.display.scrollbars.addClass)),h.display.scrollbars=new Op[h.options.scrollbarStyle](function(p){h.display.wrapper.insertBefore(p,h.display.scrollbarFiller),ei(p,"mousedown",function(){h.state.focused&&setTimeout(function(){return h.display.input.focus()},0)}),p.setAttribute("cm-not-content","true")},function(p,x){x=="horizontal"?Vu(h,p):Hu(h,p)},h),h.display.scrollbars.addClass&&_e(h.display.wrapper,h.display.scrollbars.addClass)}var H0=0;function Ch(h){h.curOp={cm:h,viewChanged:!1,startHeight:h.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++H0},ya(h.curOp)}function Zu(h){var p=h.curOp;p&&Xn(p,function(x){for(var y=0;y<x.ops.length;y++)x.ops[y].cm.curOp=null;dg(x)})}function dg(h){for(var p=h.ops,x=0;x<p.length;x++)fg(p[x]);for(var y=0;y<p.length;y++)pg(p[y]);for(var S=0;S<p.length;S++)V0(p[S]);for(var _=0;_<p.length;_++)Xo(p[_]);for(var O=0;O<p.length;O++)kh(p[O])}function fg(h){var p=h.cm,x=p.display;Fp(p),h.updateMaxLine&&br(p),h.mustUpdate=h.viewChanged||h.forceUpdate||h.scrollTop!=null||h.scrollToPos&&(h.scrollToPos.from.line<x.viewFrom||h.scrollToPos.to.line>=x.viewTo)||x.maxLineChanged&&p.options.lineWrapping,h.update=h.mustUpdate&&new rc(p,h.mustUpdate&&{top:h.scrollTop,ensure:h.scrollToPos},h.forceUpdate)}function pg(h){h.updatedDisplay=h.mustUpdate&&Nf(h.cm,h.update)}function V0(h){var p=h.cm,x=p.display;h.updatedDisplay&&kn(p),h.barMeasure=ul(p),x.maxLineChanged&&!p.options.lineWrapping&&(h.adjustWidthTo=Bl(p,x.maxLine,x.maxLine.text.length).left+3,p.display.sizerWidth=h.adjustWidthTo,h.barMeasure.scrollWidth=Math.max(x.scroller.clientWidth,x.sizer.offsetLeft+h.adjustWidthTo+fs(p)+p.display.barWidth),h.maxScrollLeft=Math.max(0,x.sizer.offsetLeft+h.adjustWidthTo-jo(p))),(h.updatedDisplay||h.selectionChanged)&&(h.preparedSelection=x.input.prepareSelection())}function Xo(h){var p=h.cm;h.adjustWidthTo!=null&&(p.display.sizer.style.minWidth=h.adjustWidthTo+"px",h.maxScrollLeft<p.doc.scrollLeft&&Vu(p,Math.min(p.display.scroller.scrollLeft,h.maxScrollLeft),!0),p.display.maxLineChanged=!1);var x=h.focus&&h.focus==Nt();h.preparedSelection&&p.display.input.showSelection(h.preparedSelection,x),(h.updatedDisplay||h.startHeight!=p.doc.height)&&Uu(p,h.barMeasure),h.updatedDisplay&&_h(p,h.barMeasure),h.selectionChanged&&Yr(p),p.state.focused&&h.updateInput&&p.display.input.reset(h.typing),x&&Jr(h.cm)}function kh(h){var p=h.cm,x=p.display,y=p.doc;if(h.updatedDisplay&&qr(p,h.update),x.wheelStartX!=null&&(h.scrollTop!=null||h.scrollLeft!=null||h.scrollToPos)&&(x.wheelStartX=x.wheelStartY=null),h.scrollTop!=null&&Ip(p,h.scrollTop,h.forceScroll),h.scrollLeft!=null&&Vu(p,h.scrollLeft,!0,!0),h.scrollToPos){var S=Fl(p,Re(y,h.scrollToPos.from),Re(y,h.scrollToPos.to),h.scrollToPos.margin);$u(p,S)}var _=h.maybeHiddenMarkers,O=h.maybeUnhiddenMarkers;if(_)for(var V=0;V<_.length;++V)_[V].lines.length||oe(_[V],"hide");if(O)for(var K=0;K<O.length;++K)O[K].lines.length&&oe(O[K],"unhide");x.wrapper.offsetHeight&&(y.scrollTop=p.display.scroller.scrollTop),h.changeObjs&&oe(p,"changes",p,h.changeObjs),h.update&&h.update.finish()}function yr(h,p){if(h.curOp)return p();Ch(h);try{return p()}finally{Zu(h)}}function ks(h,p){return function(){if(h.curOp)return p.apply(h,arguments);Ch(h);try{return p.apply(h,arguments)}finally{Zu(h)}}}function Ko(h){return function(){if(this.curOp)return h.apply(this,arguments);Ch(this);try{return h.apply(this,arguments)}finally{Zu(this)}}}function $s(h){return function(){var p=this.cm;if(!p||p.curOp)return h.apply(this,arguments);Ch(p);try{return h.apply(this,arguments)}finally{Zu(p)}}}function nc(h,p){h.doc.highlightFrontier<h.display.viewTo&&h.state.highlight.set(p,Be(Ds,h))}function Ds(h){var p=h.doc;if(!(p.highlightFrontier>=h.display.viewTo)){var x=+new Date+h.options.workTime,y=Ie(h,p.highlightFrontier),S=[];p.iter(y.line,Math.min(p.first+p.size,h.display.viewTo+500),function(_){if(y.line>=h.display.viewFrom){var O=_.styles,V=_.text.length>h.options.maxHighlightLength?J(p.mode,y.state):null,K=ke(h,_,y,!0);V&&(y.state=V),_.styles=K.styles;var et=_.styleClasses,Lt=K.classes;Lt?_.styleClasses=Lt:et&&(_.styleClasses=null);for(var at=!O||O.length!=_.styles.length||et!=Lt&&(!et||!Lt||et.bgClass!=Lt.bgClass||et.textClass!=Lt.textClass),ie=0;!at&&ie<O.length;++ie)at=O[ie]!=_.styles[ie];at&&S.push(y.line),_.stateAfter=y.save(),y.nextLine()}else _.text.length<=h.options.maxHighlightLength&&mt(h,_.text,y),_.stateAfter=y.line%5==0?y.save():null,y.nextLine();if(+new Date>x)return nc(h,h.options.workDelay),!0}),p.highlightFrontier=y.line,p.modeFrontier=Math.max(p.modeFrontier,y.line),S.length&&yr(h,function(){for(var _=0;_<S.length;_++)er(h,S[_],"text")})}}var rc=function(h,p,x){var y=h.display;this.viewport=p,this.visible=Vn(y,h.doc,p),this.editorIsHidden=!y.wrapper.offsetWidth,this.wrapperHeight=y.wrapper.clientHeight,this.wrapperWidth=y.wrapper.clientWidth,this.oldDisplayWidth=jo(h),this.force=x,this.dims=Zr(h),this.events=[]};rc.prototype.signal=function(h,p){Pi(h,p)&&this.events.push(arguments)},rc.prototype.finish=function(){for(var h=0;h<this.events.length;h++)oe.apply(null,this.events[h])};function Fp(h){var p=h.display;!p.scrollbarsClipped&&p.scroller.offsetWidth&&(p.nativeBarWidth=p.scroller.offsetWidth-p.scroller.clientWidth,p.heightForcer.style.height=fs(h)+"px",p.sizer.style.marginBottom=-p.nativeBarWidth+"px",p.sizer.style.borderRightWidth=fs(h)+"px",p.scrollbarsClipped=!0)}function W0(h){if(h.hasFocus())return null;var p=Nt();if(!p||!xe(h.display.lineDiv,p))return null;var x={activeElt:p};if(window.getSelection){var y=window.getSelection();y.anchorNode&&y.extend&&xe(h.display.lineDiv,y.anchorNode)&&(x.anchorNode=y.anchorNode,x.anchorOffset=y.anchorOffset,x.focusNode=y.focusNode,x.focusOffset=y.focusOffset)}return x}function Fa(h){if(!(!h||!h.activeElt||h.activeElt==Nt())&&(h.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(h.activeElt.nodeName)&&h.anchorNode&&xe(document.body,h.anchorNode)&&xe(document.body,h.focusNode))){var p=window.getSelection(),x=document.createRange();x.setEnd(h.anchorNode,h.anchorOffset),x.collapse(!1),p.removeAllRanges(),p.addRange(x),p.extend(h.focusNode,h.focusOffset)}}function Nf(h,p){var x=h.display,y=h.doc;if(p.editorIsHidden)return $o(h),!1;if(!p.force&&p.visible.from>=x.viewFrom&&p.visible.to<=x.viewTo&&(x.updateLineNumbers==null||x.updateLineNumbers>=x.viewTo)&&x.renderedView==x.view&&xa(h)==0)return!1;rs(h)&&($o(h),p.dims=Zr(h));var S=y.first+y.size,_=Math.max(p.visible.from-h.options.viewportMargin,y.first),O=Math.min(S,p.visible.to+h.options.viewportMargin);x.viewFrom<_&&_-x.viewFrom<20&&(_=Math.max(y.first,x.viewFrom)),x.viewTo>O&&x.viewTo-O<20&&(O=Math.min(S,x.viewTo)),Kt&&(_=no(h.doc,_),O=Jn(h.doc,O));var V=_!=x.viewFrom||O!=x.viewTo||x.lastWrapHeight!=p.wrapperHeight||x.lastWrapWidth!=p.wrapperWidth;Or(h,_,O),x.viewOffset=wr(xt(h.doc,x.viewFrom)),h.display.mover.style.top=x.viewOffset+"px";var K=xa(h);if(!V&&K==0&&!p.force&&x.renderedView==x.view&&(x.updateLineNumbers==null||x.updateLineNumbers>=x.viewTo))return!1;var et=W0(h);return K>4&&(x.lineDiv.style.display="none"),Rp(h,x.updateLineNumbers,p.dims),K>4&&(x.lineDiv.style.display=""),x.renderedView=x.view,Fa(et),Bt(x.cursorDiv),Bt(x.selectionDiv),x.gutters.style.height=x.sizer.style.minHeight=0,V&&(x.lastWrapHeight=p.wrapperHeight,x.lastWrapWidth=p.wrapperWidth,nc(h,400)),x.updateLineNumbers=null,!0}function qr(h,p){for(var x=p.viewport,y=!0;;y=!1){if(!y||!h.options.lineWrapping||p.oldDisplayWidth==jo(h)){if(x&&x.top!=null&&(x={top:Math.min(h.doc.height+Ol(h.display)-ll(h),x.top)}),p.visible=Vn(h.display,h.doc,x),p.visible.from>=h.display.viewFrom&&p.visible.to<=h.display.viewTo)break}else y&&(p.visible=Vn(h.display,h.doc,x));if(!Nf(h,p))break;kn(h);var S=ul(h);As(h),Uu(h,S),_h(h,S),p.force=!1}p.signal(h,"update",h),(h.display.viewFrom!=h.display.reportedViewFrom||h.display.viewTo!=h.display.reportedViewTo)&&(p.signal(h,"viewportChange",h,h.display.viewFrom,h.display.viewTo),h.display.reportedViewFrom=h.display.viewFrom,h.display.reportedViewTo=h.display.viewTo)}function Lh(h,p){var x=new rc(h,p);if(Nf(h,x)){kn(h),qr(h,x);var y=ul(h);As(h),Uu(h,y),_h(h,y),x.finish()}}function Rp(h,p,x){var y=h.display,S=h.options.lineNumbers,_=y.lineDiv,O=_.firstChild;function V(Ge){var si=Ge.nextSibling;return Pt&&Ht&&h.display.currentWheelTarget==Ge?Ge.style.display="none":Ge.parentNode.removeChild(Ge),si}for(var K=y.view,et=y.viewFrom,Lt=0;Lt<K.length;Lt++){var at=K[Lt];if(!at.hidden)if(!at.node||at.node.parentNode!=_){var ie=Io(h,at,et,x);_.insertBefore(ie,O)}else{for(;O!=at.node;)O=V(O);var Yt=S&&p!=null&&p<=et&&at.lineNumber;at.changes&&(Zt(at.changes,"gutter")>-1&&(Yt=!1),_r(h,at,et,x)),Yt&&(Bt(at.lineNumber),at.lineNumber.appendChild(document.createTextNode(Fe(h.options,et)))),O=at.node.nextSibling}et+=at.size}for(;O;)O=V(O)}function Eh(h){var p=h.gutters.offsetWidth;h.sizer.style.marginLeft=p+"px"}function _h(h,p){h.display.sizer.style.minHeight=p.docHeight+"px",h.display.heightForcer.style.top=p.docHeight+"px",h.display.gutters.style.height=p.docHeight+h.display.barHeight+fs(h)+"px"}function Af(h){var p=h.display,x=p.view;if(!(!p.alignWidgets&&(!p.gutters.firstChild||!h.options.fixedGutter))){for(var y=fo(p)-p.scroller.scrollLeft+h.doc.scrollLeft,S=p.gutters.offsetWidth,_=y+"px",O=0;O<x.length;O++)if(!x[O].hidden){h.options.fixedGutter&&(x[O].gutter&&(x[O].gutter.style.left=_),x[O].gutterBackground&&(x[O].gutterBackground.style.left=_));var V=x[O].alignable;if(V)for(var K=0;K<V.length;K++)V[K].style.left=_}h.options.fixedGutter&&(p.gutters.style.left=y+S+"px")}}function rs(h){if(!h.options.lineNumbers)return!1;var p=h.doc,x=Fe(h.options,p.first+p.size-1),y=h.display;if(x.length!=y.lineNumChars){var S=y.measure.appendChild(Vt("div",[Vt("div",x)],"CodeMirror-linenumber CodeMirror-gutter-elt")),_=S.firstChild.offsetWidth,O=S.offsetWidth-_;return y.lineGutter.style.width="",y.lineNumInnerWidth=Math.max(_,y.lineGutter.offsetWidth-O)+1,y.lineNumWidth=y.lineNumInnerWidth+O,y.lineNumChars=y.lineNumInnerWidth?x.length:-1,y.lineGutter.style.width=y.lineNumWidth+"px",Eh(h.display),!0}return!1}function Ks(h,p){for(var x=[],y=!1,S=0;S<h.length;S++){var _=h[S],O=null;if(typeof _!="string"&&(O=_.style,_=_.className),_=="CodeMirror-linenumbers")if(p)y=!0;else continue;x.push({className:_,style:O})}return p&&!y&&x.push({className:"CodeMirror-linenumbers",style:null}),x}function oc(h){var p=h.gutters,x=h.gutterSpecs;Bt(p),h.lineGutter=null;for(var y=0;y<x.length;++y){var S=x[y],_=S.className,O=S.style,V=p.appendChild(Vt("div",null,"CodeMirror-gutter "+_));O&&(V.style.cssText=O),_=="CodeMirror-linenumbers"&&(h.lineGutter=V,V.style.width=(h.lineNumWidth||1)+"px")}p.style.display=x.length?"":"none",Eh(h)}function hl(h){oc(h.display),mo(h),Af(h)}function Th(h,p,x,y){var S=this;this.input=x,S.scrollbarFiller=Vt("div",null,"CodeMirror-scrollbar-filler"),S.scrollbarFiller.setAttribute("cm-not-content","true"),S.gutterFiller=Vt("div",null,"CodeMirror-gutter-filler"),S.gutterFiller.setAttribute("cm-not-content","true"),S.lineDiv=We("div",null,"CodeMirror-code"),S.selectionDiv=Vt("div",null,null,"position: relative; z-index: 1"),S.cursorDiv=Vt("div",null,"CodeMirror-cursors"),S.measure=Vt("div",null,"CodeMirror-measure"),S.lineMeasure=Vt("div",null,"CodeMirror-measure"),S.lineSpace=We("div",[S.measure,S.lineMeasure,S.selectionDiv,S.cursorDiv,S.lineDiv],null,"position: relative; outline: none");var _=We("div",[S.lineSpace],"CodeMirror-lines");S.mover=Vt("div",[_],null,"position: relative"),S.sizer=Vt("div",[S.mover],"CodeMirror-sizer"),S.sizerWidth=null,S.heightForcer=Vt("div",null,null,"position: absolute; height: "+ze+"px; width: 1px;"),S.gutters=Vt("div",null,"CodeMirror-gutters"),S.lineGutter=null,S.scroller=Vt("div",[S.sizer,S.heightForcer,S.gutters],"CodeMirror-scroll"),S.scroller.setAttribute("tabIndex","-1"),S.wrapper=Vt("div",[S.scrollbarFiller,S.gutterFiller,S.scroller],"CodeMirror"),ut&&ft<8&&(S.gutters.style.zIndex=-1,S.scroller.style.paddingRight=0),!Pt&&!(Mt&&Jt)&&(S.scroller.draggable=!0),h&&(h.appendChild?h.appendChild(S.wrapper):h(S.wrapper)),S.viewFrom=S.viewTo=p.first,S.reportedViewFrom=S.reportedViewTo=p.first,S.view=[],S.renderedView=null,S.externalMeasured=null,S.viewOffset=0,S.lastWrapHeight=S.lastWrapWidth=0,S.updateLineNumbers=null,S.nativeBarWidth=S.barHeight=S.barWidth=0,S.scrollbarsClipped=!1,S.lineNumWidth=S.lineNumInnerWidth=S.lineNumChars=null,S.alignWidgets=!1,S.cachedCharWidth=S.cachedTextHeight=S.cachedPaddingH=null,S.maxLine=null,S.maxLineLength=0,S.maxLineChanged=!1,S.wheelDX=S.wheelDY=S.wheelStartX=S.wheelStartY=null,S.shift=!1,S.selForContextMenu=null,S.activeTouch=null,S.gutterSpecs=Ks(y.gutters,y.lineNumbers),oc(S),x.init(S)}var Wa=0,Fo=null;ut?Fo=-.53:Mt?Fo=15:rt?Fo=-.7:be&&(Fo=-1/3);function Ua(h){var p=h.wheelDeltaX,x=h.wheelDeltaY;return p==null&&h.detail&&h.axis==h.HORIZONTAL_AXIS&&(p=h.detail),x==null&&h.detail&&h.axis==h.VERTICAL_AXIS?x=h.detail:x==null&&(x=h.wheelDelta),{x:p,y:x}}function Za(h){var p=Ua(h);return p.x*=Fo,p.y*=Fo,p}function Hs(h,p){var x=Ua(p),y=x.x,S=x.y,_=h.display,O=_.scroller,V=O.scrollWidth>O.clientWidth,K=O.scrollHeight>O.clientHeight;if(y&&V||S&&K){if(S&&Ht&&Pt){t:for(var et=p.target,Lt=_.view;et!=O;et=et.parentNode)for(var at=0;at<Lt.length;at++)if(Lt[at].node==et){h.display.currentWheelTarget=et;break t}}if(y&&!Mt&&!yt&&Fo!=null){S&&K&&Hu(h,Math.max(0,O.scrollTop+S*Fo)),Vu(h,Math.max(0,O.scrollLeft+y*Fo)),(!S||S&&K)&&hn(p),_.wheelStartX=null;return}if(S&&Fo!=null){var ie=S*Fo,Yt=h.doc.scrollTop,Ge=Yt+_.wrapper.clientHeight;ie<0?Yt=Math.max(0,Yt+ie-50):Ge=Math.min(h.doc.height,Ge+ie+50),Lh(h,{top:Yt,bottom:Ge})}Wa<20&&(_.wheelStartX==null?(_.wheelStartX=O.scrollLeft,_.wheelStartY=O.scrollTop,_.wheelDX=y,_.wheelDY=S,setTimeout(function(){if(_.wheelStartX!=null){var si=O.scrollLeft-_.wheelStartX,yi=O.scrollTop-_.wheelStartY,Vi=yi&&_.wheelDY&&yi/_.wheelDY||si&&_.wheelDX&&si/_.wheelDX;_.wheelStartX=_.wheelStartY=null,Vi&&(Fo=(Fo*Wa+Vi)/(Wa+1),++Wa)}},200)):(_.wheelDX+=y,_.wheelDY+=S))}}var El=function(h,p){this.ranges=h,this.primIndex=p};El.prototype.primary=function(){return this.ranges[this.primIndex]},El.prototype.equals=function(h){if(h==this)return!0;if(h.primIndex!=this.primIndex||h.ranges.length!=this.ranges.length)return!1;for(var p=0;p<this.ranges.length;p++){var x=this.ranges[p],y=h.ranges[p];if(!bi(x.anchor,y.anchor)||!bi(x.head,y.head))return!1}return!0},El.prototype.deepCopy=function(){for(var h=[],p=0;p<this.ranges.length;p++)h[p]=new Qr(li(this.ranges[p].anchor),li(this.ranges[p].head));return new El(h,this.primIndex)},El.prototype.somethingSelected=function(){for(var h=0;h<this.ranges.length;h++)if(!this.ranges[h].empty())return!0;return!1},El.prototype.contains=function(h,p){p||(p=h);for(var x=0;x<this.ranges.length;x++){var y=this.ranges[x];if(ce(p,y.from())>=0&&ce(h,y.to())<=0)return x}return-1};var Qr=function(h,p){this.anchor=h,this.head=p};Qr.prototype.from=function(){return Pe(this.anchor,this.head)},Qr.prototype.to=function(){return Mi(this.anchor,this.head)},Qr.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Rl(h,p,x){var y=h&&h.options.selectionsMayTouch,S=p[x];p.sort(function(ie,Yt){return ce(ie.from(),Yt.from())}),x=Zt(p,S);for(var _=1;_<p.length;_++){var O=p[_],V=p[_-1],K=ce(V.to(),O.from());if(y&&!O.empty()?K>0:K>=0){var et=Pe(V.from(),O.from()),Lt=Mi(V.to(),O.to()),at=V.empty()?O.from()==O.head:V.from()==V.head;_<=x&&--x,p.splice(--_,2,new Qr(at?Lt:et,at?et:Lt))}}return new El(p,x)}function nu(h,p){return new El([new Qr(h,p||h)],0)}function Ph(h){return h.text?Tt(h.from.line+h.text.length-1,ri(h.text).length+(h.text.length==1?h.from.ch:0)):h.to}function sc(h,p){if(ce(h,p.from)<0)return h;if(ce(h,p.to)<=0)return Ph(p);var x=h.line+p.text.length-(p.to.line-p.from.line)-1,y=h.ch;return h.line==p.to.line&&(y+=Ph(p).ch-p.to.ch),Tt(x,y)}function _d(h,p){for(var x=[],y=0;y<h.sel.ranges.length;y++){var S=h.sel.ranges[y];x.push(new Qr(sc(S.anchor,p),sc(S.head,p)))}return Rl(h.cm,x,h.sel.primIndex)}function Su(h,p,x){return h.line==p.line?Tt(x.line,h.ch-p.ch+x.ch):Tt(x.line+(h.line-p.line),h.ch)}function ac(h,p,x){for(var y=[],S=Tt(h.first,0),_=S,O=0;O<p.length;O++){var V=p[O],K=Su(V.from,S,_),et=Su(Ph(V),S,_);if(S=V.to,_=et,x=="around"){var Lt=h.sel.ranges[O],at=ce(Lt.head,Lt.anchor)<0;y[O]=new Qr(at?et:K,at?K:et)}else y[O]=new Qr(K,K)}return new El(y,h.sel.primIndex)}function ar(h){h.doc.mode=pn(h.options,h.doc.modeOption),zc(h)}function zc(h){h.doc.iter(function(p){p.stateAfter&&(p.stateAfter=null),p.styles&&(p.styles=null)}),h.doc.modeFrontier=h.doc.highlightFrontier=h.doc.first,nc(h,100),h.state.modeGen++,h.curOp&&mo(h)}function zp(h,p){return p.from.ch==0&&p.to.ch==0&&ri(p.text)==""&&(!h.cm||h.cm.options.wholeLineUpdateBefore)}function Df(h,p,x,y){function S(un){return x?x[un]:null}function _(un,qi,dn){ds(un,qi,dn,y),ai(un,"change",un,p)}function O(un,qi){for(var dn=[],Dn=un;Dn<qi;++Dn)dn.push(new po(et[Dn],S(Dn),y));return dn}var V=p.from,K=p.to,et=p.text,Lt=xt(h,V.line),at=xt(h,K.line),ie=ri(et),Yt=S(et.length-1),Ge=K.line-V.line;if(p.full)h.insert(0,O(0,et.length)),h.remove(et.length,h.size-et.length);else if(zp(h,p)){var si=O(0,et.length-1);_(at,at.text,Yt),Ge&&h.remove(V.line,Ge),si.length&&h.insert(V.line,si)}else if(Lt==at)if(et.length==1)_(Lt,Lt.text.slice(0,V.ch)+ie+Lt.text.slice(K.ch),Yt);else{var yi=O(1,et.length-1);yi.push(new po(ie+Lt.text.slice(K.ch),Yt,y)),_(Lt,Lt.text.slice(0,V.ch)+et[0],S(0)),h.insert(V.line+1,yi)}else if(et.length==1)_(Lt,Lt.text.slice(0,V.ch)+et[0]+at.text.slice(K.ch),S(0)),h.remove(V.line+1,Ge);else{_(Lt,Lt.text.slice(0,V.ch)+et[0],S(0)),_(at,ie+at.text.slice(K.ch),Yt);var Vi=O(1,et.length-1);Ge>1&&h.remove(V.line+1,Ge-1),h.insert(V.line+1,Vi)}ai(h,"change",h,p)}function ru(h,p,x){function y(S,_,O){if(S.linked)for(var V=0;V<S.linked.length;++V){var K=S.linked[V];if(K.doc!=_){var et=O&&K.sharedHist;x&&!et||(p(K.doc,et),y(K.doc,S,et))}}}y(h,null,!0)}function jc(h,p){if(p.cm)throw new Error("This document is already in use.");h.doc=p,p.cm=h,an(h),ar(h),lc(h),h.options.lineWrapping||br(h),h.options.mode=p.modeOption,mo(h)}function lc(h){(h.doc.direction=="rtl"?_e:Et)(h.display.lineDiv,"CodeMirror-rtl")}function jp(h){yr(h,function(){lc(h),mo(h)})}function $c(h){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=h||1}function If(h,p){var x={from:li(p.from),to:Ph(p),text:Ot(h,p.from,p.to)};return Gu(h,x,p.from.line,p.to.line+1),ru(h,function(y){return Gu(y,x,p.from.line,p.to.line+1)},!0),x}function Kc(h){for(;h.length;){var p=ri(h);if(p.ranges)h.pop();else break}}function uc(h,p){if(p)return Kc(h.done),ri(h.done);if(h.done.length&&!ri(h.done).ranges)return ri(h.done);if(h.done.length>1&&!h.done[h.done.length-2].ranges)return h.done.pop(),ri(h.done)}function hc(h,p,x,y){var S=h.history;S.undone.length=0;var _=+new Date,O,V;if((S.lastOp==y||S.lastOrigin==p.origin&&p.origin&&(p.origin.charAt(0)=="+"&&S.lastModTime>_-(h.cm?h.cm.options.historyEventDelay:500)||p.origin.charAt(0)=="*"))&&(O=uc(S,S.lastOp==y)))V=ri(O.changes),ce(p.from,p.to)==0&&ce(p.from,V.to)==0?V.to=Ph(p):O.changes.push(If(h,p));else{var K=ri(S.done);for((!K||!K.ranges)&&Hc(h.sel,S.done),O={changes:[If(h,p)],generation:S.generation},S.done.push(O);S.done.length>S.undoDepth;)S.done.shift(),S.done[0].ranges||S.done.shift()}S.done.push(x),S.generation=++S.maxGeneration,S.lastModTime=S.lastSelTime=_,S.lastOp=S.lastSelOp=y,S.lastOrigin=S.lastSelOrigin=p.origin,V||oe(h,"historyAdded")}function Td(h,p,x,y){var S=p.charAt(0);return S=="*"||S=="+"&&x.ranges.length==y.ranges.length&&x.somethingSelected()==y.somethingSelected()&&new Date-h.history.lastSelTime<=(h.cm?h.cm.options.historyEventDelay:500)}function cc(h,p,x,y){var S=h.history,_=y&&y.origin;x==S.lastSelOp||_&&S.lastSelOrigin==_&&(S.lastModTime==S.lastSelTime&&S.lastOrigin==_||Td(h,_,ri(S.done),p))?S.done[S.done.length-1]=p:Hc(p,S.done),S.lastSelTime=+new Date,S.lastSelOrigin=_,S.lastSelOp=x,y&&y.clearRedo!==!1&&Kc(S.undone)}function Hc(h,p){var x=ri(p);x&&x.ranges&&x.equals(h)||p.push(h)}function Gu(h,p,x,y){var S=p["spans_"+h.id],_=0;h.iter(Math.max(h.first,x),Math.min(h.first+h.size,y),function(O){O.markedSpans&&((S||(S=p["spans_"+h.id]={}))[_]=O.markedSpans),++_})}function qs(h){if(!h)return null;for(var p,x=0;x<h.length;++x)h[x].marker.explicitlyCleared?p||(p=h.slice(0,x)):p&&p.push(h[x]);return p?p.length?p:null:h}function Mu(h,p){var x=p["spans_"+h.id];if(!x)return null;for(var y=[],S=0;S<p.text.length;++S)y.push(qs(x[S]));return y}function Of(h,p){var x=Mu(h,p),y=Ye(h,p);if(!x)return y;if(!y)return x;for(var S=0;S<x.length;++S){var _=x[S],O=y[S];if(_&&O)t:for(var V=0;V<O.length;++V){for(var K=O[V],et=0;et<_.length;++et)if(_[et].marker==K.marker)continue t;_.push(K)}else O&&(x[S]=O)}return x}function Xu(h,p,x){for(var y=[],S=0;S<h.length;++S){var _=h[S];if(_.ranges){y.push(x?El.prototype.deepCopy.call(_):_);continue}var O=_.changes,V=[];y.push({changes:V});for(var K=0;K<O.length;++K){var et=O[K],Lt=void 0;if(V.push({from:et.from,to:et.to,text:et.text}),p)for(var at in et)(Lt=at.match(/^spans_(\d+)$/))&&Zt(p,Number(Lt[1]))>-1&&(ri(V)[at]=et[at],delete et[at])}}return y}function Bf(h,p,x,y){if(y){var S=h.anchor;if(x){var _=ce(p,S)<0;_!=ce(x,S)<0?(S=p,p=x):_!=ce(p,x)<0&&(p=x)}return new Qr(S,p)}else return new Qr(x||p,p)}function Vc(h,p,x,y,S){S==null&&(S=h.cm&&(h.cm.display.shift||h.extend)),Is(h,new El([Bf(h.sel.primary(),p,x,S)],0),y)}function wn(h,p,x){for(var y=[],S=h.cm&&(h.cm.display.shift||h.extend),_=0;_<h.sel.ranges.length;_++)y[_]=Bf(h.sel.ranges[_],p[_],null,S);var O=Rl(h.cm,y,h.sel.primIndex);Is(h,O,x)}function ba(h,p,x,y){var S=h.sel.ranges.slice(0);S[p]=x,Is(h,Rl(h.cm,S,h.sel.primIndex),y)}function dc(h,p,x,y){Is(h,nu(p,x),y)}function U0(h,p,x){var y={ranges:p.ranges,update:function(S){this.ranges=[];for(var _=0;_<S.length;_++)this.ranges[_]=new Qr(Re(h,S[_].anchor),Re(h,S[_].head))},origin:x&&x.origin};return oe(h,"beforeSelectionChange",h,y),h.cm&&oe(h.cm,"beforeSelectionChange",h.cm,y),y.ranges!=p.ranges?Rl(h.cm,y.ranges,y.ranges.length-1):p}function Sa(h,p,x){var y=h.history.done,S=ri(y);S&&S.ranges?(y[y.length-1]=p,fc(h,p,x)):Is(h,p,x)}function Is(h,p,x){fc(h,p,x),cc(h,h.sel,h.cm?h.cm.curOp.id:NaN,x)}function fc(h,p,x){(Pi(h,"beforeSelectionChange")||h.cm&&Pi(h.cm,"beforeSelectionChange"))&&(p=U0(h,p,x));var y=x&&x.bias||(ce(p.primary().head,h.sel.primary().head)<0?-1:1);Z0(h,Yu(h,p,y,!0)),!(x&&x.scroll===!1)&&h.cm&&Ku(h.cm)}function Z0(h,p){p.equals(h.sel)||(h.sel=p,h.cm&&(h.cm.curOp.updateInput=1,h.cm.curOp.selectionChanged=!0,Ii(h.cm)),ai(h,"cursorActivity",h))}function Ff(h){Z0(h,Yu(h,h.sel,null,!1))}function Yu(h,p,x,y){for(var S,_=0;_<p.ranges.length;_++){var O=p.ranges[_],V=p.ranges.length==h.sel.ranges.length&&h.sel.ranges[_],K=Rf(h,O.anchor,V&&V.anchor,x,y),et=Rf(h,O.head,V&&V.head,x,y);(S||K!=O.anchor||et!=O.head)&&(S||(S=p.ranges.slice(0,_)),S[_]=new Qr(K,et))}return S?Rl(h.cm,S,p.primIndex):p}function la(h,p,x,y,S){var _=xt(h,p.line);if(_.markedSpans)for(var O=0;O<_.markedSpans.length;++O){var V=_.markedSpans[O],K=V.marker,et="selectLeft"in K?!K.selectLeft:K.inclusiveLeft,Lt="selectRight"in K?!K.selectRight:K.inclusiveRight;if((V.from==null||(et?V.from<=p.ch:V.from<p.ch))&&(V.to==null||(Lt?V.to>=p.ch:V.to>p.ch))){if(S&&(oe(K,"beforeCursorEnter"),K.explicitlyCleared))if(_.markedSpans){--O;continue}else break;if(!K.atomic)continue;if(x){var at=K.find(y<0?1:-1),ie=void 0;if((y<0?Lt:et)&&(at=Ju(h,at,-y,at&&at.line==p.line?_:null)),at&&at.line==p.line&&(ie=ce(at,x))&&(y<0?ie<0:ie>0))return la(h,at,p,y,S)}var Yt=K.find(y<0?-1:1);return(y<0?et:Lt)&&(Yt=Ju(h,Yt,y,Yt.line==p.line?_:null)),Yt?la(h,Yt,p,y,S):null}}return p}function Rf(h,p,x,y,S){var _=y||1,O=la(h,p,x,_,S)||!S&&la(h,p,x,_,!0)||la(h,p,x,-_,S)||!S&&la(h,p,x,-_,!0);return O||(h.cantEdit=!0,Tt(h.first,0))}function Ju(h,p,x,y){return x<0&&p.ch==0?p.line>h.first?Re(h,Tt(p.line-1)):null:x>0&&p.ch==(y||xt(h,p.line)).text.length?p.line<h.first+h.size-1?Tt(p.line+1,0):null:new Tt(p.line,p.ch+x)}function ms(h){h.setSelection(Tt(h.firstLine(),0),Tt(h.lastLine()),ye)}function Wc(h,p,x){var y={canceled:!1,from:p.from,to:p.to,text:p.text,origin:p.origin,cancel:function(){return y.canceled=!0}};return x&&(y.update=function(S,_,O,V){S&&(y.from=Re(h,S)),_&&(y.to=Re(h,_)),O&&(y.text=O),V!==void 0&&(y.origin=V)}),oe(h,"beforeChange",h,y),h.cm&&oe(h.cm,"beforeChange",h.cm,y),y.canceled?(h.cm&&(h.cm.curOp.updateInput=2),null):{from:y.from,to:y.to,text:y.text,origin:y.origin}}function qu(h,p,x){if(h.cm){if(!h.cm.curOp)return ks(h.cm,qu)(h,p,x);if(h.cm.state.suppressEdits)return}if(!((Pi(h,"beforeChange")||h.cm&&Pi(h.cm,"beforeChange"))&&(p=Wc(h,p,!0),!p))){var y=Ki&&!x&&Oi(h,p.from,p.to);if(y)for(var S=y.length-1;S>=0;--S)pc(h,{from:y[S].from,to:y[S].to,text:S?[""]:p.text,origin:p.origin});else pc(h,p)}}function pc(h,p){if(!(p.text.length==1&&p.text[0]==""&&ce(p.from,p.to)==0)){var x=_d(h,p);hc(h,p,x,h.cm?h.cm.curOp.id:NaN),mc(h,p,x,Ye(h,p));var y=[];ru(h,function(S,_){!_&&Zt(y,S.history)==-1&&(Pd(S.history,p),y.push(S.history)),mc(S,p,null,Ye(S,p))})}}function Qu(h,p,x){var y=h.cm&&h.cm.state.suppressEdits;if(!(y&&!x)){for(var S=h.history,_,O=h.sel,V=p=="undo"?S.done:S.undone,K=p=="undo"?S.undone:S.done,et=0;et<V.length&&(_=V[et],!(x?_.ranges&&!_.equals(h.sel):!_.ranges));et++);if(et!=V.length){for(S.lastOrigin=S.lastSelOrigin=null;;)if(_=V.pop(),_.ranges){if(Hc(_,K),x&&!_.equals(h.sel)){Is(h,_,{clearRedo:!1});return}O=_}else if(y){V.push(_);return}else break;var Lt=[];Hc(O,K),K.push({changes:Lt,generation:S.generation}),S.generation=_.generation||++S.maxGeneration;for(var at=Pi(h,"beforeChange")||h.cm&&Pi(h.cm,"beforeChange"),ie=function(si){var yi=_.changes[si];if(yi.origin=p,at&&!Wc(h,yi,!1))return V.length=0,{};Lt.push(If(h,yi));var Vi=si?_d(h,yi):ri(V);mc(h,yi,Vi,Of(h,yi)),!si&&h.cm&&h.cm.scrollIntoView({from:yi.from,to:Ph(yi)});var un=[];ru(h,function(qi,dn){!dn&&Zt(un,qi.history)==-1&&(Pd(qi.history,yi),un.push(qi.history)),mc(qi,yi,null,Of(qi,yi))})},Yt=_.changes.length-1;Yt>=0;--Yt){var Ge=ie(Yt);if(Ge)return Ge.v}}}}function zf(h,p){if(p!=0&&(h.first+=p,h.sel=new El(sn(h.sel.ranges,function(S){return new Qr(Tt(S.anchor.line+p,S.anchor.ch),Tt(S.head.line+p,S.head.ch))}),h.sel.primIndex),h.cm)){mo(h.cm,h.first,h.first-p,p);for(var x=h.cm.display,y=x.viewFrom;y<x.viewTo;y++)er(h.cm,y,"gutter")}}function mc(h,p,x,y){if(h.cm&&!h.cm.curOp)return ks(h.cm,mc)(h,p,x,y);if(p.to.line<h.first){zf(h,p.text.length-1-(p.to.line-p.from.line));return}if(!(p.from.line>h.lastLine())){if(p.from.line<h.first){var S=p.text.length-1-(h.first-p.from.line);zf(h,S),p={from:Tt(h.first,0),to:Tt(p.to.line+S,p.to.ch),text:[ri(p.text)],origin:p.origin}}var _=h.lastLine();p.to.line>_&&(p={from:p.from,to:Tt(_,xt(h,_).text.length),text:[p.text[0]],origin:p.origin}),p.removed=Ot(h,p.from,p.to),x||(x=_d(h,p)),h.cm?G0(h.cm,p,y):Df(h,p,y),fc(h,x,ye),h.cantEdit&&Rf(h,Tt(h.firstLine(),0))&&(h.cantEdit=!1)}}function G0(h,p,x){var y=h.doc,S=h.display,_=p.from,O=p.to,V=!1,K=_.line;h.options.lineWrapping||(K=lt(Ji(xt(y,_.line))),y.iter(K,O.line+1,function(Yt){if(Yt==S.maxLine)return V=!0,!0})),y.sel.contains(p.from,p.to)>-1&&Ii(h),Df(y,p,x,Mr(h)),h.options.lineWrapping||(y.iter(K,_.line+p.text.length,function(Yt){var Ge=ko(Yt);Ge>S.maxLineLength&&(S.maxLine=Yt,S.maxLineLength=Ge,S.maxLineChanged=!0,V=!1)}),V&&(h.curOp.updateMaxLine=!0)),di(y,_.line),nc(h,400);var et=p.text.length-(O.line-_.line)-1;p.full?mo(h):_.line==O.line&&p.text.length==1&&!zp(h.doc,p)?er(h,_.line,"text"):mo(h,_.line,O.line+1,et);var Lt=Pi(h,"changes"),at=Pi(h,"change");if(at||Lt){var ie={from:_,to:O,text:p.text,removed:p.removed,origin:p.origin};at&&ai(h,"change",h,ie),Lt&&(h.curOp.changeObjs||(h.curOp.changeObjs=[])).push(ie)}h.display.selForContextMenu=null}function Uc(h,p,x,y,S){var _;y||(y=x),ce(y,x)<0&&(_=[y,x],x=_[0],y=_[1]),typeof p=="string"&&(p=h.splitLines(p)),qu(h,{from:x,to:y,text:p,origin:S})}function zl(h,p,x,y){x<h.line?h.line+=y:p<h.line&&(h.line=p,h.ch=0)}function mg(h,p,x,y){for(var S=0;S<h.length;++S){var _=h[S],O=!0;if(_.ranges){_.copied||(_=h[S]=_.deepCopy(),_.copied=!0);for(var V=0;V<_.ranges.length;V++)zl(_.ranges[V].anchor,p,x,y),zl(_.ranges[V].head,p,x,y);continue}for(var K=0;K<_.changes.length;++K){var et=_.changes[K];if(x<et.from.line)et.from=Tt(et.from.line+y,et.from.ch),et.to=Tt(et.to.line+y,et.to.ch);else if(p<=et.to.line){O=!1;break}}O||(h.splice(0,S+1),S=0)}}function Pd(h,p){var x=p.from.line,y=p.to.line,S=p.text.length-(y-x)-1;mg(h.done,x,y,S),mg(h.undone,x,y,S)}function Zc(h,p,x,y){var S=p,_=p;return typeof p=="number"?_=xt(h,qe(h,p)):S=lt(p),S==null?null:(y(_,S)&&h.cm&&er(h.cm,S,x),_)}function Nh(h){this.lines=h,this.parent=null;for(var p=0,x=0;x<h.length;++x)h[x].parent=this,p+=h[x].height;this.height=p}Nh.prototype={chunkSize:function(){return this.lines.length},removeInner:function(h,p){for(var x=h,y=h+p;x<y;++x){var S=this.lines[x];this.height-=S.height,Ps(S),ai(S,"delete")}this.lines.splice(h,p)},collapse:function(h){h.push.apply(h,this.lines)},insertInner:function(h,p,x){this.height+=x,this.lines=this.lines.slice(0,h).concat(p).concat(this.lines.slice(h));for(var y=0;y<p.length;++y)p[y].parent=this},iterN:function(h,p,x){for(var y=h+p;h<y;++h)if(x(this.lines[h]))return!0}};function Ho(h){this.children=h;for(var p=0,x=0,y=0;y<h.length;++y){var S=h[y];p+=S.chunkSize(),x+=S.height,S.parent=this}this.size=p,this.height=x,this.parent=null}Ho.prototype={chunkSize:function(){return this.size},removeInner:function(h,p){this.size-=p;for(var x=0;x<this.children.length;++x){var y=this.children[x],S=y.chunkSize();if(h<S){var _=Math.min(p,S-h),O=y.height;if(y.removeInner(h,_),this.height-=O-y.height,S==_&&(this.children.splice(x--,1),y.parent=null),(p-=_)==0)break;h=0}else h-=S}if(this.size-p<25&&(this.children.length>1||!(this.children[0]instanceof Nh))){var V=[];this.collapse(V),this.children=[new Nh(V)],this.children[0].parent=this}},collapse:function(h){for(var p=0;p<this.children.length;++p)this.children[p].collapse(h)},insertInner:function(h,p,x){this.size+=p.length,this.height+=x;for(var y=0;y<this.children.length;++y){var S=this.children[y],_=S.chunkSize();if(h<=_){if(S.insertInner(h,p,x),S.lines&&S.lines.length>50){for(var O=S.lines.length%25+25,V=O;V<S.lines.length;){var K=new Nh(S.lines.slice(V,V+=25));S.height-=K.height,this.children.splice(++y,0,K),K.parent=this}S.lines=S.lines.slice(0,O),this.maybeSpill()}break}h-=_}},maybeSpill:function(){if(!(this.children.length<=10)){var h=this;do{var p=h.children.splice(h.children.length-5,5),x=new Ho(p);if(h.parent){h.size-=x.size,h.height-=x.height;var S=Zt(h.parent.children,h);h.parent.children.splice(S+1,0,x)}else{var y=new Ho(h.children);y.parent=h,h.children=[y,x],h=y}x.parent=h.parent}while(h.children.length>10);h.parent.maybeSpill()}},iterN:function(h,p,x){for(var y=0;y<this.children.length;++y){var S=this.children[y],_=S.chunkSize();if(h<_){var O=Math.min(p,_-h);if(S.iterN(h,O,x))return!0;if((p-=O)==0)break;h=0}else h-=_}}};var th=function(h,p,x){if(x)for(var y in x)x.hasOwnProperty(y)&&(this[y]=x[y]);this.doc=h,this.node=p};th.prototype.clear=function(){var h=this.doc.cm,p=this.line.widgets,x=this.line,y=lt(x);if(!(y==null||!p)){for(var S=0;S<p.length;++S)p[S]==this&&p.splice(S--,1);p.length||(x.widgets=null);var _=Ys(this);te(x,Math.max(0,x.height-_)),h&&(yr(h,function(){gg(h,x,-_),er(h,y,"widget")}),ai(h,"lineWidgetCleared",h,this,y))}},th.prototype.changed=function(){var h=this,p=this.height,x=this.doc.cm,y=this.line;this.height=null;var S=Ys(this)-p;S&&(ii(this.doc,y)||te(y,y.height+S),x&&yr(x,function(){x.curOp.forceUpdate=!0,gg(x,y,S),ai(x,"lineWidgetChanged",x,h,lt(y))}))},_i(th);function gg(h,p,x){wr(p)<(h.curOp&&h.curOp.scrollTop||h.doc.scrollTop)&&Tf(h,x)}function jf(h,p,x,y){var S=new th(h,x,y),_=h.cm;return _&&S.noHScroll&&(_.display.alignWidgets=!0),Zc(h,p,"widget",function(O){var V=O.widgets||(O.widgets=[]);if(S.insertAt==null?V.push(S):V.splice(Math.min(V.length-1,Math.max(0,S.insertAt)),0,S),S.line=O,_&&!ii(h,O)){var K=wr(O)<h.scrollTop;te(O,O.height+Ys(S)),K&&Tf(_,S.height),_.curOp.forceUpdate=!0}return!0}),_&&ai(_,"lineWidgetAdded",_,S,typeof p=="number"?p:lt(p)),S}var vg=0,wt=function(h,p){this.lines=[],this.type=p,this.doc=h,this.id=++vg};wt.prototype.clear=function(){if(!this.explicitlyCleared){var h=this.doc.cm,p=h&&!h.curOp;if(p&&Ch(h),Pi(this,"clear")){var x=this.find();x&&ai(this,"clear",x.from,x.to)}for(var y=null,S=null,_=0;_<this.lines.length;++_){var O=this.lines[_],V=Qi(O.markedSpans,this);h&&!this.collapsed?er(h,lt(O),"text"):h&&(V.to!=null&&(S=lt(O)),V.from!=null&&(y=lt(O))),O.markedSpans=Ti(O.markedSpans,V),V.from==null&&this.collapsed&&!ii(this.doc,O)&&h&&te(O,iu(h.display))}if(h&&this.collapsed&&!h.options.lineWrapping)for(var K=0;K<this.lines.length;++K){var et=Ji(this.lines[K]),Lt=ko(et);Lt>h.display.maxLineLength&&(h.display.maxLine=et,h.display.maxLineLength=Lt,h.display.maxLineChanged=!0)}y!=null&&h&&this.collapsed&&mo(h,y,S+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,h&&Ff(h.doc)),h&&ai(h,"markerCleared",h,this,y,S),p&&Zu(h),this.parent&&this.parent.clear()}},wt.prototype.find=function(h,p){h==null&&this.type=="bookmark"&&(h=1);for(var x,y,S=0;S<this.lines.length;++S){var _=this.lines[S],O=Qi(_.markedSpans,this);if(O.from!=null&&(x=Tt(p?_:lt(_),O.from),h==-1))return x;if(O.to!=null&&(y=Tt(p?_:lt(_),O.to),h==1))return y}return x&&{from:x,to:y}},wt.prototype.changed=function(){var h=this,p=this.find(-1,!0),x=this,y=this.doc.cm;!p||!y||yr(y,function(){var S=p.line,_=lt(p.line),O=aa(y,_);if(O&&(ho(O),y.curOp.selectionChanged=y.curOp.forceUpdate=!0),y.curOp.updateMaxLine=!0,!ii(x.doc,S)&&x.height!=null){var V=x.height;x.height=null;var K=Ys(x)-V;K&&te(S,S.height+K)}ai(y,"markerChanged",y,h)})},wt.prototype.attachLine=function(h){if(!this.lines.length&&this.doc.cm){var p=this.doc.cm.curOp;(!p.maybeHiddenMarkers||Zt(p.maybeHiddenMarkers,this)==-1)&&(p.maybeUnhiddenMarkers||(p.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(h)},wt.prototype.detachLine=function(h){if(this.lines.splice(Zt(this.lines,h),1),!this.lines.length&&this.doc.cm){var p=this.doc.cm.curOp;(p.maybeHiddenMarkers||(p.maybeHiddenMarkers=[])).push(this)}},_i(wt);function eh(h,p,x,y,S){if(y&&y.shared)return Vo(h,p,x,y,S);if(h.cm&&!h.cm.curOp)return ks(h.cm,eh)(h,p,x,y,S);var _=new wt(h,S),O=ce(p,x);if(y&&Se(y,_,!1),O>0||O==0&&_.clearWhenEmpty!==!1)return _;if(_.replacedWith&&(_.collapsed=!0,_.widgetNode=We("span",[_.replacedWith],"CodeMirror-widget"),y.handleMouseEvents||_.widgetNode.setAttribute("cm-ignore-events","true"),y.insertLeft&&(_.widgetNode.insertLeft=!0)),_.collapsed){if(Sn(h,p.line,p,x,_)||p.line!=x.line&&Sn(h,x.line,p,x,_))throw new Error("Inserting collapsed marker partially overlapping an existing one");At()}_.addToHistory&&hc(h,{from:p,to:x,origin:"markText"},h.sel,NaN);var V=p.line,K=h.cm,et;if(h.iter(V,x.line+1,function(at){K&&_.collapsed&&!K.options.lineWrapping&&Ji(at)==K.display.maxLine&&(et=!0),_.collapsed&&V!=p.line&&te(at,0),gn(at,new vi(_,V==p.line?p.ch:null,V==x.line?x.ch:null)),++V}),_.collapsed&&h.iter(p.line,x.line+1,function(at){ii(h,at)&&te(at,0)}),_.clearOnEnter&&ei(_,"beforeCursorEnter",function(){return _.clear()}),_.readOnly&&(Ri(),(h.history.done.length||h.history.undone.length)&&h.clearHistory()),_.collapsed&&(_.id=++vg,_.atomic=!0),K){if(et&&(K.curOp.updateMaxLine=!0),_.collapsed)mo(K,p.line,x.line+1);else if(_.className||_.startStyle||_.endStyle||_.css||_.attributes||_.title)for(var Lt=p.line;Lt<=x.line;Lt++)er(K,Lt,"text");_.atomic&&Ff(K.doc),ai(K,"markerAdded",K,_)}return _}var fr=function(h,p){this.markers=h,this.primary=p;for(var x=0;x<h.length;++x)h[x].parent=this};fr.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var h=0;h<this.markers.length;++h)this.markers[h].clear();ai(this,"clear")}},fr.prototype.find=function(h,p){return this.primary.find(h,p)},_i(fr);function Vo(h,p,x,y,S){y=Se(y),y.shared=!1;var _=[eh(h,p,x,y,S)],O=_[0],V=y.widgetNode;return ru(h,function(K){V&&(y.widgetNode=V.cloneNode(!0)),_.push(eh(K,Re(K,p),Re(K,x),y,S));for(var et=0;et<K.linked.length;++et)if(K.linked[et].isParent)return;O=ri(_)}),new fr(_,O)}function Ah(h){return h.findMarks(Tt(h.first,0),h.clipPos(Tt(h.lastLine())),function(p){return p.parent})}function X0(h,p){for(var x=0;x<p.length;x++){var y=p[x],S=y.find(),_=h.clipPos(S.from),O=h.clipPos(S.to);if(ce(_,O)){var V=eh(h,_,O,y.primary,y.primary.type);y.markers.push(V),V.parent=y}}}function cl(h){for(var p=function(y){var S=h[y],_=[S.primary.doc];ru(S.primary.doc,function(K){return _.push(K)});for(var O=0;O<S.markers.length;O++){var V=S.markers[O];Zt(_,V.doc)==-1&&(V.parent=null,S.markers.splice(O--,1))}},x=0;x<h.length;x++)p(x)}var yg=0,os=function(h,p,x,y,S){if(!(this instanceof os))return new os(h,p,x,y,S);x==null&&(x=0),Ho.call(this,[new Nh([new po("",null)])]),this.first=x,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=x;var _=Tt(x,0);this.sel=nu(_),this.history=new $c(null),this.id=++yg,this.modeOption=p,this.lineSep=y,this.direction=S=="rtl"?"rtl":"ltr",this.extend=!1,typeof h=="string"&&(h=this.splitLines(h)),Df(this,{from:_,to:_,text:h}),Is(this,nu(_),ye)};os.prototype=P(Ho.prototype,{constructor:os,iter:function(h,p,x){x?this.iterN(h-this.first,p-h,x):this.iterN(this.first,this.first+this.size,h)},insert:function(h,p){for(var x=0,y=0;y<p.length;++y)x+=p[y].height;this.insertInner(h-this.first,p,x)},remove:function(h,p){this.removeInner(h-this.first,p)},getValue:function(h){var p=ge(this,this.first,this.first+this.size);return h===!1?p:p.join(h||this.lineSeparator())},setValue:$s(function(h){var p=Tt(this.first,0),x=this.first+this.size-1;qu(this,{from:p,to:Tt(x,xt(this,x).text.length),text:this.splitLines(h),origin:"setValue",full:!0},!0),this.cm&&Mh(this.cm,0,0),Is(this,nu(p),ye)}),replaceRange:function(h,p,x,y){p=Re(this,p),x=x?Re(this,x):p,Uc(this,h,p,x,y)},getRange:function(h,p,x){var y=Ot(this,Re(this,h),Re(this,p));return x===!1?y:y.join(x||this.lineSeparator())},getLine:function(h){var p=this.getLineHandle(h);return p&&p.text},getLineHandle:function(h){if(me(this,h))return xt(this,h)},getLineNumber:function(h){return lt(h)},getLineHandleVisualStart:function(h){return typeof h=="number"&&(h=xt(this,h)),Ji(h)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(h){return Re(this,h)},getCursor:function(h){var p=this.sel.primary(),x;return h==null||h=="head"?x=p.head:h=="anchor"?x=p.anchor:h=="end"||h=="to"||h===!1?x=p.to():x=p.from(),x},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:$s(function(h,p,x){dc(this,Re(this,typeof h=="number"?Tt(h,p||0):h),null,x)}),setSelection:$s(function(h,p,x){dc(this,Re(this,h),Re(this,p||h),x)}),extendSelection:$s(function(h,p,x){Vc(this,Re(this,h),p&&Re(this,p),x)}),extendSelections:$s(function(h,p){wn(this,Ut(this,h),p)}),extendSelectionsBy:$s(function(h,p){var x=sn(this.sel.ranges,h);wn(this,Ut(this,x),p)}),setSelections:$s(function(h,p,x){if(h.length){for(var y=[],S=0;S<h.length;S++)y[S]=new Qr(Re(this,h[S].anchor),Re(this,h[S].head));p==null&&(p=Math.min(h.length-1,this.sel.primIndex)),Is(this,Rl(this.cm,y,p),x)}}),addSelection:$s(function(h,p,x){var y=this.sel.ranges.slice(0);y.push(new Qr(Re(this,h),Re(this,p||h))),Is(this,Rl(this.cm,y,y.length-1),x)}),getSelection:function(h){for(var p=this.sel.ranges,x,y=0;y<p.length;y++){var S=Ot(this,p[y].from(),p[y].to());x=x?x.concat(S):S}return h===!1?x:x.join(h||this.lineSeparator())},getSelections:function(h){for(var p=[],x=this.sel.ranges,y=0;y<x.length;y++){var S=Ot(this,x[y].from(),x[y].to());h!==!1&&(S=S.join(h||this.lineSeparator())),p[y]=S}return p},replaceSelection:function(h,p,x){for(var y=[],S=0;S<this.sel.ranges.length;S++)y[S]=h;this.replaceSelections(y,p,x||"+input")},replaceSelections:$s(function(h,p,x){for(var y=[],S=this.sel,_=0;_<S.ranges.length;_++){var O=S.ranges[_];y[_]={from:O.from(),to:O.to(),text:this.splitLines(h[_]),origin:x}}for(var V=p&&p!="end"&&ac(this,y,p),K=y.length-1;K>=0;K--)qu(this,y[K]);V?Sa(this,V):this.cm&&Ku(this.cm)}),undo:$s(function(){Qu(this,"undo")}),redo:$s(function(){Qu(this,"redo")}),undoSelection:$s(function(){Qu(this,"undo",!0)}),redoSelection:$s(function(){Qu(this,"redo",!0)}),setExtending:function(h){this.extend=h},getExtending:function(){return this.extend},historySize:function(){for(var h=this.history,p=0,x=0,y=0;y<h.done.length;y++)h.done[y].ranges||++p;for(var S=0;S<h.undone.length;S++)h.undone[S].ranges||++x;return{undo:p,redo:x}},clearHistory:function(){var h=this;this.history=new $c(this.history.maxGeneration),ru(this,function(p){return p.history=h.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(h){return h&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(h){return this.history.generation==(h||this.cleanGeneration)},getHistory:function(){return{done:Xu(this.history.done),undone:Xu(this.history.undone)}},setHistory:function(h){var p=this.history=new $c(this.history.maxGeneration);p.done=Xu(h.done.slice(0),null,!0),p.undone=Xu(h.undone.slice(0),null,!0)},setGutterMarker:$s(function(h,p,x){return Zc(this,h,"gutter",function(y){var S=y.gutterMarkers||(y.gutterMarkers={});return S[p]=x,!x&&D(S)&&(y.gutterMarkers=null),!0})}),clearGutter:$s(function(h){var p=this;this.iter(function(x){x.gutterMarkers&&x.gutterMarkers[h]&&Zc(p,x,"gutter",function(){return x.gutterMarkers[h]=null,D(x.gutterMarkers)&&(x.gutterMarkers=null),!0})})}),lineInfo:function(h){var p;if(typeof h=="number"){if(!me(this,h)||(p=h,h=xt(this,h),!h))return null}else if(p=lt(h),p==null)return null;return{line:p,handle:h,text:h.text,gutterMarkers:h.gutterMarkers,textClass:h.textClass,bgClass:h.bgClass,wrapClass:h.wrapClass,widgets:h.widgets}},addLineClass:$s(function(h,p,x){return Zc(this,h,p=="gutter"?"gutter":"class",function(y){var S=p=="text"?"textClass":p=="background"?"bgClass":p=="gutter"?"gutterClass":"wrapClass";if(!y[S])y[S]=x;else{if(q(x).test(y[S]))return!1;y[S]+=" "+x}return!0})}),removeLineClass:$s(function(h,p,x){return Zc(this,h,p=="gutter"?"gutter":"class",function(y){var S=p=="text"?"textClass":p=="background"?"bgClass":p=="gutter"?"gutterClass":"wrapClass",_=y[S];if(_)if(x==null)y[S]=null;else{var O=_.match(q(x));if(!O)return!1;var V=O.index+O[0].length;y[S]=_.slice(0,O.index)+(!O.index||V==_.length?"":" ")+_.slice(V)||null}else return!1;return!0})}),addLineWidget:$s(function(h,p,x){return jf(this,h,p,x)}),removeLineWidget:function(h){h.clear()},markText:function(h,p,x){return eh(this,Re(this,h),Re(this,p),x,x&&x.type||"range")},setBookmark:function(h,p){var x={replacedWith:p&&(p.nodeType==null?p.widget:p),insertLeft:p&&p.insertLeft,clearWhenEmpty:!1,shared:p&&p.shared,handleMouseEvents:p&&p.handleMouseEvents};return h=Re(this,h),eh(this,h,h,x,"bookmark")},findMarksAt:function(h){h=Re(this,h);var p=[],x=xt(this,h.line).markedSpans;if(x)for(var y=0;y<x.length;++y){var S=x[y];(S.from==null||S.from<=h.ch)&&(S.to==null||S.to>=h.ch)&&p.push(S.marker.parent||S.marker)}return p},findMarks:function(h,p,x){h=Re(this,h),p=Re(this,p);var y=[],S=h.line;return this.iter(h.line,p.line+1,function(_){var O=_.markedSpans;if(O)for(var V=0;V<O.length;V++){var K=O[V];!(K.to!=null&&S==h.line&&h.ch>=K.to||K.from==null&&S!=h.line||K.from!=null&&S==p.line&&K.from>=p.ch)&&(!x||x(K.marker))&&y.push(K.marker.parent||K.marker)}++S}),y},getAllMarks:function(){var h=[];return this.iter(function(p){var x=p.markedSpans;if(x)for(var y=0;y<x.length;++y)x[y].from!=null&&h.push(x[y].marker)}),h},posFromIndex:function(h){var p,x=this.first,y=this.lineSeparator().length;return this.iter(function(S){var _=S.text.length+y;if(_>h)return p=h,!0;h-=_,++x}),Re(this,Tt(x,p))},indexFromPos:function(h){h=Re(this,h);var p=h.ch;if(h.line<this.first||h.ch<0)return 0;var x=this.lineSeparator().length;return this.iter(this.first,h.line,function(y){p+=y.text.length+x}),p},copy:function(h){var p=new os(ge(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return p.scrollTop=this.scrollTop,p.scrollLeft=this.scrollLeft,p.sel=this.sel,p.extend=!1,h&&(p.history.undoDepth=this.history.undoDepth,p.setHistory(this.getHistory())),p},linkedDoc:function(h){h||(h={});var p=this.first,x=this.first+this.size;h.from!=null&&h.from>p&&(p=h.from),h.to!=null&&h.to<x&&(x=h.to);var y=new os(ge(this,p,x),h.mode||this.modeOption,p,this.lineSep,this.direction);return h.sharedHist&&(y.history=this.history),(this.linked||(this.linked=[])).push({doc:y,sharedHist:h.sharedHist}),y.linked=[{doc:this,isParent:!0,sharedHist:h.sharedHist}],X0(y,Ah(this)),y},unlinkDoc:function(h){if(h instanceof Bn&&(h=h.doc),this.linked)for(var p=0;p<this.linked.length;++p){var x=this.linked[p];if(x.doc==h){this.linked.splice(p,1),h.unlinkDoc(this),cl(Ah(this));break}}if(h.history==this.history){var y=[h.id];ru(h,function(S){return y.push(S.id)},!0),h.history=new $c(null),h.history.done=Xu(this.history.done,y),h.history.undone=Xu(this.history.undone,y)}},iterLinkedDocs:function(h){ru(this,h)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(h){return this.lineSep?h.split(this.lineSep):Ir(h)},lineSeparator:function(){return this.lineSep||`
`},setDirection:$s(function(h){h!="rtl"&&(h="ltr"),h!=this.direction&&(this.direction=h,this.iter(function(p){return p.order=null}),this.cm&&jp(this.cm))})}),os.prototype.eachLine=os.prototype.iter;var Nd=0;function Y0(h){var p=this;if(Ad(p),!(we(p,h)||Rs(p.display,h))){hn(h),ut&&(Nd=+new Date);var x=Cs(p,h,!0),y=h.dataTransfer.files;if(!(!x||p.isReadOnly()))if(y&&y.length&&window.FileReader&&window.File)for(var S=y.length,_=Array(S),O=0,V=function(){++O==S&&ks(p,function(){x=Re(p.doc,x);var Yt={from:x,to:x,text:p.doc.splitLines(_.filter(function(Ge){return Ge!=null}).join(p.doc.lineSeparator())),origin:"paste"};qu(p.doc,Yt),Sa(p.doc,nu(Re(p.doc,x),Re(p.doc,Ph(Yt))))})()},K=function(Yt,Ge){if(p.options.allowDropFileTypes&&Zt(p.options.allowDropFileTypes,Yt.type)==-1){V();return}var si=new FileReader;si.onerror=function(){return V()},si.onload=function(){var yi=si.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(yi)){V();return}_[Ge]=yi,V()},si.readAsText(Yt)},et=0;et<y.length;et++)K(y[et],et);else{if(p.state.draggingText&&p.doc.sel.contains(x)>-1){p.state.draggingText(h),setTimeout(function(){return p.display.input.focus()},20);return}try{var Lt=h.dataTransfer.getData("Text");if(Lt){var at;if(p.state.draggingText&&!p.state.draggingText.copy&&(at=p.listSelections()),fc(p.doc,nu(x,x)),at)for(var ie=0;ie<at.length;++ie)Uc(p.doc,"",at[ie].anchor,at[ie].head,"drag");p.replaceSelection(Lt,"around","paste"),p.display.input.focus()}}catch(Yt){}}}}function xg(h,p){if(ut&&(!h.state.draggingText||+new Date-Nd<100)){jn(p);return}if(!(we(h,p)||Rs(h.display,p))&&(p.dataTransfer.setData("Text",h.getSelection()),p.dataTransfer.effectAllowed="copyMove",p.dataTransfer.setDragImage&&!be)){var x=Vt("img",null,null,"position: fixed; left: 0; top: 0;");x.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",yt&&(x.width=x.height=1,h.display.wrapper.appendChild(x),x._top=x.offsetTop),p.dataTransfer.setDragImage(x,0,0),yt&&x.parentNode.removeChild(x)}}function $p(h,p){var x=Cs(h,p);if(x){var y=document.createDocumentFragment();Cr(h,x,y),h.display.dragCursor||(h.display.dragCursor=Vt("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),h.display.lineSpace.insertBefore(h.display.dragCursor,h.display.cursorDiv)),ve(h.display.dragCursor,y)}}function Ad(h){h.display.dragCursor&&(h.display.lineSpace.removeChild(h.display.dragCursor),h.display.dragCursor=null)}function Dd(h){if(document.getElementsByClassName){for(var p=document.getElementsByClassName("CodeMirror"),x=[],y=0;y<p.length;y++){var S=p[y].CodeMirror;S&&x.push(S)}x.length&&x[0].operation(function(){for(var _=0;_<x.length;_++)h(x[_])})}}var zi=!1;function Ga(){zi||(Dh(),zi=!0)}function Dh(){var h;ei(window,"resize",function(){h==null&&(h=setTimeout(function(){h=null,Dd(Id)},100))}),ei(window,"blur",function(){return Dd(ic)})}function Id(h){var p=h.display;p.cachedCharWidth=p.cachedTextHeight=p.cachedPaddingH=null,p.scrollbarsClipped=!1,h.setSize()}for(var jl={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},$f=0;$f<10;$f++)jl[$f+48]=jl[$f+96]=String($f);for(var Kp=65;Kp<=90;Kp++)jl[Kp]=String.fromCharCode(Kp);for(var Kf=1;Kf<=12;Kf++)jl[Kf+111]=jl[Kf+63235]="F"+Kf;var to={};to.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},to.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},to.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},to.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},to.default=Ht?to.macDefault:to.pcDefault;function J0(h){var p=h.split(/-(?!$)/);h=p[p.length-1];for(var x,y,S,_,O=0;O<p.length-1;O++){var V=p[O];if(/^(cmd|meta|m)$/i.test(V))_=!0;else if(/^a(lt)?$/i.test(V))x=!0;else if(/^(c|ctrl|control)$/i.test(V))y=!0;else if(/^s(hift)?$/i.test(V))S=!0;else throw new Error("Unrecognized modifier name: "+V)}return x&&(h="Alt-"+h),y&&(h="Ctrl-"+h),_&&(h="Cmd-"+h),S&&(h="Shift-"+h),h}function Hf(h){var p={};for(var x in h)if(h.hasOwnProperty(x)){var y=h[x];if(/^(name|fallthrough|(de|at)tach)$/.test(x))continue;if(y=="..."){delete h[x];continue}for(var S=sn(x.split(" "),J0),_=0;_<S.length;_++){var O=void 0,V=void 0;_==S.length-1?(V=S.join(" "),O=y):(V=S.slice(0,_+1).join(" "),O="...");var K=p[V];if(!K)p[V]=O;else if(K!=O)throw new Error("Inconsistent bindings for "+V)}delete h[x]}for(var et in p)h[et]=p[et];return h}function Xa(h,p,x,y){p=ua(p);var S=p.call?p.call(h,y):p[h];if(S===!1)return"nothing";if(S==="...")return"multi";if(S!=null&&x(S))return"handled";if(p.fallthrough){if(Object.prototype.toString.call(p.fallthrough)!="[object Array]")return Xa(h,p.fallthrough,x,y);for(var _=0;_<p.fallthrough.length;_++){var O=Xa(h,p.fallthrough[_],x,y);if(O)return O}}}function Ih(h){var p=typeof h=="string"?h:jl[h.keyCode];return p=="Ctrl"||p=="Alt"||p=="Shift"||p=="Mod"}function Oh(h,p,x){var y=h;return p.altKey&&y!="Alt"&&(h="Alt-"+h),(Xt?p.metaKey:p.ctrlKey)&&y!="Ctrl"&&(h="Ctrl-"+h),(Xt?p.ctrlKey:p.metaKey)&&y!="Mod"&&(h="Cmd-"+h),!x&&p.shiftKey&&y!="Shift"&&(h="Shift-"+h),h}function Gc(h,p){if(yt&&h.keyCode==34&&h.char)return!1;var x=jl[h.keyCode];return x==null||h.altGraphKey?!1:(h.keyCode==3&&h.code&&(x=h.code),Oh(x,h,p))}function ua(h){return typeof h=="string"?to[h]:h}function Vs(h,p){for(var x=h.doc.sel.ranges,y=[],S=0;S<x.length;S++){for(var _=p(x[S]);y.length&&ce(_.from,ri(y).to)<=0;){var O=y.pop();if(ce(O.from,_.from)<0){_.from=O.from;break}}y.push(_)}yr(h,function(){for(var V=y.length-1;V>=0;V--)Uc(h.doc,"",y[V].from,y[V].to,"+delete");Ku(h)})}function Ma(h,p,x){var y=$e(h.text,p+x,x);return y<0||y>h.text.length?null:y}function bo(h,p,x){var y=Ma(h,p.ch,x);return y==null?null:new Tt(p.line,y,x<0?"after":"before")}function Bh(h,p,x,y,S){if(h){p.doc.direction=="rtl"&&(S=-S);var _=Ci(x,p.doc.direction);if(_){var O=S<0?ri(_):_[0],V=S<0==(O.level==1),K=V?"after":"before",et;if(O.level>0||p.doc.direction=="rtl"){var Lt=zs(p,x);et=S<0?x.text.length-1:0;var at=Wr(p,Lt,et).top;et=Ae(function(ie){return Wr(p,Lt,ie).top==at},S<0==(O.level==1)?O.from:O.to-1,et),K=="before"&&(et=Ma(x,et,1))}else et=S<0?O.to:O.from;return new Tt(y,et,K)}}return new Tt(y,S<0?x.text.length:0,S<0?"before":"after")}function $l(h,p,x,y){var S=Ci(p,h.doc.direction);if(!S)return bo(p,x,y);x.ch>=p.text.length?(x.ch=p.text.length,x.sticky="before"):x.ch<=0&&(x.ch=0,x.sticky="after");var _=Si(S,x.ch,x.sticky),O=S[_];if(h.doc.direction=="ltr"&&O.level%2==0&&(y>0?O.to>x.ch:O.from<x.ch))return bo(p,x,y);var V=function(Vi,un){return Ma(p,Vi instanceof Tt?Vi.ch:Vi,un)},K,et=function(Vi){return h.options.lineWrapping?(K=K||zs(h,p),kd(h,p,K,Vi)):{begin:0,end:p.text.length}},Lt=et(x.sticky=="before"?V(x,-1):x.ch);if(h.doc.direction=="rtl"||O.level==1){var at=O.level==1==y<0,ie=V(x,at?1:-1);if(ie!=null&&(at?ie<=O.to&&ie<=Lt.end:ie>=O.from&&ie>=Lt.begin)){var Yt=at?"before":"after";return new Tt(x.line,ie,Yt)}}var Ge=function(Vi,un,qi){for(var dn=function(To,Ws){return Ws?new Tt(x.line,V(To,1),"before"):new Tt(x.line,To,"after")};Vi>=0&&Vi<S.length;Vi+=un){var Dn=S[Vi],en=un>0==(Dn.level!=1),lr=en?qi.begin:V(qi.end,-1);if(Dn.from<=lr&&lr<Dn.to||(lr=en?Dn.from:V(Dn.to,-1),qi.begin<=lr&&lr<qi.end))return dn(lr,en)}},si=Ge(_+y,y,Lt);if(si)return si;var yi=y>0?Lt.end:V(Lt.begin,-1);return yi!=null&&!(y>0&&yi==p.text.length)&&(si=Ge(y>0?0:S.length-1,y,et(yi)),si)?si:null}var Fh={selectAll:ms,singleSelection:function(h){return h.setSelection(h.getCursor("anchor"),h.getCursor("head"),ye)},killLine:function(h){return Vs(h,function(p){if(p.empty()){var x=xt(h.doc,p.head.line).text.length;return p.head.ch==x&&p.head.line<h.lastLine()?{from:p.head,to:Tt(p.head.line+1,0)}:{from:p.head,to:Tt(p.head.line,x)}}else return{from:p.from(),to:p.to()}})},deleteLine:function(h){return Vs(h,function(p){return{from:Tt(p.from().line,0),to:Re(h.doc,Tt(p.to().line+1,0))}})},delLineLeft:function(h){return Vs(h,function(p){return{from:Tt(p.from().line,0),to:p.from()}})},delWrappedLineLeft:function(h){return Vs(h,function(p){var x=h.charCoords(p.head,"div").top+5,y=h.coordsChar({left:0,top:x},"div");return{from:y,to:p.from()}})},delWrappedLineRight:function(h){return Vs(h,function(p){var x=h.charCoords(p.head,"div").top+5,y=h.coordsChar({left:h.display.lineDiv.offsetWidth+100,top:x},"div");return{from:p.from(),to:y}})},undo:function(h){return h.undo()},redo:function(h){return h.redo()},undoSelection:function(h){return h.undoSelection()},redoSelection:function(h){return h.redoSelection()},goDocStart:function(h){return h.extendSelection(Tt(h.firstLine(),0))},goDocEnd:function(h){return h.extendSelection(Tt(h.lastLine()))},goLineStart:function(h){return h.extendSelectionsBy(function(p){return Xc(h,p.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(h){return h.extendSelectionsBy(function(p){return q0(h,p.head)},{origin:"+move",bias:1})},goLineEnd:function(h){return h.extendSelectionsBy(function(p){return gc(h,p.head.line)},{origin:"+move",bias:-1})},goLineRight:function(h){return h.extendSelectionsBy(function(p){var x=h.cursorCoords(p.head,"div").top+5;return h.coordsChar({left:h.display.lineDiv.offsetWidth+100,top:x},"div")},Ue)},goLineLeft:function(h){return h.extendSelectionsBy(function(p){var x=h.cursorCoords(p.head,"div").top+5;return h.coordsChar({left:0,top:x},"div")},Ue)},goLineLeftSmart:function(h){return h.extendSelectionsBy(function(p){var x=h.cursorCoords(p.head,"div").top+5,y=h.coordsChar({left:0,top:x},"div");return y.ch<h.getLine(y.line).search(/\S/)?q0(h,p.head):y},Ue)},goLineUp:function(h){return h.moveV(-1,"line")},goLineDown:function(h){return h.moveV(1,"line")},goPageUp:function(h){return h.moveV(-1,"page")},goPageDown:function(h){return h.moveV(1,"page")},goCharLeft:function(h){return h.moveH(-1,"char")},goCharRight:function(h){return h.moveH(1,"char")},goColumnLeft:function(h){return h.moveH(-1,"column")},goColumnRight:function(h){return h.moveH(1,"column")},goWordLeft:function(h){return h.moveH(-1,"word")},goGroupRight:function(h){return h.moveH(1,"group")},goGroupLeft:function(h){return h.moveH(-1,"group")},goWordRight:function(h){return h.moveH(1,"word")},delCharBefore:function(h){return h.deleteH(-1,"codepoint")},delCharAfter:function(h){return h.deleteH(1,"char")},delWordBefore:function(h){return h.deleteH(-1,"word")},delWordAfter:function(h){return h.deleteH(1,"word")},delGroupBefore:function(h){return h.deleteH(-1,"group")},delGroupAfter:function(h){return h.deleteH(1,"group")},indentAuto:function(h){return h.indentSelection("smart")},indentMore:function(h){return h.indentSelection("add")},indentLess:function(h){return h.indentSelection("subtract")},insertTab:function(h){return h.replaceSelection(" ")},insertSoftTab:function(h){for(var p=[],x=h.listSelections(),y=h.options.tabSize,S=0;S<x.length;S++){var _=x[S].from(),O=dt(h.getLine(_.line),_.ch,y);p.push(Ai(y-O%y))}h.replaceSelections(p)},defaultTab:function(h){h.somethingSelected()?h.indentSelection("add"):h.execCommand("insertTab")},transposeChars:function(h){return yr(h,function(){for(var p=h.listSelections(),x=[],y=0;y<p.length;y++)if(p[y].empty()){var S=p[y].head,_=xt(h.doc,S.line).text;if(_){if(S.ch==_.length&&(S=new Tt(S.line,S.ch-1)),S.ch>0)S=new Tt(S.line,S.ch+1),h.replaceRange(_.charAt(S.ch-1)+_.charAt(S.ch-2),Tt(S.line,S.ch-2),S,"+transpose");else if(S.line>h.doc.first){var O=xt(h.doc,S.line-1).text;O&&(S=new Tt(S.line,1),h.replaceRange(_.charAt(0)+h.doc.lineSeparator()+O.charAt(O.length-1),Tt(S.line-1,O.length-1),S,"+transpose"))}}x.push(new Qr(S,S))}h.setSelections(x)})},newlineAndIndent:function(h){return yr(h,function(){for(var p=h.listSelections(),x=p.length-1;x>=0;x--)h.replaceRange(h.doc.lineSeparator(),p[x].anchor,p[x].head,"+input");p=h.listSelections();for(var y=0;y<p.length;y++)h.indentLine(p[y].from().line,null,!0);Ku(h)})},openLine:function(h){return h.replaceSelection(`
`,"start")},toggleOverwrite:function(h){return h.toggleOverwrite()}};function Xc(h,p){var x=xt(h.doc,p),y=Ji(x);return y!=x&&(p=lt(y)),Bh(!0,h,y,p,1)}function gc(h,p){var x=xt(h.doc,p),y=Fn(x);return y!=x&&(p=lt(y)),Bh(!0,h,x,p,-1)}function q0(h,p){var x=Xc(h,p.line),y=xt(h.doc,x.line),S=Ci(y,h.doc.direction);if(!S||S[0].level==0){var _=Math.max(x.ch,y.text.search(/\S/)),O=p.line==x.line&&p.ch<=_&&p.ch;return Tt(x.line,O?0:_,x.sticky)}return x}function Ls(h,p,x){if(typeof p=="string"&&(p=Fh[p],!p))return!1;h.display.input.ensurePolled();var y=h.display.shift,S=!1;try{h.isReadOnly()&&(h.state.suppressEdits=!0),x&&(h.display.shift=!1),S=p(h)!=Me}finally{h.display.shift=y,h.state.suppressEdits=!1}return S}function ou(h,p,x){for(var y=0;y<h.state.keyMaps.length;y++){var S=Xa(p,h.state.keyMaps[y],x,h);if(S)return S}return h.options.extraKeys&&Xa(p,h.options.extraKeys,x,h)||Xa(p,h.options.keyMap,x,h)}var ih=new W;function vc(h,p,x,y){var S=h.state.keySeq;if(S){if(Ih(p))return"handled";if(/\'$/.test(p)?h.state.keySeq=null:ih.set(50,function(){h.state.keySeq==S&&(h.state.keySeq=null,h.display.input.reset())}),Od(h,S+" "+p,x,y))return!0}return Od(h,p,x,y)}function Od(h,p,x,y){var S=ou(h,p,y);return S=="multi"&&(h.state.keySeq=p),S=="handled"&&ai(h,"keyHandled",h,p,x),(S=="handled"||S=="multi")&&(hn(x),Yr(h)),!!S}function Dr(h,p){var x=Gc(p,!0);return x?p.shiftKey&&!h.state.keySeq?vc(h,"Shift-"+x,p,function(y){return Ls(h,y,!0)})||vc(h,x,p,function(y){if(typeof y=="string"?/^go[A-Z]/.test(y):y.motion)return Ls(h,y)}):vc(h,x,p,function(y){return Ls(h,y)}):!1}function Rh(h,p,x){return vc(h,"'"+x+"'",p,function(y){return Ls(h,y,!0)})}var Kl=null;function Bd(h){var p=this;if(!(h.target&&h.target!=p.display.input.getField())&&(p.curOp.focus=Nt(),!we(p,h))){ut&&ft<11&&h.keyCode==27&&(h.returnValue=!1);var x=h.keyCode;p.display.shift=x==16||h.shiftKey;var y=Dr(p,h);yt&&(Kl=y?x:null,!y&&x==88&&!ur&&(Ht?h.metaKey:h.ctrlKey)&&p.replaceSelection("",null,"cut")),Mt&&!Ht&&!y&&x==46&&h.shiftKey&&!h.ctrlKey&&document.execCommand&&document.execCommand("cut"),x==18&&!/\bCodeMirror-crosshair\b/.test(p.display.lineDiv.className)&&oi(p)}}function oi(h){var p=h.display.lineDiv;_e(p,"CodeMirror-crosshair");function x(y){(y.keyCode==18||!y.altKey)&&(Et(p,"CodeMirror-crosshair"),Ft(document,"keyup",x),Ft(document,"mouseover",x))}ei(document,"keyup",x),ei(document,"mouseover",x)}function Q0(h){h.keyCode==16&&(this.doc.sel.shift=!1),we(this,h)}function Cu(h){var p=this;if(!(h.target&&h.target!=p.display.input.getField())&&!(Rs(p.display,h)||we(p,h)||h.ctrlKey&&!h.altKey||Ht&&h.metaKey)){var x=h.keyCode,y=h.charCode;if(yt&&x==Kl){Kl=null,hn(h);return}if(!(yt&&(!h.which||h.which<10)&&Dr(p,h))){var S=String.fromCharCode(y==null?x:y);S!="\b"&&(Rh(p,h,S)||p.display.input.onKeyPress(h))}}}var Hp=400,tm=function(h,p,x){this.time=h,this.pos=p,this.button=x};tm.prototype.compare=function(h,p,x){return this.time+Hp>h&&ce(p,this.pos)==0&&x==this.button};var nh,Yc;function em(h,p){var x=+new Date;return Yc&&Yc.compare(x,h,p)?(nh=Yc=null,"triple"):nh&&nh.compare(x,h,p)?(Yc=new tm(x,h,p),nh=null,"double"):(nh=new tm(x,h,p),Yc=null,"single")}function Yo(h){var p=this,x=p.display;if(!(we(p,h)||x.activeTouch&&x.input.supportsTouch())){if(x.input.ensurePolled(),x.shift=h.shiftKey,Rs(x,h)){Pt||(x.scroller.draggable=!1,setTimeout(function(){return x.scroller.draggable=!0},100));return}if(!Ca(p,h)){var y=Cs(p,h),S=rn(h),_=y?em(y,S):"single";window.focus(),S==1&&p.state.selectingText&&p.state.selectingText(h),!(y&&rh(p,S,y,_,h))&&(S==1?y?Vf(p,y,_,h):On(h)==x.scroller&&hn(h):S==2?(y&&Vc(p.doc,y),setTimeout(function(){return x.input.focus()},20)):S==3&&(Ct?p.display.input.onContextMenu(h):Bo(p)))}}}function rh(h,p,x,y,S){var _="Click";return y=="double"?_="Double"+_:y=="triple"&&(_="Triple"+_),_=(p==1?"Left":p==2?"Middle":"Right")+_,vc(h,Oh(_,S),S,function(O){if(typeof O=="string"&&(O=Fh[O]),!O)return!1;var V=!1;try{h.isReadOnly()&&(h.state.suppressEdits=!0),V=O(h,x)!=Me}finally{h.state.suppressEdits=!1}return V})}function Jc(h,p,x){var y=h.getOption("configureMouse"),S=y?y(h,p,x):{};if(S.unit==null){var _=de?x.shiftKey&&x.metaKey:x.altKey;S.unit=_?"rectangle":p=="single"?"char":p=="double"?"word":"line"}return(S.extend==null||h.doc.extend)&&(S.extend=h.doc.extend||x.shiftKey),S.addNew==null&&(S.addNew=Ht?x.metaKey:x.ctrlKey),S.moveOnDrag==null&&(S.moveOnDrag=!(Ht?x.altKey:x.ctrlKey)),S}function Vf(h,p,x,y){ut?setTimeout(Be(Jr,h),0):h.curOp.focus=Nt();var S=Jc(h,x,y),_=h.doc.sel,O;h.options.dragDrop&&ir&&!h.isReadOnly()&&x=="single"&&(O=_.contains(p))>-1&&(ce((O=_.ranges[O]).from(),p)<0||p.xRel>0)&&(ce(O.to(),p)>0||p.xRel<0)?im(h,y,p,S):rm(h,y,p,S)}function im(h,p,x,y){var S=h.display,_=!1,O=ks(h,function(et){Pt&&(S.scroller.draggable=!1),h.state.draggingText=!1,Ft(S.wrapper.ownerDocument,"mouseup",O),Ft(S.wrapper.ownerDocument,"mousemove",V),Ft(S.scroller,"dragstart",K),Ft(S.scroller,"drop",O),_||(hn(et),y.addNew||Vc(h.doc,x,null,null,y.extend),Pt&&!be||ut&&ft==9?setTimeout(function(){S.wrapper.ownerDocument.body.focus({preventScroll:!0}),S.input.focus()},20):S.input.focus())}),V=function(et){_=_||Math.abs(p.clientX-et.clientX)+Math.abs(p.clientY-et.clientY)>=10},K=function(){return _=!0};Pt&&(S.scroller.draggable=!0),h.state.draggingText=O,O.copy=!y.moveOnDrag,S.scroller.dragDrop&&S.scroller.dragDrop(),ei(S.wrapper.ownerDocument,"mouseup",O),ei(S.wrapper.ownerDocument,"mousemove",V),ei(S.scroller,"dragstart",K),ei(S.scroller,"drop",O),Bo(h),setTimeout(function(){return S.input.focus()},20)}function nm(h,p,x){if(x=="char")return new Qr(p,p);if(x=="word")return h.findWordAt(p);if(x=="line")return new Qr(Tt(p.line,0),Re(h.doc,Tt(p.line+1,0)));var y=x(h,p);return new Qr(y.from,y.to)}function rm(h,p,x,y){var S=h.display,_=h.doc;hn(p);var O,V,K=_.sel,et=K.ranges;if(y.addNew&&!y.extend?(V=_.sel.contains(x),V>-1?O=et[V]:O=new Qr(x,x)):(O=_.sel.primary(),V=_.sel.primIndex),y.unit=="rectangle")y.addNew||(O=new Qr(x,x)),x=Cs(h,p,!0,!0),V=-1;else{var Lt=nm(h,x,y.unit);y.extend?O=Bf(O,Lt.anchor,Lt.head,y.extend):O=Lt}y.addNew?V==-1?(V=et.length,Is(_,Rl(h,et.concat([O]),V),{scroll:!1,origin:"*mouse"})):et.length>1&&et[V].empty()&&y.unit=="char"&&!y.extend?(Is(_,Rl(h,et.slice(0,V).concat(et.slice(V+1)),0),{scroll:!1,origin:"*mouse"}),K=_.sel):ba(_,V,O,se):(V=0,Is(_,new El([O],0),se),K=_.sel);var at=x;function ie(qi){if(ce(at,qi)!=0)if(at=qi,y.unit=="rectangle"){for(var dn=[],Dn=h.options.tabSize,en=dt(xt(_,x.line).text,x.ch,Dn),lr=dt(xt(_,qi.line).text,qi.ch,Dn),To=Math.min(en,lr),Ws=Math.max(en,lr),qo=Math.min(x.line,qi.line),za=Math.min(h.lastLine(),Math.max(x.line,qi.line));qo<=za;qo++){var ka=xt(_,qo).text,Os=Fi(ka,To,Dn);To==Ws?dn.push(new Qr(Tt(qo,Os),Tt(qo,Os))):ka.length>Os&&dn.push(new Qr(Tt(qo,Os),Tt(qo,Fi(ka,Ws,Dn))))}dn.length||dn.push(new Qr(x,x)),Is(_,Rl(h,K.ranges.slice(0,V).concat(dn),V),{origin:"*mouse",scroll:!1}),h.scrollIntoView(qi)}else{var dl=O,rr=nm(h,qi,y.unit),gs=dl.anchor,Br;ce(rr.anchor,gs)>0?(Br=rr.head,gs=Pe(dl.from(),rr.anchor)):(Br=rr.anchor,gs=Mi(dl.to(),rr.head));var ss=K.ranges.slice(0);ss[V]=om(h,new Qr(Re(_,gs),Br)),Is(_,Rl(h,ss,V),se)}}var Yt=S.wrapper.getBoundingClientRect(),Ge=0;function si(qi){var dn=++Ge,Dn=Cs(h,qi,!0,y.unit=="rectangle");if(Dn)if(ce(Dn,at)!=0){h.curOp.focus=Nt(),ie(Dn);var en=Vn(S,_);(Dn.line>=en.to||Dn.line<en.from)&&setTimeout(ks(h,function(){Ge==dn&&si(qi)}),150)}else{var lr=qi.clientY<Yt.top?-20:qi.clientY>Yt.bottom?20:0;lr&&setTimeout(ks(h,function(){Ge==dn&&(S.scroller.scrollTop+=lr,si(qi))}),50)}}function yi(qi){h.state.selectingText=!1,Ge=1/0,qi&&(hn(qi),S.input.focus()),Ft(S.wrapper.ownerDocument,"mousemove",Vi),Ft(S.wrapper.ownerDocument,"mouseup",un),_.history.lastSelOrigin=null}var Vi=ks(h,function(qi){qi.buttons===0||!rn(qi)?yi(qi):si(qi)}),un=ks(h,yi);h.state.selectingText=un,ei(S.wrapper.ownerDocument,"mousemove",Vi),ei(S.wrapper.ownerDocument,"mouseup",un)}function om(h,p){var x=p.anchor,y=p.head,S=xt(h.doc,x.line);if(ce(x,y)==0&&x.sticky==y.sticky)return p;var _=Ci(S);if(!_)return p;var O=Si(_,x.ch,x.sticky),V=_[O];if(V.from!=x.ch&&V.to!=x.ch)return p;var K=O+(V.from==x.ch==(V.level!=1)?0:1);if(K==0||K==_.length)return p;var et;if(y.line!=x.line)et=(y.line-x.line)*(h.doc.direction=="ltr"?1:-1)>0;else{var Lt=Si(_,y.ch,y.sticky),at=Lt-O||(y.ch-x.ch)*(V.level==1?-1:1);Lt==K-1||Lt==K?et=at<0:et=at>0}var ie=_[K+(et?-1:0)],Yt=et==(ie.level==1),Ge=Yt?ie.from:ie.to,si=Yt?"after":"before";return x.ch==Ge&&x.sticky==si?p:new Qr(new Tt(x.line,Ge,si),y)}function qc(h,p,x,y){var S,_;if(p.touches)S=p.touches[0].clientX,_=p.touches[0].clientY;else try{S=p.clientX,_=p.clientY}catch(ie){return!1}if(S>=Math.floor(h.display.gutters.getBoundingClientRect().right))return!1;y&&hn(p);var O=h.display,V=O.lineDiv.getBoundingClientRect();if(_>V.bottom||!Pi(h,x))return Ln(p);_-=V.top-O.viewOffset;for(var K=0;K<h.display.gutterSpecs.length;++K){var et=O.gutters.childNodes[K];if(et&&et.getBoundingClientRect().right>=S){var Lt=Qt(h.doc,_),at=h.display.gutterSpecs[K];return oe(h,x,h,Lt,at.className,p),Ln(p)}}}function Ca(h,p){return qc(h,p,"gutterClick",!0)}function oh(h,p){Rs(h.display,p)||sm(h,p)||we(h,p,"contextmenu")||Ct||h.display.input.onContextMenu(p)}function sm(h,p){return Pi(h,"gutterContextMenu")?qc(h,p,"gutterContextMenu",!1):!1}function Wf(h){h.display.wrapper.className=h.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+h.options.theme.replace(/(^|\s)\s*/g," cm-s-"),_o(h)}var sh={toString:function(){return"CodeMirror.Init"}},am={},Uf={};function wg(h){var p=h.optionHandlers;function x(y,S,_,O){h.defaults[y]=S,_&&(p[y]=O?function(V,K,et){et!=sh&&_(V,K,et)}:_)}h.defineOption=x,h.Init=sh,x("value","",function(y,S){return y.setValue(S)},!0),x("mode",null,function(y,S){y.doc.modeOption=S,ar(y)},!0),x("indentUnit",2,ar,!0),x("indentWithTabs",!1),x("smartIndent",!0),x("tabSize",4,function(y){zc(y),_o(y),mo(y)},!0),x("lineSeparator",null,function(y,S){if(y.doc.lineSep=S,!!S){var _=[],O=y.doc.first;y.doc.iter(function(K){for(var et=0;;){var Lt=K.text.indexOf(S,et);if(Lt==-1)break;et=Lt+S.length,_.push(Tt(O,Lt))}O++});for(var V=_.length-1;V>=0;V--)Uc(y.doc,S,_[V],Tt(_[V].line,_[V].ch+S.length))}}),x("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(y,S,_){y.state.specialChars=new RegExp(S.source+(S.test(" ")?"":"| "),"g"),_!=sh&&y.refresh()}),x("specialCharPlaceholder",Lo,function(y){return y.refresh()},!0),x("electricChars",!0),x("inputStyle",Jt?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),x("spellcheck",!1,function(y,S){return y.getInputField().spellcheck=S},!0),x("autocorrect",!1,function(y,S){return y.getInputField().autocorrect=S},!0),x("autocapitalize",!1,function(y,S){return y.getInputField().autocapitalize=S},!0),x("rtlMoveVisually",!De),x("wholeLineUpdateBefore",!0),x("theme","default",function(y){Wf(y),hl(y)},!0),x("keyMap","default",function(y,S,_){var O=ua(S),V=_!=sh&&ua(_);V&&V.detach&&V.detach(y,O),O.attach&&O.attach(y,V||null)}),x("extraKeys",null),x("configureMouse",null),x("lineWrapping",!1,lm,!0),x("gutters",[],function(y,S){y.display.gutterSpecs=Ks(S,y.options.lineNumbers),hl(y)},!0),x("fixedGutter",!0,function(y,S){y.display.gutters.style.left=S?fo(y.display)+"px":"0",y.refresh()},!0),x("coverGutterNextToScrollbar",!1,function(y){return Uu(y)},!0),x("scrollbarStyle","native",function(y){Bp(y),Uu(y),y.display.scrollbars.setScrollTop(y.doc.scrollTop),y.display.scrollbars.setScrollLeft(y.doc.scrollLeft)},!0),x("lineNumbers",!1,function(y,S){y.display.gutterSpecs=Ks(y.options.gutters,S),hl(y)},!0),x("firstLineNumber",1,hl,!0),x("lineNumberFormatter",function(y){return y},hl,!0),x("showCursorWhenSelecting",!1,As,!0),x("resetSelectionOnContextMenu",!0),x("lineWiseCopyCut",!0),x("pasteLinesPerSelection",!0),x("selectionsMayTouch",!1),x("readOnly",!1,function(y,S){S=="nocursor"&&(ic(y),y.display.input.blur()),y.display.input.readOnlyChanged(S)}),x("screenReaderLabel",null,function(y,S){S=S===""?null:S,y.display.input.screenReaderLabelChanged(S)}),x("disableInput",!1,function(y,S){S||y.display.input.reset()},!0),x("dragDrop",!0,Vp),x("allowDropFileTypes",null),x("cursorBlinkRate",530),x("cursorScrollMargin",0),x("cursorHeight",1,As,!0),x("singleCursorHeightPerLine",!0,As,!0),x("workTime",100),x("workDelay",100),x("flattenSpans",!0,zc,!0),x("addModeClass",!1,zc,!0),x("pollInterval",100),x("undoDepth",200,function(y,S){return y.doc.history.undoDepth=S}),x("historyEventDelay",1250),x("viewportMargin",10,function(y){return y.refresh()},!0),x("maxHighlightLength",1e4,zc,!0),x("moveInputWithCursor",!0,function(y,S){S||y.display.input.resetPosition()}),x("tabindex",null,function(y,S){return y.display.input.getField().tabIndex=S||""}),x("autofocus",null),x("direction","ltr",function(y,S){return y.doc.setDirection(S)},!0),x("phrases",null)}function Vp(h,p,x){var y=x&&x!=sh;if(!p!=!y){var S=h.display.dragFunctions,_=p?ei:Ft;_(h.display.scroller,"dragstart",S.start),_(h.display.scroller,"dragenter",S.enter),_(h.display.scroller,"dragover",S.over),_(h.display.scroller,"dragleave",S.leave),_(h.display.scroller,"drop",S.drop)}}function lm(h){h.options.lineWrapping?(_e(h.display.wrapper,"CodeMirror-wrap"),h.display.sizer.style.minWidth="",h.display.sizerWidth=null):(Et(h.display.wrapper,"CodeMirror-wrap"),br(h)),an(h),mo(h),_o(h),setTimeout(function(){return Uu(h)},100)}function Bn(h,p){var x=this;if(!(this instanceof Bn))return new Bn(h,p);this.options=p=p?Se(p):{},Se(am,p,!1);var y=p.value;typeof y=="string"?y=new os(y,p.mode,null,p.lineSeparator,p.direction):p.mode&&(y.modeOption=p.mode),this.doc=y;var S=new Bn.inputStyles[p.inputStyle](this),_=this.display=new Th(h,y,S,p);_.wrapper.CodeMirror=this,Wf(this),p.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Bp(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new W,keySeq:null,specialChars:null},p.autofocus&&!Jt&&_.input.focus(),ut&&ft<11&&setTimeout(function(){return x.display.input.reset(!0)},20),Fd(this),Ga(),Ch(this),this.curOp.forceUpdate=!0,jc(this,y),p.autofocus&&!Jt||this.hasFocus()?setTimeout(function(){x.hasFocus()&&!x.state.focused&&Tr(x)},20):ic(this);for(var O in Uf)Uf.hasOwnProperty(O)&&Uf[O](this,p[O],sh);rs(this),p.finishInit&&p.finishInit(this);for(var V=0;V<Qc.length;++V)Qc[V](this);Zu(this),Pt&&p.lineWrapping&&getComputedStyle(_.lineDiv).textRendering=="optimizelegibility"&&(_.lineDiv.style.textRendering="auto")}Bn.defaults=am,Bn.optionHandlers=Uf;function Fd(h){var p=h.display;ei(p.scroller,"mousedown",ks(h,Yo)),ut&&ft<11?ei(p.scroller,"dblclick",ks(h,function(K){if(!we(h,K)){var et=Cs(h,K);if(!(!et||Ca(h,K)||Rs(h.display,K))){hn(K);var Lt=h.findWordAt(et);Vc(h.doc,Lt.anchor,Lt.head)}}})):ei(p.scroller,"dblclick",function(K){return we(h,K)||hn(K)}),ei(p.scroller,"contextmenu",function(K){return oh(h,K)}),ei(p.input.getField(),"contextmenu",function(K){p.scroller.contains(K.target)||oh(h,K)});var x,y={end:0};function S(){p.activeTouch&&(x=setTimeout(function(){return p.activeTouch=null},1e3),y=p.activeTouch,y.end=+new Date)}function _(K){if(K.touches.length!=1)return!1;var et=K.touches[0];return et.radiusX<=1&&et.radiusY<=1}function O(K,et){if(et.left==null)return!0;var Lt=et.left-K.left,at=et.top-K.top;return Lt*Lt+at*at>20*20}ei(p.scroller,"touchstart",function(K){if(!we(h,K)&&!_(K)&&!Ca(h,K)){p.input.ensurePolled(),clearTimeout(x);var et=+new Date;p.activeTouch={start:et,moved:!1,prev:et-y.end<=300?y:null},K.touches.length==1&&(p.activeTouch.left=K.touches[0].pageX,p.activeTouch.top=K.touches[0].pageY)}}),ei(p.scroller,"touchmove",function(){p.activeTouch&&(p.activeTouch.moved=!0)}),ei(p.scroller,"touchend",function(K){var et=p.activeTouch;if(et&&!Rs(p,K)&&et.left!=null&&!et.moved&&new Date-et.start<300){var Lt=h.coordsChar(p.activeTouch,"page"),at;!et.prev||O(et,et.prev)?at=new Qr(Lt,Lt):!et.prev.prev||O(et,et.prev.prev)?at=h.findWordAt(Lt):at=new Qr(Tt(Lt.line,0),Re(h.doc,Tt(Lt.line+1,0))),h.setSelection(at.anchor,at.head),h.focus(),hn(K)}S()}),ei(p.scroller,"touchcancel",S),ei(p.scroller,"scroll",function(){p.scroller.clientHeight&&(Hu(h,p.scroller.scrollTop),Vu(h,p.scroller.scrollLeft,!0),oe(h,"scroll",h))}),ei(p.scroller,"mousewheel",function(K){return Hs(h,K)}),ei(p.scroller,"DOMMouseScroll",function(K){return Hs(h,K)}),ei(p.wrapper,"scroll",function(){return p.wrapper.scrollTop=p.wrapper.scrollLeft=0}),p.dragFunctions={enter:function(K){we(h,K)||jn(K)},over:function(K){we(h,K)||($p(h,K),jn(K))},start:function(K){return xg(h,K)},drop:ks(h,Y0),leave:function(K){we(h,K)||Ad(h)}};var V=p.input.getField();ei(V,"keyup",function(K){return Q0.call(h,K)}),ei(V,"keydown",ks(h,Bd)),ei(V,"keypress",ks(h,Cu)),ei(V,"focus",function(K){return Tr(h,K)}),ei(V,"blur",function(K){return ic(h,K)})}var Qc=[];Bn.defineInitHook=function(h){return Qc.push(h)};function Jo(h,p,x,y){var S=h.doc,_;x==null&&(x="add"),x=="smart"&&(S.mode.indent?_=Ie(h,p).state:x="prev");var O=h.options.tabSize,V=xt(S,p),K=dt(V.text,null,O);V.stateAfter&&(V.stateAfter=null);var et=V.text.match(/^\s*/)[0],Lt;if(!y&&!/\S/.test(V.text))Lt=0,x="not";else if(x=="smart"&&(Lt=S.mode.indent(_,V.text.slice(et.length),V.text),Lt==Me||Lt>150)){if(!y)return;x="prev"}x=="prev"?p>S.first?Lt=dt(xt(S,p-1).text,null,O):Lt=0:x=="add"?Lt=K+h.options.indentUnit:x=="subtract"?Lt=K-h.options.indentUnit:typeof x=="number"&&(Lt=K+x),Lt=Math.max(0,Lt);var at="",ie=0;if(h.options.indentWithTabs)for(var Yt=Math.floor(Lt/O);Yt;--Yt)ie+=O,at+=" ";if(ie<Lt&&(at+=Ai(Lt-ie)),at!=et)return Uc(S,at,Tt(p,0),Tt(p,et.length),"+input"),V.stateAfter=null,!0;for(var Ge=0;Ge<S.sel.ranges.length;Ge++){var si=S.sel.ranges[Ge];if(si.head.line==p&&si.head.ch<et.length){var yi=Tt(p,et.length);ba(S,Ge,new Qr(yi,yi));break}}}var Ya=null;function ku(h){Ya=h}function Zf(h,p,x,y,S){var _=h.doc;h.display.shift=!1,y||(y=_.sel);var O=+new Date-200,V=S=="paste"||h.state.pasteIncoming>O,K=Ir(p),et=null;if(V&&y.ranges.length>1)if(Ya&&Ya.text.join(`
`)==p){if(y.ranges.length%Ya.text.length==0){et=[];for(var Lt=0;Lt<Ya.text.length;Lt++)et.push(_.splitLines(Ya.text[Lt]))}}else K.length==y.ranges.length&&h.options.pasteLinesPerSelection&&(et=sn(K,function(Vi){return[Vi]}));for(var at=h.curOp.updateInput,ie=y.ranges.length-1;ie>=0;ie--){var Yt=y.ranges[ie],Ge=Yt.from(),si=Yt.to();Yt.empty()&&(x&&x>0?Ge=Tt(Ge.line,Ge.ch-x):h.state.overwrite&&!V?si=Tt(si.line,Math.min(xt(_,si.line).text.length,si.ch+ri(K).length)):V&&Ya&&Ya.lineWise&&Ya.text.join(`
`)==K.join(`
`)&&(Ge=si=Tt(Ge.line,0)));var yi={from:Ge,to:si,text:et?et[ie%et.length]:K,origin:S||(V?"paste":h.state.cutIncoming>O?"cut":"+input")};qu(h.doc,yi),ai(h,"inputRead",h,yi)}p&&!V&&Up(h,p),Ku(h),h.curOp.updateInput<2&&(h.curOp.updateInput=at),h.curOp.typing=!0,h.state.pasteIncoming=h.state.cutIncoming=-1}function Wp(h,p){var x=h.clipboardData&&h.clipboardData.getData("Text");if(x)return h.preventDefault(),!p.isReadOnly()&&!p.options.disableInput&&yr(p,function(){return Zf(p,x,0,null,"paste")}),!0}function Up(h,p){if(!(!h.options.electricChars||!h.options.smartIndent))for(var x=h.doc.sel,y=x.ranges.length-1;y>=0;y--){var S=x.ranges[y];if(!(S.head.ch>100||y&&x.ranges[y-1].head.line==S.head.line)){var _=h.getModeAt(S.head),O=!1;if(_.electricChars){for(var V=0;V<_.electricChars.length;V++)if(p.indexOf(_.electricChars.charAt(V))>-1){O=Jo(h,S.head.line,"smart");break}}else _.electricInput&&_.electricInput.test(xt(h.doc,S.head.line).text.slice(0,S.head.ch))&&(O=Jo(h,S.head.line,"smart"));O&&ai(h,"electricInput",h,S.head.line)}}}function td(h){for(var p=[],x=[],y=0;y<h.doc.sel.ranges.length;y++){var S=h.doc.sel.ranges[y].head.line,_={anchor:Tt(S,0),head:Tt(S+1,0)};x.push(_),p.push(h.getRange(_.anchor,_.head))}return{text:p,ranges:x}}function um(h,p,x,y){h.setAttribute("autocorrect",x?"":"off"),h.setAttribute("autocapitalize",y?"":"off"),h.setAttribute("spellcheck",!!p)}function Zp(){var h=Vt("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),p=Vt("div",[h],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return Pt?h.style.width="1000px":h.setAttribute("wrap","off"),Ce&&(h.style.border="1px solid black"),um(h),p}function ah(h){var p=h.optionHandlers,x=h.helpers={};h.prototype={constructor:h,focus:function(){window.focus(),this.display.input.focus()},setOption:function(y,S){var _=this.options,O=_[y];_[y]==S&&y!="mode"||(_[y]=S,p.hasOwnProperty(y)&&ks(this,p[y])(this,S,O),oe(this,"optionChange",this,y))},getOption:function(y){return this.options[y]},getDoc:function(){return this.doc},addKeyMap:function(y,S){this.state.keyMaps[S?"push":"unshift"](ua(y))},removeKeyMap:function(y){for(var S=this.state.keyMaps,_=0;_<S.length;++_)if(S[_]==y||S[_].name==y)return S.splice(_,1),!0},addOverlay:Ko(function(y,S){var _=y.token?y:h.getMode(this.options,y);if(_.startState)throw new Error("Overlays may not be stateful.");Zi(this.state.overlays,{mode:_,modeSpec:y,opaque:S&&S.opaque,priority:S&&S.priority||0},function(O){return O.priority}),this.state.modeGen++,mo(this)}),removeOverlay:Ko(function(y){for(var S=this.state.overlays,_=0;_<S.length;++_){var O=S[_].modeSpec;if(O==y||typeof y=="string"&&O.name==y){S.splice(_,1),this.state.modeGen++,mo(this);return}}}),indentLine:Ko(function(y,S,_){typeof S!="string"&&typeof S!="number"&&(S==null?S=this.options.smartIndent?"smart":"prev":S=S?"add":"subtract"),me(this.doc,y)&&Jo(this,y,S,_)}),indentSelection:Ko(function(y){for(var S=this.doc.sel.ranges,_=-1,O=0;O<S.length;O++){var V=S[O];if(V.empty())V.head.line>_&&(Jo(this,V.head.line,y,!0),_=V.head.line,O==this.doc.sel.primIndex&&Ku(this));else{var K=V.from(),et=V.to(),Lt=Math.max(_,K.line);_=Math.min(this.lastLine(),et.line-(et.ch?0:1))+1;for(var at=Lt;at<_;++at)Jo(this,at,y);var ie=this.doc.sel.ranges;K.ch==0&&S.length==ie.length&&ie[O].from().ch>0&&ba(this.doc,O,new Qr(K,ie[O].to()),ye)}}}),getTokenAt:function(y,S){return Ui(this,y,S)},getLineTokens:function(y,S){return Ui(this,Tt(y),S,!0)},getTokenTypeAt:function(y){y=Re(this.doc,y);var S=re(this,xt(this.doc,y.line)),_=0,O=(S.length-1)/2,V=y.ch,K;if(V==0)K=S[2];else for(;;){var et=_+O>>1;if((et?S[et*2-1]:0)>=V)O=et;else if(S[et*2+1]<V)_=et+1;else{K=S[et*2+2];break}}var Lt=K?K.indexOf("overlay "):-1;return Lt<0?K:Lt==0?null:K.slice(0,Lt-1)},getModeAt:function(y){var S=this.doc.mode;return S.innerMode?h.innerMode(S,this.getTokenAt(y).state).mode:S},getHelper:function(y,S){return this.getHelpers(y,S)[0]},getHelpers:function(y,S){var _=[];if(!x.hasOwnProperty(S))return _;var O=x[S],V=this.getModeAt(y);if(typeof V[S]=="string")O[V[S]]&&_.push(O[V[S]]);else if(V[S])for(var K=0;K<V[S].length;K++){var et=O[V[S][K]];et&&_.push(et)}else V.helperType&&O[V.helperType]?_.push(O[V.helperType]):O[V.name]&&_.push(O[V.name]);for(var Lt=0;Lt<O._global.length;Lt++){var at=O._global[Lt];at.pred(V,this)&&Zt(_,at.val)==-1&&_.push(at.val)}return _},getStateAfter:function(y,S){var _=this.doc;return y=qe(_,y==null?_.first+_.size-1:y),Ie(this,y+1,S).state},cursorCoords:function(y,S){var _,O=this.doc.sel.primary();return y==null?_=O.head:typeof y=="object"?_=Re(this.doc,y):_=y?O.from():O.to(),Ur(this,_,S||"page")},charCoords:function(y,S){return Ba(this,Re(this.doc,y),S||"page")},coordsChar:function(y,S){return y=Oa(this,y,S||"page"),ec(this,y.left,y.top)},lineAtHeight:function(y,S){return y=Oa(this,{top:y,left:0},S||"page").top,Qt(this.doc,y+this.display.viewOffset)},heightAtLine:function(y,S,_){var O=!1,V;if(typeof y=="number"){var K=this.doc.first+this.doc.size-1;y<this.doc.first?y=this.doc.first:y>K&&(y=K,O=!0),V=xt(this.doc,y)}else V=y;return ao(this,V,{top:0,left:0},S||"page",_||O).top+(O?this.doc.height-wr(V):0)},defaultTextHeight:function(){return iu(this.display)},defaultCharWidth:function(){return $r(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(y,S,_,O,V){var K=this.display;y=Ur(this,Re(this.doc,y));var et=y.bottom,Lt=y.left;if(S.style.position="absolute",S.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(S),K.sizer.appendChild(S),O=="over")et=y.top;else if(O=="above"||O=="near"){var at=Math.max(K.wrapper.clientHeight,this.doc.height),ie=Math.max(K.sizer.clientWidth,K.lineSpace.clientWidth);(O=="above"||y.bottom+S.offsetHeight>at)&&y.top>S.offsetHeight?et=y.top-S.offsetHeight:y.bottom+S.offsetHeight<=at&&(et=y.bottom),Lt+S.offsetWidth>ie&&(Lt=ie-S.offsetWidth)}S.style.top=et+"px",S.style.left=S.style.right="",V=="right"?(Lt=K.sizer.clientWidth-S.offsetWidth,S.style.right="0px"):(V=="left"?Lt=0:V=="middle"&&(Lt=(K.sizer.clientWidth-S.offsetWidth)/2),S.style.left=Lt+"px"),_&&Ld(this,{left:Lt,top:et,right:Lt+S.offsetWidth,bottom:et+S.offsetHeight})},triggerOnKeyDown:Ko(Bd),triggerOnKeyPress:Ko(Cu),triggerOnKeyUp:Q0,triggerOnMouseDown:Ko(Yo),execCommand:function(y){if(Fh.hasOwnProperty(y))return Fh[y].call(null,this)},triggerElectric:Ko(function(y){Up(this,y)}),findPosH:function(y,S,_,O){var V=1;S<0&&(V=-1,S=-S);for(var K=Re(this.doc,y),et=0;et<S&&(K=Rd(this.doc,K,V,_,O),!K.hitSide);++et);return K},moveH:Ko(function(y,S){var _=this;this.extendSelectionsBy(function(O){return _.display.shift||_.doc.extend||O.empty()?Rd(_.doc,O.head,y,S,_.options.rtlMoveVisually):y<0?O.from():O.to()},Ue)}),deleteH:Ko(function(y,S){var _=this.doc.sel,O=this.doc;_.somethingSelected()?O.replaceSelection("",null,"+delete"):Vs(this,function(V){var K=Rd(O,V.head,y,S,!1);return y<0?{from:K,to:V.head}:{from:V.head,to:K}})}),findPosV:function(y,S,_,O){var V=1,K=O;S<0&&(V=-1,S=-S);for(var et=Re(this.doc,y),Lt=0;Lt<S;++Lt){var at=Ur(this,et,"div");if(K==null?K=at.left:at.left=K,et=yc(this,at,V,_),et.hitSide)break}return et},moveV:Ko(function(y,S){var _=this,O=this.doc,V=[],K=!this.display.shift&&!O.extend&&O.sel.somethingSelected();if(O.extendSelectionsBy(function(Lt){if(K)return y<0?Lt.from():Lt.to();var at=Ur(_,Lt.head,"div");Lt.goalColumn!=null&&(at.left=Lt.goalColumn),V.push(at.left);var ie=yc(_,at,y,S);return S=="page"&&Lt==O.sel.primary()&&Tf(_,Ba(_,ie,"div").top-at.top),ie},Ue),V.length)for(var et=0;et<O.sel.ranges.length;et++)O.sel.ranges[et].goalColumn=V[et]}),findWordAt:function(y){var S=this.doc,_=xt(S,y.line).text,O=y.ch,V=y.ch;if(_){var K=this.getHelper(y,"wordChars");(y.sticky=="before"||V==_.length)&&O?--O:++V;for(var et=_.charAt(O),Lt=U(et,K)?function(at){return U(at,K)}:/\s/.test(et)?function(at){return/\s/.test(at)}:function(at){return!/\s/.test(at)&&!U(at)};O>0&&Lt(_.charAt(O-1));)--O;for(;V<_.length&&Lt(_.charAt(V));)++V}return new Qr(Tt(y.line,O),Tt(y.line,V))},toggleOverwrite:function(y){y!=null&&y==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?_e(this.display.cursorDiv,"CodeMirror-overwrite"):Et(this.display.cursorDiv,"CodeMirror-overwrite"),oe(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==Nt()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Ko(function(y,S){Mh(this,y,S)}),getScrollInfo:function(){var y=this.display.scroller;return{left:y.scrollLeft,top:y.scrollTop,height:y.scrollHeight-fs(this)-this.display.barHeight,width:y.scrollWidth-fs(this)-this.display.barWidth,clientHeight:ll(this),clientWidth:jo(this)}},scrollIntoView:Ko(function(y,S){y==null?(y={from:this.doc.sel.primary().head,to:null},S==null&&(S=this.options.cursorScrollMargin)):typeof y=="number"?y={from:Tt(y,0),to:null}:y.from==null&&(y={from:y,to:null}),y.to||(y.to=y.from),y.margin=S||0,y.from.line!=null?Pr(this,y):Pf(this,y.from,y.to,y.margin)}),setSize:Ko(function(y,S){var _=this,O=function(K){return typeof K=="number"||/^\d+$/.test(String(K))?K+"px":K};y!=null&&(this.display.wrapper.style.width=O(y)),S!=null&&(this.display.wrapper.style.height=O(S)),this.options.lineWrapping&&Ms(this);var V=this.display.viewFrom;this.doc.iter(V,this.display.viewTo,function(K){if(K.widgets){for(var et=0;et<K.widgets.length;et++)if(K.widgets[et].noHScroll){er(_,V,"widget");break}}++V}),this.curOp.forceUpdate=!0,oe(this,"refresh",this)}),operation:function(y){return yr(this,y)},startOperation:function(){return Ch(this)},endOperation:function(){return Zu(this)},refresh:Ko(function(){var y=this.display.cachedTextHeight;mo(this),this.curOp.forceUpdate=!0,_o(this),Mh(this,this.doc.scrollLeft,this.doc.scrollTop),Eh(this.display),(y==null||Math.abs(y-iu(this.display))>.5||this.options.lineWrapping)&&an(this),oe(this,"refresh",this)}),swapDoc:Ko(function(y){var S=this.doc;return S.cm=null,this.state.selectingText&&this.state.selectingText(),jc(this,y),_o(this),this.display.input.reset(),Mh(this,y.scrollLeft,y.scrollTop),this.curOp.forceScroll=!0,ai(this,"swapDoc",this,S),S}),phrase:function(y){var S=this.options.phrases;return S&&Object.prototype.hasOwnProperty.call(S,y)?S[y]:y},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},_i(h),h.registerHelper=function(y,S,_){x.hasOwnProperty(y)||(x[y]=h[y]={_global:[]}),x[y][S]=_},h.registerGlobalHelper=function(y,S,_,O){h.registerHelper(y,S,O),x[y]._global.push({pred:_,val:O})}}function Rd(h,p,x,y,S){var _=p,O=x,V=xt(h,p.line),K=S&&h.direction=="rtl"?-x:x;function et(){var un=p.line+K;return un<h.first||un>=h.first+h.size?!1:(p=new Tt(un,p.ch,p.sticky),V=xt(h,un))}function Lt(un){var qi;if(y=="codepoint"){var dn=V.text.charCodeAt(p.ch+(y>0?0:-1));isNaN(dn)?qi=null:qi=new Tt(p.line,Math.max(0,Math.min(V.text.length,p.ch+x*(dn>=55296&&dn<56320?2:1))),-x)}else S?qi=$l(h.cm,V,p,x):qi=bo(V,p,x);if(qi==null)if(!un&&et())p=Bh(S,h.cm,V,p.line,K);else return!1;else p=qi;return!0}if(y=="char"||y=="codepoint")Lt();else if(y=="column")Lt(!0);else if(y=="word"||y=="group")for(var at=null,ie=y=="group",Yt=h.cm&&h.cm.getHelper(p,"wordChars"),Ge=!0;!(x<0&&!Lt(!Ge));Ge=!1){var si=V.text.charAt(p.ch)||`
`,yi=U(si,Yt)?"w":ie&&si==`
`?"n":!ie||/\s/.test(si)?null:"p";if(ie&&!Ge&&!yi&&(yi="s"),at&&at!=yi){x<0&&(x=1,Lt(),p.sticky="after");break}if(yi&&(at=yi),x>0&&!Lt(!Ge))break}var Vi=Rf(h,p,_,O,!0);return bi(_,Vi)&&(Vi.hitSide=!0),Vi}function yc(h,p,x,y){var S=h.doc,_=p.left,O;if(y=="page"){var V=Math.min(h.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),K=Math.max(V-.5*iu(h.display),3);O=(x>0?p.bottom:p.top)+x*K}else y=="line"&&(O=x>0?p.bottom+3:p.top-3);for(var et;et=ec(h,_,O),!!et.outside;){if(x<0?O<=0:O>=S.height){et.hitSide=!0;break}O+=x*5}return et}var go=function(h){this.cm=h,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new W,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};go.prototype.init=function(h){var p=this,x=this,y=x.cm,S=x.div=h.lineDiv;um(S,y.options.spellcheck,y.options.autocorrect,y.options.autocapitalize);function _(V){for(var K=V.target;K;K=K.parentNode){if(K==S)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(K.className))break}return!1}ei(S,"paste",function(V){!_(V)||we(y,V)||Wp(V,y)||ft<=11&&setTimeout(ks(y,function(){return p.updateFromDOM()}),20)}),ei(S,"compositionstart",function(V){p.composing={data:V.data,done:!1}}),ei(S,"compositionupdate",function(V){p.composing||(p.composing={data:V.data,done:!1})}),ei(S,"compositionend",function(V){p.composing&&(V.data!=p.composing.data&&p.readFromDOMSoon(),p.composing.done=!0)}),ei(S,"touchstart",function(){return x.forceCompositionEnd()}),ei(S,"input",function(){p.composing||p.readFromDOMSoon()});function O(V){if(!(!_(V)||we(y,V))){if(y.somethingSelected())ku({lineWise:!1,text:y.getSelections()}),V.type=="cut"&&y.replaceSelection("",null,"cut");else if(y.options.lineWiseCopyCut){var K=td(y);ku({lineWise:!0,text:K.text}),V.type=="cut"&&y.operation(function(){y.setSelections(K.ranges,0,ye),y.replaceSelection("",null,"cut")})}else return;if(V.clipboardData){V.clipboardData.clearData();var et=Ya.text.join(`
`);if(V.clipboardData.setData("Text",et),V.clipboardData.getData("Text")==et){V.preventDefault();return}}var Lt=Zp(),at=Lt.firstChild;y.display.lineSpace.insertBefore(Lt,y.display.lineSpace.firstChild),at.value=Ya.text.join(`
`);var ie=document.activeElement;je(at),setTimeout(function(){y.display.lineSpace.removeChild(Lt),ie.focus(),ie==S&&x.showPrimarySelection()},50)}}ei(S,"copy",O),ei(S,"cut",O)},go.prototype.screenReaderLabelChanged=function(h){h?this.div.setAttribute("aria-label",h):this.div.removeAttribute("aria-label")},go.prototype.prepareSelection=function(){var h=Sh(this.cm,!1);return h.focus=document.activeElement==this.div,h},go.prototype.showSelection=function(h,p){!h||!this.cm.display.view.length||((h.focus||p)&&this.showPrimarySelection(),this.showMultipleSelections(h))},go.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},go.prototype.showPrimarySelection=function(){var h=this.getSelection(),p=this.cm,x=p.doc.sel.primary(),y=x.from(),S=x.to();if(p.display.viewTo==p.display.viewFrom||y.line>=p.display.viewTo||S.line<p.display.viewFrom){h.removeAllRanges();return}var _=Gf(p,h.anchorNode,h.anchorOffset),O=Gf(p,h.focusNode,h.focusOffset);if(!(_&&!_.bad&&O&&!O.bad&&ce(Pe(_,O),y)==0&&ce(Mi(_,O),S)==0)){var V=p.display.view,K=y.line>=p.display.viewFrom&&Gp(p,y)||{node:V[0].measure.map[2],offset:0},et=S.line<p.display.viewTo&&Gp(p,S);if(!et){var Lt=V[V.length-1].measure,at=Lt.maps?Lt.maps[Lt.maps.length-1]:Lt.map;et={node:at[at.length-1],offset:at[at.length-2]-at[at.length-3]}}if(!K||!et){h.removeAllRanges();return}var ie=h.rangeCount&&h.getRangeAt(0),Yt;try{Yt=ee(K.node,K.offset,et.offset,et.node)}catch(Ge){}Yt&&(!Mt&&p.state.focused?(h.collapse(K.node,K.offset),Yt.collapsed||(h.removeAllRanges(),h.addRange(Yt))):(h.removeAllRanges(),h.addRange(Yt)),ie&&h.anchorNode==null?h.addRange(ie):Mt&&this.startGracePeriod()),this.rememberSelection()}},go.prototype.startGracePeriod=function(){var h=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){h.gracePeriod=!1,h.selectionChanged()&&h.cm.operation(function(){return h.cm.curOp.selectionChanged=!0})},20)},go.prototype.showMultipleSelections=function(h){ve(this.cm.display.cursorDiv,h.cursors),ve(this.cm.display.selectionDiv,h.selection)},go.prototype.rememberSelection=function(){var h=this.getSelection();this.lastAnchorNode=h.anchorNode,this.lastAnchorOffset=h.anchorOffset,this.lastFocusNode=h.focusNode,this.lastFocusOffset=h.focusOffset},go.prototype.selectionInEditor=function(){var h=this.getSelection();if(!h.rangeCount)return!1;var p=h.getRangeAt(0).commonAncestorContainer;return xe(this.div,p)},go.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},go.prototype.blur=function(){this.div.blur()},go.prototype.getField=function(){return this.div},go.prototype.supportsTouch=function(){return!0},go.prototype.receivedFocus=function(){var h=this;this.selectionInEditor()?this.pollSelection():yr(this.cm,function(){return h.cm.curOp.selectionChanged=!0});function p(){h.cm.state.focused&&(h.pollSelection(),h.polling.set(h.cm.options.pollInterval,p))}this.polling.set(this.cm.options.pollInterval,p)},go.prototype.selectionChanged=function(){var h=this.getSelection();return h.anchorNode!=this.lastAnchorNode||h.anchorOffset!=this.lastAnchorOffset||h.focusNode!=this.lastFocusNode||h.focusOffset!=this.lastFocusOffset},go.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var h=this.getSelection(),p=this.cm;if(jt&&rt&&this.cm.display.gutterSpecs.length&&hm(h.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var x=Gf(p,h.anchorNode,h.anchorOffset),y=Gf(p,h.focusNode,h.focusOffset);x&&y&&yr(p,function(){Is(p.doc,nu(x,y),ye),(x.bad||y.bad)&&(p.curOp.selectionChanged=!0)})}}},go.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var h=this.cm,p=h.display,x=h.doc.sel.primary(),y=x.from(),S=x.to();if(y.ch==0&&y.line>h.firstLine()&&(y=Tt(y.line-1,xt(h.doc,y.line-1).length)),S.ch==xt(h.doc,S.line).text.length&&S.line<h.lastLine()&&(S=Tt(S.line+1,0)),y.line<p.viewFrom||S.line>p.viewTo-1)return!1;var _,O,V;y.line==p.viewFrom||(_=js(h,y.line))==0?(O=lt(p.view[0].line),V=p.view[0].node):(O=lt(p.view[_].line),V=p.view[_-1].node.nextSibling);var K=js(h,S.line),et,Lt;if(K==p.view.length-1?(et=p.viewTo-1,Lt=p.lineDiv.lastChild):(et=lt(p.view[K+1].line)-1,Lt=p.view[K+1].node.previousSibling),!V)return!1;for(var at=h.doc.splitLines(jd(h,V,Lt,O,et)),ie=Ot(h.doc,Tt(O,0),Tt(et,xt(h.doc,et).text.length));at.length>1&&ie.length>1;)if(ri(at)==ri(ie))at.pop(),ie.pop(),et--;else if(at[0]==ie[0])at.shift(),ie.shift(),O++;else break;for(var Yt=0,Ge=0,si=at[0],yi=ie[0],Vi=Math.min(si.length,yi.length);Yt<Vi&&si.charCodeAt(Yt)==yi.charCodeAt(Yt);)++Yt;for(var un=ri(at),qi=ri(ie),dn=Math.min(un.length-(at.length==1?Yt:0),qi.length-(ie.length==1?Yt:0));Ge<dn&&un.charCodeAt(un.length-Ge-1)==qi.charCodeAt(qi.length-Ge-1);)++Ge;if(at.length==1&&ie.length==1&&O==y.line)for(;Yt&&Yt>y.ch&&un.charCodeAt(un.length-Ge-1)==qi.charCodeAt(qi.length-Ge-1);)Yt--,Ge++;at[at.length-1]=un.slice(0,un.length-Ge).replace(/^\u200b+/,""),at[0]=at[0].slice(Yt).replace(/\u200b+$/,"");var Dn=Tt(O,Yt),en=Tt(et,ie.length?ri(ie).length-Ge:0);if(at.length>1||at[0]||ce(Dn,en))return Uc(h.doc,at,Dn,en,"+input"),!0},go.prototype.ensurePolled=function(){this.forceCompositionEnd()},go.prototype.reset=function(){this.forceCompositionEnd()},go.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},go.prototype.readFromDOMSoon=function(){var h=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(h.readDOMTimeout=null,h.composing)if(h.composing.done)h.composing=null;else return;h.updateFromDOM()},80))},go.prototype.updateFromDOM=function(){var h=this;(this.cm.isReadOnly()||!this.pollContent())&&yr(this.cm,function(){return mo(h.cm)})},go.prototype.setUneditable=function(h){h.contentEditable="false"},go.prototype.onKeyPress=function(h){h.charCode==0||this.composing||(h.preventDefault(),this.cm.isReadOnly()||ks(this.cm,Zf)(this.cm,String.fromCharCode(h.charCode==null?h.keyCode:h.charCode),0))},go.prototype.readOnlyChanged=function(h){this.div.contentEditable=String(h!="nocursor")},go.prototype.onContextMenu=function(){},go.prototype.resetPosition=function(){},go.prototype.needsContentAttribute=!0;function Gp(h,p){var x=aa(h,p.line);if(!x||x.hidden)return null;var y=xt(h.doc,p.line),S=Cl(x,y,p.line),_=Ci(y,h.doc.direction),O="left";if(_){var V=Si(_,p.ch);O=V%2?"right":"left"}var K=xu(S.map,p.ch,O);return K.offset=K.collapse=="right"?K.end:K.start,K}function hm(h){for(var p=h;p;p=p.parentNode)if(/CodeMirror-gutter-wrapper/.test(p.className))return!0;return!1}function zd(h,p){return p&&(h.bad=!0),h}function jd(h,p,x,y,S){var _="",O=!1,V=h.doc.lineSeparator(),K=!1;function et(Yt){return function(Ge){return Ge.id==Yt}}function Lt(){O&&(_+=V,K&&(_+=V),O=K=!1)}function at(Yt){Yt&&(Lt(),_+=Yt)}function ie(Yt){if(Yt.nodeType==1){var Ge=Yt.getAttribute("cm-text");if(Ge){at(Ge);return}var si=Yt.getAttribute("cm-marker"),yi;if(si){var Vi=h.findMarks(Tt(y,0),Tt(S+1,0),et(+si));Vi.length&&(yi=Vi[0].find(0))&&at(Ot(h.doc,yi.from,yi.to).join(V));return}if(Yt.getAttribute("contenteditable")=="false")return;var un=/^(pre|div|p|li|table|br)$/i.test(Yt.nodeName);if(!/^br$/i.test(Yt.nodeName)&&Yt.textContent.length==0)return;un&&Lt();for(var qi=0;qi<Yt.childNodes.length;qi++)ie(Yt.childNodes[qi]);/^(pre|p)$/i.test(Yt.nodeName)&&(K=!0),un&&(O=!0)}else Yt.nodeType==3&&at(Yt.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;ie(p),p!=x;)p=p.nextSibling,K=!1;return _}function Gf(h,p,x){var y;if(p==h.display.lineDiv){if(y=h.display.lineDiv.childNodes[x],!y)return zd(h.clipPos(Tt(h.display.viewTo-1)),!0);p=null,x=0}else for(y=p;;y=y.parentNode){if(!y||y==h.display.lineDiv)return null;if(y.parentNode&&y.parentNode==h.display.lineDiv)break}for(var S=0;S<h.display.view.length;S++){var _=h.display.view[S];if(_.node==y)return bg(_,p,x)}}function bg(h,p,x){var y=h.text.firstChild,S=!1;if(!p||!xe(y,p))return zd(Tt(lt(h.line),0),!0);if(p==y&&(S=!0,p=y.childNodes[x],x=0,!p)){var _=h.rest?ri(h.rest):h.line;return zd(Tt(lt(_),_.text.length),S)}var O=p.nodeType==3?p:null,V=p;for(!O&&p.childNodes.length==1&&p.firstChild.nodeType==3&&(O=p.firstChild,x&&(x=O.nodeValue.length));V.parentNode!=y;)V=V.parentNode;var K=h.measure,et=K.maps;function Lt(yi,Vi,un){for(var qi=-1;qi<(et?et.length:0);qi++)for(var dn=qi<0?K.map:et[qi],Dn=0;Dn<dn.length;Dn+=3){var en=dn[Dn+2];if(en==yi||en==Vi){var lr=lt(qi<0?h.line:h.rest[qi]),To=dn[Dn]+un;return(un<0||en!=yi)&&(To=dn[Dn+(un?1:0)]),Tt(lr,To)}}}var at=Lt(O,V,x);if(at)return zd(at,S);for(var ie=V.nextSibling,Yt=O?O.nodeValue.length-x:0;ie;ie=ie.nextSibling){if(at=Lt(ie,ie.firstChild,0),at)return zd(Tt(at.line,at.ch-Yt),S);Yt+=ie.textContent.length}for(var Ge=V.previousSibling,si=x;Ge;Ge=Ge.previousSibling){if(at=Lt(Ge,Ge.firstChild,-1),at)return zd(Tt(at.line,at.ch+si),S);si+=Ge.textContent.length}}var Ro=function(h){this.cm=h,this.prevInput="",this.pollingFast=!1,this.polling=new W,this.hasSelection=!1,this.composing=null};Ro.prototype.init=function(h){var p=this,x=this,y=this.cm;this.createField(h);var S=this.textarea;h.wrapper.insertBefore(this.wrapper,h.wrapper.firstChild),Ce&&(S.style.width="0px"),ei(S,"input",function(){ut&&ft>=9&&p.hasSelection&&(p.hasSelection=null),x.poll()}),ei(S,"paste",function(O){we(y,O)||Wp(O,y)||(y.state.pasteIncoming=+new Date,x.fastPoll())});function _(O){if(!we(y,O)){if(y.somethingSelected())ku({lineWise:!1,text:y.getSelections()});else if(y.options.lineWiseCopyCut){var V=td(y);ku({lineWise:!0,text:V.text}),O.type=="cut"?y.setSelections(V.ranges,null,ye):(x.prevInput="",S.value=V.text.join(`
`),je(S))}else return;O.type=="cut"&&(y.state.cutIncoming=+new Date)}}ei(S,"cut",_),ei(S,"copy",_),ei(h.scroller,"paste",function(O){if(!(Rs(h,O)||we(y,O))){if(!S.dispatchEvent){y.state.pasteIncoming=+new Date,x.focus();return}var V=new Event("paste");V.clipboardData=O.clipboardData,S.dispatchEvent(V)}}),ei(h.lineSpace,"selectstart",function(O){Rs(h,O)||hn(O)}),ei(S,"compositionstart",function(){var O=y.getCursor("from");x.composing&&x.composing.range.clear(),x.composing={start:O,range:y.markText(O,y.getCursor("to"),{className:"CodeMirror-composing"})}}),ei(S,"compositionend",function(){x.composing&&(x.poll(),x.composing.range.clear(),x.composing=null)})},Ro.prototype.createField=function(h){this.wrapper=Zp(),this.textarea=this.wrapper.firstChild},Ro.prototype.screenReaderLabelChanged=function(h){h?this.textarea.setAttribute("aria-label",h):this.textarea.removeAttribute("aria-label")},Ro.prototype.prepareSelection=function(){var h=this.cm,p=h.display,x=h.doc,y=Sh(h);if(h.options.moveInputWithCursor){var S=Ur(h,x.sel.primary().head,"div"),_=p.wrapper.getBoundingClientRect(),O=p.lineDiv.getBoundingClientRect();y.teTop=Math.max(0,Math.min(p.wrapper.clientHeight-10,S.top+O.top-_.top)),y.teLeft=Math.max(0,Math.min(p.wrapper.clientWidth-10,S.left+O.left-_.left))}return y},Ro.prototype.showSelection=function(h){var p=this.cm,x=p.display;ve(x.cursorDiv,h.cursors),ve(x.selectionDiv,h.selection),h.teTop!=null&&(this.wrapper.style.top=h.teTop+"px",this.wrapper.style.left=h.teLeft+"px")},Ro.prototype.reset=function(h){if(!(this.contextMenuPending||this.composing)){var p=this.cm;if(p.somethingSelected()){this.prevInput="";var x=p.getSelection();this.textarea.value=x,p.state.focused&&je(this.textarea),ut&&ft>=9&&(this.hasSelection=x)}else h||(this.prevInput=this.textarea.value="",ut&&ft>=9&&(this.hasSelection=null))}},Ro.prototype.getField=function(){return this.textarea},Ro.prototype.supportsTouch=function(){return!1},Ro.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!Jt||Nt()!=this.textarea))try{this.textarea.focus()}catch(h){}},Ro.prototype.blur=function(){this.textarea.blur()},Ro.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ro.prototype.receivedFocus=function(){this.slowPoll()},Ro.prototype.slowPoll=function(){var h=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){h.poll(),h.cm.state.focused&&h.slowPoll()})},Ro.prototype.fastPoll=function(){var h=!1,p=this;p.pollingFast=!0;function x(){var y=p.poll();!y&&!h?(h=!0,p.polling.set(60,x)):(p.pollingFast=!1,p.slowPoll())}p.polling.set(20,x)},Ro.prototype.poll=function(){var h=this,p=this.cm,x=this.textarea,y=this.prevInput;if(this.contextMenuPending||!p.state.focused||T(x)&&!y&&!this.composing||p.isReadOnly()||p.options.disableInput||p.state.keySeq)return!1;var S=x.value;if(S==y&&!p.somethingSelected())return!1;if(ut&&ft>=9&&this.hasSelection===S||Ht&&/[\uf700-\uf7ff]/.test(S))return p.display.input.reset(),!1;if(p.doc.sel==p.display.selForContextMenu){var _=S.charCodeAt(0);if(_==8203&&!y&&(y="\u200B"),_==8666)return this.reset(),this.cm.execCommand("undo")}for(var O=0,V=Math.min(y.length,S.length);O<V&&y.charCodeAt(O)==S.charCodeAt(O);)++O;return yr(p,function(){Zf(p,S.slice(O),y.length-O,null,h.composing?"*compose":null),S.length>1e3||S.indexOf(`
`)>-1?x.value=h.prevInput="":h.prevInput=S,h.composing&&(h.composing.range.clear(),h.composing.range=p.markText(h.composing.start,p.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ro.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ro.prototype.onKeyPress=function(){ut&&ft>=9&&(this.hasSelection=null),this.fastPoll()},Ro.prototype.onContextMenu=function(h){var p=this,x=p.cm,y=x.display,S=p.textarea;p.contextMenuPending&&p.contextMenuPending();var _=Cs(x,h),O=y.scroller.scrollTop;if(!_||yt)return;var V=x.options.resetSelectionOnContextMenu;V&&x.doc.sel.contains(_)==-1&&ks(x,Is)(x.doc,nu(_),ye);var K=S.style.cssText,et=p.wrapper.style.cssText,Lt=p.wrapper.offsetParent.getBoundingClientRect();p.wrapper.style.cssText="position: static",S.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(h.clientY-Lt.top-5)+"px; left: "+(h.clientX-Lt.left-5)+`px;
z-index: 1000; background: `+(ut?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var at;Pt&&(at=window.scrollY),y.input.focus(),Pt&&window.scrollTo(null,at),y.input.reset(),x.somethingSelected()||(S.value=p.prevInput=" "),p.contextMenuPending=Yt,y.selForContextMenu=x.doc.sel,clearTimeout(y.detectingSelectAll);function ie(){if(S.selectionStart!=null){var si=x.somethingSelected(),yi="\u200B"+(si?S.value:"");S.value="\u21DA",S.value=yi,p.prevInput=si?"":"\u200B",S.selectionStart=1,S.selectionEnd=yi.length,y.selForContextMenu=x.doc.sel}}function Yt(){if(p.contextMenuPending==Yt&&(p.contextMenuPending=!1,p.wrapper.style.cssText=et,S.style.cssText=K,ut&&ft<9&&y.scrollbars.setScrollTop(y.scroller.scrollTop=O),S.selectionStart!=null)){(!ut||ut&&ft<9)&&ie();var si=0,yi=function(){y.selForContextMenu==x.doc.sel&&S.selectionStart==0&&S.selectionEnd>0&&p.prevInput=="\u200B"?ks(x,ms)(x):si++<10?y.detectingSelectAll=setTimeout(yi,500):(y.selForContextMenu=null,y.input.reset())};y.detectingSelectAll=setTimeout(yi,200)}}if(ut&&ft>=9&&ie(),Ct){jn(h);var Ge=function(){Ft(window,"mouseup",Ge),setTimeout(Yt,20)};ei(window,"mouseup",Ge)}else setTimeout(Yt,50)},Ro.prototype.readOnlyChanged=function(h){h||this.reset(),this.textarea.disabled=h=="nocursor",this.textarea.readOnly=!!h},Ro.prototype.setUneditable=function(){},Ro.prototype.needsContentAttribute=!1;function xc(h,p){if(p=p?Se(p):{},p.value=h.value,!p.tabindex&&h.tabIndex&&(p.tabindex=h.tabIndex),!p.placeholder&&h.placeholder&&(p.placeholder=h.placeholder),p.autofocus==null){var x=Nt();p.autofocus=x==h||h.getAttribute("autofocus")!=null&&x==document.body}function y(){h.value=V.getValue()}var S;if(h.form&&(ei(h.form,"submit",y),!p.leaveSubmitMethodAlone)){var _=h.form;S=_.submit;try{var O=_.submit=function(){y(),_.submit=S,_.submit(),_.submit=O}}catch(K){}}p.finishInit=function(K){K.save=y,K.getTextArea=function(){return h},K.toTextArea=function(){K.toTextArea=isNaN,y(),h.parentNode.removeChild(K.getWrapperElement()),h.style.display="",h.form&&(Ft(h.form,"submit",y),!p.leaveSubmitMethodAlone&&typeof h.form.submit=="function"&&(h.form.submit=S))}},h.style.display="none";var V=Bn(function(K){return h.parentNode.insertBefore(K,h.nextSibling)},p);return V}function Lu(h){h.off=Ft,h.on=ei,h.wheelEventPixels=Za,h.Doc=os,h.splitLines=Ir,h.countColumn=dt,h.findColumn=Fi,h.isWordChar=B,h.Pass=Me,h.signal=oe,h.Line=po,h.changeEnd=Ph,h.scrollbarModel=Op,h.Pos=Tt,h.cmpPos=ce,h.modes=Nr,h.mimeModes=Gn,h.resolveMode=gr,h.getMode=pn,h.modeExtensions=gi,h.extendMode=ct,h.copyState=J,h.startState=nt,h.innerMode=ot,h.commands=Fh,h.keyMap=to,h.keyName=Gc,h.isModifierKey=Ih,h.lookupKey=Xa,h.normalizeKeyMap=Hf,h.StringStream=Z,h.SharedTextMarker=fr,h.TextMarker=wt,h.LineWidget=th,h.e_preventDefault=hn,h.e_stopPropagation=mn,h.e_stop=jn,h.addClass=_e,h.contains=xe,h.rmClass=Et,h.keyNames=jl}wg(Bn),ah(Bn);var Ra="iter insert remove copy getEditor constructor".split(" ");for(var Hl in os.prototype)os.prototype.hasOwnProperty(Hl)&&Zt(Ra,Hl)<0&&(Bn.prototype[Hl]=function(h){return function(){return h.apply(this.doc,arguments)}}(os.prototype[Hl]));return _i(os),Bn.inputStyles={textarea:Ro,contenteditable:go},Bn.defineMode=function(h){!Bn.defaults.mode&&h!="null"&&(Bn.defaults.mode=h),uo.apply(this,arguments)},Bn.defineMIME=zo,Bn.defineMode("null",function(){return{token:function(h){return h.skipToEnd()}}}),Bn.defineMIME("text/plain","null"),Bn.defineExtension=function(h,p){Bn.prototype[h]=p},Bn.defineDocExtension=function(h,p){os.prototype[h]=p},Bn.fromTextArea=xc,Lu(Bn),Bn.version="5.58.2",Bn})},25419:function(qn,Li,G){(function(Mt){Mt(G(89780),G(15525),G(98101))})(function(Mt){"use strict";Mt.defineMode("markdown",function(kt,vt){var le=Mt.getMode(kt,"text/html"),ut=le.name=="null";function ft(dt){if(Mt.findModeByName){var W=Mt.findModeByName(dt);W&&(dt=W.mime||W.mimes[0])}var Zt=Mt.getMode(kt,dt);return Zt.name=="null"?null:Zt}vt.highlightFormatting===void 0&&(vt.highlightFormatting=!1),vt.maxBlockquoteDepth===void 0&&(vt.maxBlockquoteDepth=0),vt.taskLists===void 0&&(vt.taskLists=!1),vt.strikethrough===void 0&&(vt.strikethrough=!1),vt.emoji===void 0&&(vt.emoji=!1),vt.fencedCodeBlockHighlighting===void 0&&(vt.fencedCodeBlockHighlighting=!0),vt.fencedCodeBlockDefaultMode===void 0&&(vt.fencedCodeBlockDefaultMode="text/plain"),vt.xml===void 0&&(vt.xml=!0),vt.tokenTypeOverrides===void 0&&(vt.tokenTypeOverrides={});var Pt={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var Q in Pt)Pt.hasOwnProperty(Q)&&vt.tokenTypeOverrides[Q]&&(Pt[Q]=vt.tokenTypeOverrides[Q]);var rt=/^([*\-_])(?:\s*\1){2,}\s*$/,yt=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,be=/^\[(x| )\](?=\s)/i,pt=vt.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,Rt=/^ {0,3}(?:\={1,}|-{2,})\s*$/,Ce=/^[^#!\[\]*_\\<>` "'(~:]+/,jt=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,Jt=/^\s*\[[^\]]+?\]:.*$/,Ht=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,de=" ";function De(dt,W,Zt){return W.f=W.inline=Zt,Zt(dt,W)}function $t(dt,W,Zt){return W.f=W.block=Zt,Zt(dt,W)}function Xt(dt){return!dt||!/\S/.test(dt.string)}function Ct(dt){if(dt.linkTitle=!1,dt.linkHref=!1,dt.linkText=!1,dt.em=!1,dt.strong=!1,dt.strikethrough=!1,dt.quote=0,dt.indentedCode=!1,dt.f==Et){var W=ut;if(!W){var Zt=Mt.innerMode(le,dt.htmlState);W=Zt.mode.name=="xml"&&Zt.state.tagStart===null&&!Zt.state.context&&Zt.state.tokenize.isInText}W&&(dt.f=We,dt.block=q,dt.htmlState=null)}return dt.trailingSpace=0,dt.trailingSpaceNewLine=!1,dt.prevLine=dt.thisLine,dt.thisLine={stream:null},null}function q(dt,W){var Zt=dt.column()===W.indentation,ze=Xt(W.prevLine.stream),Me=W.indentedCode,ye=W.prevLine.hr,se=W.list!==!1,Ue=(W.listStack[W.listStack.length-1]||0)+3;W.indentedCode=!1;var Fi=W.indentation;if(W.indentationDiff===null&&(W.indentationDiff=W.indentation,se)){for(W.list=null;Fi<W.listStack[W.listStack.length-1];)W.listStack.pop(),W.listStack.length?W.indentation=W.listStack[W.listStack.length-1]:W.list=!1;W.list!==!1&&(W.indentationDiff=Fi-W.listStack[W.listStack.length-1])}var wi=!ze&&!ye&&!W.prevLine.header&&(!se||!Me)&&!W.prevLine.fencedCodeEnd,Ai=(W.list===!1||ye||ze)&&W.indentation<=Ue&&dt.match(rt),ri=null;if(W.indentationDiff>=4&&(Me||W.prevLine.fencedCodeEnd||W.prevLine.header||ze))return dt.skipToEnd(),W.indentedCode=!0,Pt.code;if(dt.eatSpace())return null;if(Zt&&W.indentation<=Ue&&(ri=dt.match(pt))&&ri[1].length<=6)return W.quote=0,W.header=ri[1].length,W.thisLine.header=!0,vt.highlightFormatting&&(W.formatting="header"),W.f=W.inline,ve(W);if(W.indentation<=Ue&&dt.eat(">"))return W.quote=Zt?1:W.quote+1,vt.highlightFormatting&&(W.formatting="quote"),dt.eatSpace(),ve(W);if(!Ai&&!W.setext&&Zt&&W.indentation<=Ue&&(ri=dt.match(yt))){var sn=ri[1]?"ol":"ul";return W.indentation=Fi+dt.current().length,W.list=!0,W.quote=0,W.listStack.push(W.indentation),W.em=!1,W.strong=!1,W.code=!1,W.strikethrough=!1,vt.taskLists&&dt.match(be,!1)&&(W.taskList=!0),W.f=W.inline,vt.highlightFormatting&&(W.formatting=["list","list-"+sn]),ve(W)}else{if(Zt&&W.indentation<=Ue&&(ri=dt.match(jt,!0)))return W.quote=0,W.fencedEndRE=new RegExp(ri[1]+"+ *$"),W.localMode=vt.fencedCodeBlockHighlighting&&ft(ri[2]||vt.fencedCodeBlockDefaultMode),W.localMode&&(W.localState=Mt.startState(W.localMode)),W.f=W.block=Bt,vt.highlightFormatting&&(W.formatting="code-block"),W.code=-1,ve(W);if(W.setext||(!wi||!se)&&!W.quote&&W.list===!1&&!W.code&&!Ai&&!Jt.test(dt.string)&&(ri=dt.lookAhead(1))&&(ri=ri.match(Rt)))return W.setext?(W.header=W.setext,W.setext=0,dt.skipToEnd(),vt.highlightFormatting&&(W.formatting="header")):(W.header=ri[0].charAt(0)=="="?1:2,W.setext=W.header),W.thisLine.header=!0,W.f=W.inline,ve(W);if(Ai)return dt.skipToEnd(),W.hr=!0,W.thisLine.hr=!0,Pt.hr;if(dt.peek()==="[")return De(dt,W,ti)}return De(dt,W,W.inline)}function Et(dt,W){var Zt=le.token(dt,W.htmlState);if(!ut){var ze=Mt.innerMode(le,W.htmlState);(ze.mode.name=="xml"&&ze.state.tagStart===null&&!ze.state.context&&ze.state.tokenize.isInText||W.md_inside&&dt.current().indexOf(">")>-1)&&(W.f=We,W.block=q,W.htmlState=null)}return Zt}function Bt(dt,W){var Zt=W.listStack[W.listStack.length-1]||0,ze=W.indentation<Zt,Me=Zt+3;if(W.fencedEndRE&&W.indentation<=Me&&(ze||dt.match(W.fencedEndRE))){vt.highlightFormatting&&(W.formatting="code-block");var ye;return ze||(ye=ve(W)),W.localMode=W.localState=null,W.block=q,W.f=We,W.fencedEndRE=null,W.code=0,W.thisLine.fencedCodeEnd=!0,ze?$t(dt,W,W.block):ye}else return W.localMode?W.localMode.token(dt,W.localState):(dt.skipToEnd(),Pt.code)}function ve(dt){var W=[];if(dt.formatting){W.push(Pt.formatting),typeof dt.formatting=="string"&&(dt.formatting=[dt.formatting]);for(var Zt=0;Zt<dt.formatting.length;Zt++)W.push(Pt.formatting+"-"+dt.formatting[Zt]),dt.formatting[Zt]==="header"&&W.push(Pt.formatting+"-"+dt.formatting[Zt]+"-"+dt.header),dt.formatting[Zt]==="quote"&&(!vt.maxBlockquoteDepth||vt.maxBlockquoteDepth>=dt.quote?W.push(Pt.formatting+"-"+dt.formatting[Zt]+"-"+dt.quote):W.push("error"))}if(dt.taskOpen)return W.push("meta"),W.length?W.join(" "):null;if(dt.taskClosed)return W.push("property"),W.length?W.join(" "):null;if(dt.linkHref?W.push(Pt.linkHref,"url"):(dt.strong&&W.push(Pt.strong),dt.em&&W.push(Pt.em),dt.strikethrough&&W.push(Pt.strikethrough),dt.emoji&&W.push(Pt.emoji),dt.linkText&&W.push(Pt.linkText),dt.code&&W.push(Pt.code),dt.image&&W.push(Pt.image),dt.imageAltText&&W.push(Pt.imageAltText,"link"),dt.imageMarker&&W.push(Pt.imageMarker)),dt.header&&W.push(Pt.header,Pt.header+"-"+dt.header),dt.quote&&(W.push(Pt.quote),!vt.maxBlockquoteDepth||vt.maxBlockquoteDepth>=dt.quote?W.push(Pt.quote+"-"+dt.quote):W.push(Pt.quote+"-"+vt.maxBlockquoteDepth)),dt.list!==!1){var ze=(dt.listStack.length-1)%3;ze?ze===1?W.push(Pt.list2):W.push(Pt.list3):W.push(Pt.list1)}return dt.trailingSpaceNewLine?W.push("trailing-space-new-line"):dt.trailingSpace&&W.push("trailing-space-"+(dt.trailingSpace%2?"a":"b")),W.length?W.join(" "):null}function Vt(dt,W){if(dt.match(Ce,!0))return ve(W)}function We(dt,W){var Zt=W.text(dt,W);if(typeof Zt!="undefined")return Zt;if(W.list)return W.list=null,ve(W);if(W.taskList){var ze=dt.match(be,!0)[1]===" ";return ze?W.taskOpen=!0:W.taskClosed=!0,vt.highlightFormatting&&(W.formatting="task"),W.taskList=!1,ve(W)}if(W.taskOpen=!1,W.taskClosed=!1,W.header&&dt.match(/^#+$/,!0))return vt.highlightFormatting&&(W.formatting="header"),ve(W);var Me=dt.next();if(W.linkTitle){W.linkTitle=!1;var ye=Me;Me==="("&&(ye=")"),ye=(ye+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var se="^\\s*(?:[^"+ye+"\\\\]+|\\\\\\\\|\\\\.)"+ye;if(dt.match(new RegExp(se),!0))return Pt.linkHref}if(Me==="`"){var Ue=W.formatting;vt.highlightFormatting&&(W.formatting="code"),dt.eatWhile("`");var Fi=dt.current().length;if(W.code==0&&(!W.quote||Fi==1))return W.code=Fi,ve(W);if(Fi==W.code){var wi=ve(W);return W.code=0,wi}else return W.formatting=Ue,ve(W)}else if(W.code)return ve(W);if(Me==="\\"&&(dt.next(),vt.highlightFormatting)){var Ai=ve(W),ri=Pt.formatting+"-escape";return Ai?Ai+" "+ri:ri}if(Me==="!"&&dt.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return W.imageMarker=!0,W.image=!0,vt.highlightFormatting&&(W.formatting="image"),ve(W);if(Me==="["&&W.imageMarker&&dt.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return W.imageMarker=!1,W.imageAltText=!0,vt.highlightFormatting&&(W.formatting="image"),ve(W);if(Me==="]"&&W.imageAltText){vt.highlightFormatting&&(W.formatting="image");var Ai=ve(W);return W.imageAltText=!1,W.image=!1,W.inline=W.f=xe,Ai}if(Me==="["&&!W.image)return W.linkText&&dt.match(/^.*?\]/)||(W.linkText=!0,vt.highlightFormatting&&(W.formatting="link")),ve(W);if(Me==="]"&&W.linkText){vt.highlightFormatting&&(W.formatting="link");var Ai=ve(W);return W.linkText=!1,W.inline=W.f=dt.match(/\(.*?\)| ?\[.*?\]/,!1)?xe:We,Ai}if(Me==="<"&&dt.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=ee,vt.highlightFormatting&&(W.formatting="link");var Ai=ve(W);return Ai?Ai+=" ":Ai="",Ai+Pt.linkInline}if(Me==="<"&&dt.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=ee,vt.highlightFormatting&&(W.formatting="link");var Ai=ve(W);return Ai?Ai+=" ":Ai="",Ai+Pt.linkEmail}if(vt.xml&&Me==="<"&&dt.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var sn=dt.string.indexOf(">",dt.pos);if(sn!=-1){var Zi=dt.string.substring(dt.start,sn);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Zi)&&(W.md_inside=!0)}return dt.backUp(1),W.htmlState=Mt.startState(le),$t(dt,W,Et)}if(vt.xml&&Me==="<"&&dt.match(/^\/\w*?>/))return W.md_inside=!1,"tag";if(Me==="*"||Me==="_"){for(var j=1,P=dt.pos==1?" ":dt.string.charAt(dt.pos-2);j<3&&dt.eat(Me);)j++;var E=dt.peek()||" ",B=!/\s/.test(E)&&(!Ht.test(E)||/\s/.test(P)||Ht.test(P)),U=!/\s/.test(P)&&(!Ht.test(P)||/\s/.test(E)||Ht.test(E)),D=null,St=null;if(j%2&&(!W.em&&B&&(Me==="*"||!U||Ht.test(P))?D=!0:W.em==Me&&U&&(Me==="*"||!B||Ht.test(E))&&(D=!1)),j>1&&(!W.strong&&B&&(Me==="*"||!U||Ht.test(P))?St=!0:W.strong==Me&&U&&(Me==="*"||!B||Ht.test(E))&&(St=!1)),St!=null||D!=null){vt.highlightFormatting&&(W.formatting=D==null?"strong":St==null?"em":"strong em"),D===!0&&(W.em=Me),St===!0&&(W.strong=Me);var wi=ve(W);return D===!1&&(W.em=!1),St===!1&&(W.strong=!1),wi}}else if(Me===" "&&(dt.eat("*")||dt.eat("_"))){if(dt.peek()===" ")return ve(W);dt.backUp(1)}if(vt.strikethrough){if(Me==="~"&&dt.eatWhile(Me)){if(W.strikethrough){vt.highlightFormatting&&(W.formatting="strikethrough");var wi=ve(W);return W.strikethrough=!1,wi}else if(dt.match(/^[^\s]/,!1))return W.strikethrough=!0,vt.highlightFormatting&&(W.formatting="strikethrough"),ve(W)}else if(Me===" "&&dt.match(/^~~/,!0)){if(dt.peek()===" ")return ve(W);dt.backUp(2)}}if(vt.emoji&&Me===":"&&dt.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){W.emoji=!0,vt.highlightFormatting&&(W.formatting="emoji");var ae=ve(W);return W.emoji=!1,ae}return Me===" "&&(dt.match(/^ +$/,!1)?W.trailingSpace++:W.trailingSpace&&(W.trailingSpaceNewLine=!0)),ve(W)}function ee(dt,W){var Zt=dt.next();if(Zt===">"){W.f=W.inline=We,vt.highlightFormatting&&(W.formatting="link");var ze=ve(W);return ze?ze+=" ":ze="",ze+Pt.linkInline}return dt.match(/^[^>]+/,!0),Pt.linkInline}function xe(dt,W){if(dt.eatSpace())return null;var Zt=dt.next();return Zt==="("||Zt==="["?(W.f=W.inline=_e(Zt==="("?")":"]"),vt.highlightFormatting&&(W.formatting="link-string"),W.linkHref=!0,ve(W)):"error"}var Nt={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function _e(dt){return function(W,Zt){var ze=W.next();if(ze===dt){Zt.f=Zt.inline=We,vt.highlightFormatting&&(Zt.formatting="link-string");var Me=ve(Zt);return Zt.linkHref=!1,Me}return W.match(Nt[dt]),Zt.linkHref=!0,ve(Zt)}}function ti(dt,W){return dt.match(/^([^\]\\]|\\.)*\]:/,!1)?(W.f=je,dt.next(),vt.highlightFormatting&&(W.formatting="link"),W.linkText=!0,ve(W)):De(dt,W,We)}function je(dt,W){if(dt.match(/^\]:/,!0)){W.f=W.inline=Be,vt.highlightFormatting&&(W.formatting="link");var Zt=ve(W);return W.linkText=!1,Zt}return dt.match(/^([^\]\\]|\\.)+/,!0),Pt.linkText}function Be(dt,W){return dt.eatSpace()?null:(dt.match(/^[^\s]+/,!0),dt.peek()===void 0?W.linkTitle=!0:dt.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),W.f=W.inline=We,Pt.linkHref+" url")}var Se={startState:function(){return{f:q,prevLine:{stream:null},thisLine:{stream:null},block:q,htmlState:null,indentation:0,inline:We,text:Vt,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(dt){return{f:dt.f,prevLine:dt.prevLine,thisLine:dt.thisLine,block:dt.block,htmlState:dt.htmlState&&Mt.copyState(le,dt.htmlState),indentation:dt.indentation,localMode:dt.localMode,localState:dt.localMode?Mt.copyState(dt.localMode,dt.localState):null,inline:dt.inline,text:dt.text,formatting:!1,linkText:dt.linkText,linkTitle:dt.linkTitle,linkHref:dt.linkHref,code:dt.code,em:dt.em,strong:dt.strong,strikethrough:dt.strikethrough,emoji:dt.emoji,header:dt.header,setext:dt.setext,hr:dt.hr,taskList:dt.taskList,list:dt.list,listStack:dt.listStack.slice(0),quote:dt.quote,indentedCode:dt.indentedCode,trailingSpace:dt.trailingSpace,trailingSpaceNewLine:dt.trailingSpaceNewLine,md_inside:dt.md_inside,fencedEndRE:dt.fencedEndRE}},token:function(dt,W){if(W.formatting=!1,dt!=W.thisLine.stream){if(W.header=0,W.hr=!1,dt.match(/^\s*$/,!0))return Ct(W),null;if(W.prevLine=W.thisLine,W.thisLine={stream:dt},W.taskList=!1,W.trailingSpace=0,W.trailingSpaceNewLine=!1,!W.localState&&(W.f=W.block,W.f!=Et)){var Zt=dt.match(/^\s*/,!0)[0].replace(/\t/g,de).length;if(W.indentation=Zt,W.indentationDiff=null,Zt>0)return null}}return W.f(dt,W)},innerMode:function(dt){return dt.block==Et?{state:dt.htmlState,mode:le}:dt.localState?{state:dt.localState,mode:dt.localMode}:{state:dt,mode:Se}},indent:function(dt,W,Zt){return dt.block==Et&&le.indent?le.indent(dt.htmlState,W,Zt):dt.localState&&dt.localMode.indent?dt.localMode.indent(dt.localState,W,Zt):Mt.Pass},blankLine:Ct,getType:ve,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Se},"xml"),Mt.defineMIME("text/markdown","markdown"),Mt.defineMIME("text/x-markdown","markdown")})},98101:function(qn,Li,G){(function(Mt){Mt(G(89780))})(function(Mt){"use strict";Mt.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var kt=0;kt<Mt.modeInfo.length;kt++){var vt=Mt.modeInfo[kt];vt.mimes&&(vt.mime=vt.mimes[0])}Mt.findModeByMIME=function(le){le=le.toLowerCase();for(var ut=0;ut<Mt.modeInfo.length;ut++){var ft=Mt.modeInfo[ut];if(ft.mime==le)return ft;if(ft.mimes){for(var Pt=0;Pt<ft.mimes.length;Pt++)if(ft.mimes[Pt]==le)return ft}}if(/\+xml$/.test(le))return Mt.findModeByMIME("application/xml");if(/\+json$/.test(le))return Mt.findModeByMIME("application/json")},Mt.findModeByExtension=function(le){le=le.toLowerCase();for(var ut=0;ut<Mt.modeInfo.length;ut++){var ft=Mt.modeInfo[ut];if(ft.ext){for(var Pt=0;Pt<ft.ext.length;Pt++)if(ft.ext[Pt]==le)return ft}}},Mt.findModeByFileName=function(le){for(var ut=0;ut<Mt.modeInfo.length;ut++){var ft=Mt.modeInfo[ut];if(ft.file&&ft.file.test(le))return ft}var Pt=le.lastIndexOf("."),Q=Pt>-1&&le.substring(Pt+1,le.length);if(Q)return Mt.findModeByExtension(Q)},Mt.findModeByName=function(le){le=le.toLowerCase();for(var ut=0;ut<Mt.modeInfo.length;ut++){var ft=Mt.modeInfo[ut];if(ft.name.toLowerCase()==le)return ft;if(ft.alias){for(var Pt=0;Pt<ft.alias.length;Pt++)if(ft.alias[Pt].toLowerCase()==le)return ft}}}})},67549:function(qn,Li,G){(function(Mt){Mt(G(89780))})(function(Mt){"use strict";Mt.defineMode("stex",function(kt,vt){"use strict";function le(Ce,jt){Ce.cmdState.push(jt)}function ut(Ce){return Ce.cmdState.length>0?Ce.cmdState[Ce.cmdState.length-1]:null}function ft(Ce){var jt=Ce.cmdState.pop();jt&&jt.closeBracket()}function Pt(Ce){for(var jt=Ce.cmdState,Jt=jt.length-1;Jt>=0;Jt--){var Ht=jt[Jt];if(Ht.name!="DEFAULT")return Ht}return{styleIdentifier:function(){return null}}}function Q(Ce,jt,Jt){return function(){this.name=Ce,this.bracketNo=0,this.style=jt,this.styles=Jt,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var rt={};rt.importmodule=Q("importmodule","tag",["string","builtin"]),rt.documentclass=Q("documentclass","tag",["","atom"]),rt.usepackage=Q("usepackage","tag",["atom"]),rt.begin=Q("begin","tag",["atom"]),rt.end=Q("end","tag",["atom"]),rt.label=Q("label","tag",["atom"]),rt.ref=Q("ref","tag",["atom"]),rt.eqref=Q("eqref","tag",["atom"]),rt.cite=Q("cite","tag",["atom"]),rt.bibitem=Q("bibitem","tag",["atom"]),rt.Bibitem=Q("Bibitem","tag",["atom"]),rt.RBibitem=Q("RBibitem","tag",["atom"]),rt.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function yt(Ce,jt){Ce.f=jt}function be(Ce,jt){var Jt;if(Ce.match(/^\\[a-zA-Z@]+/)){var Ht=Ce.current().slice(1);return Jt=rt.hasOwnProperty(Ht)?rt[Ht]:rt.DEFAULT,Jt=new Jt,le(jt,Jt),yt(jt,Rt),Jt.style}if(Ce.match(/^\\[$&%#{}_]/)||Ce.match(/^\\[,;!\/\\]/))return"tag";if(Ce.match("\\["))return yt(jt,function(De,$t){return pt(De,$t,"\\]")}),"keyword";if(Ce.match("\\("))return yt(jt,function(De,$t){return pt(De,$t,"\\)")}),"keyword";if(Ce.match("$$"))return yt(jt,function(De,$t){return pt(De,$t,"$$")}),"keyword";if(Ce.match("$"))return yt(jt,function(De,$t){return pt(De,$t,"$")}),"keyword";var de=Ce.next();if(de=="%")return Ce.skipToEnd(),"comment";if(de=="}"||de=="]"){if(Jt=ut(jt),Jt)Jt.closeBracket(de),yt(jt,Rt);else return"error";return"bracket"}else return de=="{"||de=="["?(Jt=rt.DEFAULT,Jt=new Jt,le(jt,Jt),"bracket"):/\d/.test(de)?(Ce.eatWhile(/[\w.%]/),"atom"):(Ce.eatWhile(/[\w\-_]/),Jt=Pt(jt),Jt.name=="begin"&&(Jt.argument=Ce.current()),Jt.styleIdentifier())}function pt(Ce,jt,Jt){if(Ce.eatSpace())return null;if(Jt&&Ce.match(Jt))return yt(jt,be),"keyword";if(Ce.match(/^\\[a-zA-Z@]+/))return"tag";if(Ce.match(/^[a-zA-Z]+/))return"variable-2";if(Ce.match(/^\\[$&%#{}_]/)||Ce.match(/^\\[,;!\/]/)||Ce.match(/^[\^_&]/))return"tag";if(Ce.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(Ce.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var Ht=Ce.next();return Ht=="{"||Ht=="}"||Ht=="["||Ht=="]"||Ht=="("||Ht==")"?"bracket":Ht=="%"?(Ce.skipToEnd(),"comment"):"error"}function Rt(Ce,jt){var Jt=Ce.peek(),Ht;return Jt=="{"||Jt=="["?(Ht=ut(jt),Ht.openBracket(Jt),Ce.eat(Jt),yt(jt,be),"bracket"):/[ \t\r]/.test(Jt)?(Ce.eat(Jt),null):(yt(jt,be),ft(jt),be(Ce,jt))}return{startState:function(){var Ce=vt.inMathMode?function(jt,Jt){return pt(jt,Jt)}:be;return{cmdState:[],f:Ce}},copyState:function(Ce){return{cmdState:Ce.cmdState.slice(),f:Ce.f}},token:function(Ce,jt){return jt.f(Ce,jt)},blankLine:function(Ce){Ce.f=be,Ce.cmdState.length=0},lineComment:"%"}}),Mt.defineMIME("text/x-stex","stex"),Mt.defineMIME("text/x-latex","stex")})},15525:function(qn,Li,G){(function(Mt){Mt(G(89780))})(function(Mt){"use strict";var kt={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},vt={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};Mt.defineMode("xml",function(le,ut){var ft=le.indentUnit,Pt={},Q=ut.htmlMode?kt:vt;for(var rt in Q)Pt[rt]=Q[rt];for(var rt in ut)Pt[rt]=ut[rt];var yt,be;function pt(ee,xe){function Nt(je){return xe.tokenize=je,je(ee,xe)}var _e=ee.next();if(_e=="<")return ee.eat("!")?ee.eat("[")?ee.match("CDATA[")?Nt(jt("atom","]]>")):null:ee.match("--")?Nt(jt("comment","-->")):ee.match("DOCTYPE",!0,!0)?(ee.eatWhile(/[\w\._\-]/),Nt(Jt(1))):null:ee.eat("?")?(ee.eatWhile(/[\w\._\-]/),xe.tokenize=jt("meta","?>"),"meta"):(yt=ee.eat("/")?"closeTag":"openTag",xe.tokenize=Rt,"tag bracket");if(_e=="&"){var ti;return ee.eat("#")?ee.eat("x")?ti=ee.eatWhile(/[a-fA-F\d]/)&&ee.eat(";"):ti=ee.eatWhile(/[\d]/)&&ee.eat(";"):ti=ee.eatWhile(/[\w\.\-:]/)&&ee.eat(";"),ti?"atom":"error"}else return ee.eatWhile(/[^&<]/),null}pt.isInText=!0;function Rt(ee,xe){var Nt=ee.next();if(Nt==">"||Nt=="/"&&ee.eat(">"))return xe.tokenize=pt,yt=Nt==">"?"endTag":"selfcloseTag","tag bracket";if(Nt=="=")return yt="equals",null;if(Nt=="<"){xe.tokenize=pt,xe.state=$t,xe.tagName=xe.tagStart=null;var _e=xe.tokenize(ee,xe);return _e?_e+" tag error":"tag error"}else return/[\'\"]/.test(Nt)?(xe.tokenize=Ce(Nt),xe.stringStartCol=ee.column(),xe.tokenize(ee,xe)):(ee.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function Ce(ee){var xe=function(Nt,_e){for(;!Nt.eol();)if(Nt.next()==ee){_e.tokenize=Rt;break}return"string"};return xe.isInAttribute=!0,xe}function jt(ee,xe){return function(Nt,_e){for(;!Nt.eol();){if(Nt.match(xe)){_e.tokenize=pt;break}Nt.next()}return ee}}function Jt(ee){return function(xe,Nt){for(var _e;(_e=xe.next())!=null;){if(_e=="<")return Nt.tokenize=Jt(ee+1),Nt.tokenize(xe,Nt);if(_e==">")if(ee==1){Nt.tokenize=pt;break}else return Nt.tokenize=Jt(ee-1),Nt.tokenize(xe,Nt)}return"meta"}}function Ht(ee,xe,Nt){this.prev=ee.context,this.tagName=xe,this.indent=ee.indented,this.startOfLine=Nt,(Pt.doNotIndent.hasOwnProperty(xe)||ee.context&&ee.context.noIndent)&&(this.noIndent=!0)}function de(ee){ee.context&&(ee.context=ee.context.prev)}function De(ee,xe){for(var Nt;;){if(!ee.context||(Nt=ee.context.tagName,!Pt.contextGrabbers.hasOwnProperty(Nt)||!Pt.contextGrabbers[Nt].hasOwnProperty(xe)))return;de(ee)}}function $t(ee,xe,Nt){return ee=="openTag"?(Nt.tagStart=xe.column(),Xt):ee=="closeTag"?Ct:$t}function Xt(ee,xe,Nt){return ee=="word"?(Nt.tagName=xe.current(),be="tag",Bt):Pt.allowMissingTagName&&ee=="endTag"?(be="tag bracket",Bt(ee,xe,Nt)):(be="error",Xt)}function Ct(ee,xe,Nt){if(ee=="word"){var _e=xe.current();return Nt.context&&Nt.context.tagName!=_e&&Pt.implicitlyClosed.hasOwnProperty(Nt.context.tagName)&&de(Nt),Nt.context&&Nt.context.tagName==_e||Pt.matchClosing===!1?(be="tag",q):(be="tag error",Et)}else return Pt.allowMissingTagName&&ee=="endTag"?(be="tag bracket",q(ee,xe,Nt)):(be="error",Et)}function q(ee,xe,Nt){return ee!="endTag"?(be="error",q):(de(Nt),$t)}function Et(ee,xe,Nt){return be="error",q(ee,xe,Nt)}function Bt(ee,xe,Nt){if(ee=="word")return be="attribute",ve;if(ee=="endTag"||ee=="selfcloseTag"){var _e=Nt.tagName,ti=Nt.tagStart;return Nt.tagName=Nt.tagStart=null,ee=="selfcloseTag"||Pt.autoSelfClosers.hasOwnProperty(_e)?De(Nt,_e):(De(Nt,_e),Nt.context=new Ht(Nt,_e,ti==Nt.indented)),$t}return be="error",Bt}function ve(ee,xe,Nt){return ee=="equals"?Vt:(Pt.allowMissing||(be="error"),Bt(ee,xe,Nt))}function Vt(ee,xe,Nt){return ee=="string"?We:ee=="word"&&Pt.allowUnquoted?(be="string",Bt):(be="error",Bt(ee,xe,Nt))}function We(ee,xe,Nt){return ee=="string"?We:Bt(ee,xe,Nt)}return{startState:function(ee){var xe={tokenize:pt,state:$t,indented:ee||0,tagName:null,tagStart:null,context:null};return ee!=null&&(xe.baseIndent=ee),xe},token:function(ee,xe){if(!xe.tagName&&ee.sol()&&(xe.indented=ee.indentation()),ee.eatSpace())return null;yt=null;var Nt=xe.tokenize(ee,xe);return(Nt||yt)&&Nt!="comment"&&(be=null,xe.state=xe.state(yt||Nt,ee,xe),be&&(Nt=be=="error"?Nt+" error":be)),Nt},indent:function(ee,xe,Nt){var _e=ee.context;if(ee.tokenize.isInAttribute)return ee.tagStart==ee.indented?ee.stringStartCol+1:ee.indented+ft;if(_e&&_e.noIndent)return Mt.Pass;if(ee.tokenize!=Rt&&ee.tokenize!=pt)return Nt?Nt.match(/^(\s*)/)[0].length:0;if(ee.tagName)return Pt.multilineTagIndentPastTag!==!1?ee.tagStart+ee.tagName.length+2:ee.tagStart+ft*(Pt.multilineTagIndentFactor||1);if(Pt.alignCDATA&&/<!\[CDATA\[/.test(xe))return 0;var ti=xe&&/^<(\/)?([\w_:\.-]*)/.exec(xe);if(ti&&ti[1])for(;_e;)if(_e.tagName==ti[2]){_e=_e.prev;break}else if(Pt.implicitlyClosed.hasOwnProperty(_e.tagName))_e=_e.prev;else break;else if(ti)for(;_e;){var je=Pt.contextGrabbers[_e.tagName];if(je&&je.hasOwnProperty(ti[2]))_e=_e.prev;else break}for(;_e&&_e.prev&&!_e.startOfLine;)_e=_e.prev;return _e?_e.indent+ft:ee.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:Pt.htmlMode?"html":"xml",helperType:Pt.htmlMode?"html":"xml",skipAttribute:function(ee){ee.state==Vt&&(ee.state=Bt)},xmlCurrentTag:function(ee){return ee.tagName?{name:ee.tagName,close:ee.type=="closeTag"}:null},xmlCurrentContext:function(ee){for(var xe=[],Nt=ee.context;Nt;Nt=Nt.prev)Nt.tagName&&xe.push(Nt.tagName);return xe.reverse()}}}),Mt.defineMIME("text/xml","xml"),Mt.defineMIME("application/xml","xml"),Mt.mimeModes.hasOwnProperty("text/html")||Mt.defineMIME("text/html",{name:"xml",htmlMode:!0})})},12378:function(qn,Li,G){"use strict";G.d(Li,{$u:function(){return rt},BD:function(){return j},E9:function(){return Q},FF:function(){return tr},FJ:function(){return $t},Hn:function(){return De},KX:function(){return Ct},NB:function(){return Qe},S0:function(){return ri},UL:function(){return yt},Vk:function(){return de},Vm:function(){return Si},YI:function(){return sn},ZA:function(){return vt},Zt:function(){return be},al:function(){return D},bn:function(){return U},bx:function(){return P},g2:function(){return Zi},h1:function(){return Vt},hD:function(){return _i},l4:function(){return ft},rU:function(){return He},s_:function(){return E},uz:function(){return Ae},z6:function(){return pt}}),qn=G.hmd(qn),function(){var T;function ur(t){var e=0;return function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}function $n(t){var e=typeof Symbol!="undefined"&&Symbol.iterator&&t[Symbol.iterator];return e?e.call(t):{next:ur(t)}}function Yn(t){for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}var Nr=typeof Object.create=="function"?Object.create:function(t){function e(){}return e.prototype=t,new e},Gn;if(typeof Object.setPrototypeOf=="function")Gn=Object.setPrototypeOf;else{var uo;t:{var zo={a:!0},gr={};try{gr.__proto__=zo,uo=gr.a;break t}catch(t){}uo=!1}Gn=uo?function(t,e){if(t.__proto__=e,t.__proto__!==e)throw new TypeError(t+" is not extensible");return t}:null}var pn=Gn;function gi(t,e){if(t.prototype=Nr(e.prototype),t.prototype.constructor=t,pn)pn(t,e);else for(var i in e)if(i!="prototype")if(Object.defineProperties){var n=Object.getOwnPropertyDescriptor(e,i);n&&Object.defineProperty(t,i,n)}else t[i]=e[i];t.QA=e.prototype}var ct=typeof G.g!="undefined"&&G.g!=null?G.g:self,J=typeof Object.assign=="function"?Object.assign:function(t,e){for(var i=1;i<arguments.length;i++){var n=arguments[i];if(n)for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ot=typeof Object.defineProperties=="function"?Object.defineProperty:function(t,e,i){t!=Array.prototype&&t!=Object.prototype&&(t[e]=i.value)};function nt(t,e){if(e){var i=ct;t=t.split(".");for(var n=0;n<t.length-1;n++){var s=t[n];s in i||(i[s]={}),i=i[s]}t=t[t.length-1],n=i[t],e=e(n),e!=n&&e!=null&&ot(i,t,{writable:!0,value:e})}}nt("Object.assign",function(t){return t||J}),nt("Array.prototype.fill",function(t){return t||function(e,i,n){var s=this.length||0;for(0>i&&(i=Math.max(0,s+i)),(n==null||n>s)&&(n=s),n=Number(n),0>n&&(n=Math.max(0,s+n)),i=Number(i||0);i<n;i++)this[i]=e;return this}});var Z=typeof globalThis=="object"&&globalThis||typeof G.g=="object"&&G.g.global===G.g&&G.g||typeof self=="object"&&self.self===self&&self||{};Z.requestAnimationFrame===void 0&&(Z.setImmediate===void 0?Z.requestAnimationFrame=function(t){Z.setTimeout(t,0)}:Z.requestAnimationFrame=Z.setImmediate);function xt(){}function Ot(t,e){var i=-1;return function(){var n=this,s=arguments;i!==-1&&Z.clearTimeout(i),i=ge(function(){i=-1,t.apply(n,s)},e)}}function ge(t,e){return Z.setTimeout(t,e)}function te(t){return Z.document.createElement(t)}function lt(t){throw Error(t)}function Qt(t,e){t="The object is frozen, so its properties cannot be set: "+t.toString(),e!==void 0&&(t+=" to value: "+e),lt(t)}function me(t,e,i,n){i=i===null?"*":typeof i=="string"?i:typeof i=="function"&&typeof i.className=="string"?i.className:"",n!==void 0&&(i+="."+n),lt(i+" is not in the range "+e+": "+t)}function Fe(t){Z.console&&Z.console.log(t)}function Tt(t){return typeof t=="object"&&t!==null}function ce(t){return Array.isArray(t)||Z.NodeList&&t instanceof Z.NodeList||Z.HTMLCollection&&t instanceof Z.HTMLCollection}function bi(t){return Array.prototype.slice.call(t)}function li(t,e,i){Array.isArray(t)?e>=t.length?t.push(i):t.splice(e,0,i):lt("Cannot insert an object into an HTMLCollection or NodeList: "+i+" at "+e)}function Mi(t,e){Array.isArray(t)?e>=t.length?t.pop():t.splice(e,1):lt("Cannot remove an object from an HTMLCollection or NodeList at "+e)}function Pe(){var t=Ie.pop();return t===void 0?[]:t}function qe(t){t.length=0,Ie.push(t)}function Re(t){if(typeof t=="function"){if(t.className)return t.className;if(t.name)return t.name;var e=t.toString();if(e=e.substring(9,e.indexOf("(")).trim(),e!=="")return t._className=e}else if(Tt(t)&&t.constructor)return Re(t.constructor);return typeof t}function ni(t){var e=t;return Tt(t)&&(t.text?e=t.text:t.name?e=t.name:t.key!==void 0?e=t.key:t.id!==void 0?e=t.id:t.constructor===Object&&(t.Text?e=t.Text:t.Name?e=t.Name:t.Key!==void 0?e=t.Key:t.Id!==void 0?e=t.Id:t.ID!==void 0&&(e=t.ID))),e===void 0?"undefined":e===null?"null":e.toString()}function Ut(t,e){if(t.hasOwnProperty(e))return!0;for(t=Object.getPrototypeOf(t);t&&t!==Function;){if(t.hasOwnProperty(e))return!0;var i=t.CA;if(i&&i[e])return!0;t=Object.getPrototypeOf(t)}return!1}function Wt(t,e,i){Object.defineProperty(Vn.prototype,t,{get:e,set:i})}function Dt(t){for(var e=[],i=0;256>i;i++)e["0123456789abcdef".charAt(i>>4)+"0123456789abcdef".charAt(i&15)]=String.fromCharCode(i);t.length%2&&(t="0"+t),i=[];for(var n=0,s=0;s<t.length;s+=2)i[n++]=e[t.substr(s,2)];for(t=i.join(""),t=t===""?"0":t,e=[],i=0;256>i;i++)e[i]=i;for(i=n=0;256>i;i++)n=(n+e[i]+119)%256,s=e[i],e[i]=e[n],e[n]=s;n=i=0;for(var a="",l=0;l<t.length;l++)i=(i+1)%256,n=(n+e[i])%256,s=e[i],e[i]=e[n],e[n]=s,a+=String.fromCharCode(t.charCodeAt(l)^e[(e[i]+e[n])%256]);return a.indexOf("GoJS 2.1 evaluation")>-1||a.indexOf("\xA9 1998-2021 Northwoods Software")>-1||a.indexOf("Not for distribution or production use")>-1||a.indexOf("gojs.net")>-1?"":a}var ke=Z.navigator!==void 0&&0<Z.navigator.userAgent.indexOf("Trident/7"),re=Z.navigator!==void 0&&Z.navigator.platform!==void 0&&Z.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null,Ie=[];Object.freeze([]),xt.className="Util",xt.Dx="32ab5ff3b26f42dc0ed90f21472913b5",xt.adym="gojs.net",xt.vfo="28e645fdb266",xt.className="Util";function mt(t,e,i){vi(this),this.j=t,this.xa=e,this.o=i}mt.prototype.toString=function(){return"EnumValue."+this.xa};function Xe(t,e){return e==null||e===""?null:t[e]}ct.Object.defineProperties(mt.prototype,{classType:{get:function(){return this.j}},name:{get:function(){return this.xa}},value:{get:function(){return this.o}}}),mt.className="EnumValue";function pi(){this.ew=[]}pi.prototype.toString=function(){return this.ew.join("")},pi.prototype.add=function(t){t!==""&&this.ew.push(t)},pi.className="StringBuilder";function ci(){}ci.className="PropertyCollection";var Ui={EA:!1,JA:!1,GA:!1,IA:!1,NA:!1,LA:!1,nx:!1,FA:null,trace:function(t){Z.console&&Z.console.log(t)},HA:function(t,e,i,n){t.strokeStyle="red",t.fillStyle="red",t.font="8px sans-serif",t.beginPath(),t.moveTo(-10,0),t.lineTo(10,0),t.moveTo(0,-10),t.lineTo(0,10),t.stroke(),t.setTransform(1,0,0,1,0,0),t.scale(i,i),t.transform(e.m11,e.m12,e.m21,e.m22,e.dx,e.dy),t.lineWidth=2,t.beginPath(),t.moveTo(n.left,n.top+20),t.lineTo(n.left,n.top),t.lineTo(n.left+20,n.top),t.moveTo(n.right,n.bottom-20),t.lineTo(n.right,n.bottom),t.lineTo(n.right-20,n.bottom),t.stroke(),t.fillText("DB: "+Math.round(n.x)+", "+Math.round(n.y)+", "+Math.round(n.width)+", "+Math.round(n.height),n.left,n.top-5)},DA:function(t){var e={},i;for(i in t){if(e.x=i,e.x!=="licenseKey"){var n=t[e.x];if(n.prototype!==void 0){e.Zl=Object.getOwnPropertyNames(n.prototype);for(var s={Tj:0};s.Tj<e.Zl.length;s={Tj:s.Tj},s.Tj++){var a=Object.getOwnPropertyDescriptor(n.prototype,e.Zl[s.Tj]);a.get!==void 0&&a.set===void 0&&Object.defineProperty(n.prototype,e.Zl[s.Tj],{set:function(l,c){return function(){throw Error("Property "+l.Zl[c.Tj]+" of "+l.x+" is read-only.")}}(e,s)})}}}e={Zl:e.Zl,x:e.x}}}};function Ni(){}Ni.prototype.reset=function(){},Ni.prototype.next=function(){return!1},Ni.prototype.Ad=function(){return!1},Ni.prototype.first=function(){return null},Ni.prototype.any=function(){return!1},Ni.prototype.all=function(){return!0},Ni.prototype.each=function(){return this},Ni.prototype.map=function(){return this},Ni.prototype.filter=function(){return this},Ni.prototype.de=function(){},Ni.prototype.toString=function(){return"EmptyIterator"},ct.Object.defineProperties(Ni.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}}),Ni.prototype.first=Ni.prototype.first,Ni.prototype.hasNext=Ni.prototype.Ad,Ni.prototype.next=Ni.prototype.next,Ni.prototype.reset=Ni.prototype.reset;var Gi=null;Ni.className="EmptyIterator",Gi=new Ni;function ki(t){this.key=-1,this.value=t}ki.prototype.reset=function(){this.key=-1},ki.prototype.next=function(){return this.key===-1?(this.key=0,!0):!1},ki.prototype.Ad=function(){return this.next()},ki.prototype.first=function(){return this.key=0,this.value},ki.prototype.any=function(t){return this.key=-1,t(this.value)},ki.prototype.all=function(t){return this.key=-1,t(this.value)},ki.prototype.each=function(t){return this.key=-1,t(this.value),this},ki.prototype.map=function(t){return new ki(t(this.value))},ki.prototype.filter=function(t){return t(this.value)?new ki(this.value):Gi},ki.prototype.de=function(){this.value=null},ki.prototype.toString=function(){return"SingletonIterator("+this.value+")"},ct.Object.defineProperties(ki.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}}),ki.prototype.first=ki.prototype.first,ki.prototype.hasNext=ki.prototype.Ad,ki.prototype.next=ki.prototype.next,ki.prototype.reset=ki.prototype.reset,ki.className="SingletonIterator";function di(t){this.Bb=t,this.qf=null,t.Sa=null,this.qa=t.Ja,this.Za=-1}di.prototype.reset=function(){var t=this.Bb;t.Sa=null,this.qa=t.Ja,this.Za=-1},di.prototype.next=function(){var t=this.Bb;if(t.Ja!==this.qa&&0>this.key)return!1;t=t.s;var e=t.length,i=++this.Za,n=this.qf;if(n!==null)for(;i<e;){var s=t[i];if(n(s))return this.key=this.Za=i,this.value=s,!0;i++}else{if(i<e)return this.key=i,this.value=t[i],!0;this.de()}return!1},di.prototype.Ad=function(){return this.next()},di.prototype.first=function(){var t=this.Bb;this.qa=t.Ja,this.Za=0,t=t.s;var e=t.length,i=this.qf;if(i!==null){for(var n=0;n<e;){var s=t[n];if(i(s))return this.key=this.Za=n,this.value=s;n++}return null}return 0<e?(t=t[0],this.key=0,this.value=t):null},di.prototype.any=function(t){var e=this.Bb;e.Sa=null,this.Za=-1,e=e.s;for(var i=e.length,n=this.qf,s=0;s<i;s++){var a=e[s];if((n===null||n(a))&&t(a))return!0}return!1},di.prototype.all=function(t){var e=this.Bb;e.Sa=null,this.Za=-1,e=e.s;for(var i=e.length,n=this.qf,s=0;s<i;s++){var a=e[s];if((n===null||n(a))&&!t(a))return!1}return!0},di.prototype.each=function(t){var e=this.Bb;e.Sa=null,this.Za=-1,e=e.s;for(var i=e.length,n=this.qf,s=0;s<i;s++){var a=e[s];(n===null||n(a))&&t(a)}return this},di.prototype.map=function(t){var e=this.Bb;e.Sa=null,this.Za=-1;var i=[];e=e.s;for(var n=e.length,s=this.qf,a=0;a<n;a++){var l=e[a];(s===null||s(l))&&i.push(t(l))}return t=new Kt,t.s=i,t.xb(),t.iterator},di.prototype.filter=function(t){var e=this.Bb;e.Sa=null,this.Za=-1;var i=[];e=e.s;for(var n=e.length,s=this.qf,a=0;a<n;a++){var l=e[a];(s===null||s(l))&&t(l)&&i.push(l)}return t=new Kt,t.s=i,t.xb(),t.iterator},di.prototype.de=function(){this.key=-1,this.value=null,this.qa=-1,this.qf=null,this.Bb.Sa=this},di.prototype.toString=function(){return"ListIterator@"+this.Za+"/"+this.Bb.count},ct.Object.defineProperties(di.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.qf},set:function(t){this.qf=t}},count:{get:function(){var t=this.qf;if(t!==null){for(var e=0,i=this.Bb.s,n=i.length,s=0;s<n;s++)t(i[s])&&e++;return e}return this.Bb.s.length}}}),di.prototype.first=di.prototype.first,di.prototype.hasNext=di.prototype.Ad,di.prototype.next=di.prototype.next,di.prototype.reset=di.prototype.reset,di.className="ListIterator";function Ki(t){this.Bb=t,t.Hg=null,this.qa=t.Ja,this.Za=t.s.length}Ki.prototype.reset=function(){var t=this.Bb;t.Hg=null,this.qa=t.Ja,this.Za=t.s.length},Ki.prototype.next=function(){var t=this.Bb;if(t.Ja!==this.qa&&0>this.key)return!1;var e=--this.Za;return 0<=e?(this.key=e,this.value=t.s[e],!0):(this.de(),!1)},Ki.prototype.Ad=function(){return this.next()},Ki.prototype.first=function(){var t=this.Bb;this.qa=t.Ja;var e=t.s;return this.Za=t=e.length-1,0<=t?(e=e[t],this.key=t,this.value=e):null},Ki.prototype.any=function(t){var e=this.Bb;e.Hg=null,e=e.s;var i=e.length;for(this.Za=i,--i;0<=i;i--)if(t(e[i]))return!0;return!1},Ki.prototype.all=function(t){var e=this.Bb;e.Hg=null,e=e.s;var i=e.length;for(this.Za=i,--i;0<=i;i--)if(!t(e[i]))return!1;return!0},Ki.prototype.each=function(t){var e=this.Bb;e.Hg=null,e=e.s;var i=e.length;for(this.Za=i,--i;0<=i;i--)t(e[i]);return this},Ki.prototype.map=function(t){var e=this.Bb;e.Hg=null;var i=[];e=e.s;var n=e.length;for(this.Za=n,--n;0<=n;n--)i.push(t(e[n]));return t=new Kt,t.s=i,t.xb(),t.iterator},Ki.prototype.filter=function(t){var e=this.Bb;e.Hg=null;var i=[];e=e.s;var n=e.length;for(this.Za=n,--n;0<=n;n--){var s=e[n];t(s)&&i.push(s)}return t=new Kt,t.s=i,t.xb(),t.iterator},Ki.prototype.de=function(){this.key=-1,this.value=null,this.qa=-1,this.Bb.Hg=this},Ki.prototype.toString=function(){return"ListIteratorBackwards("+this.Za+"/"+this.Bb.count+")"},ct.Object.defineProperties(Ki.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.Bb.s.length}}}),Ki.prototype.first=Ki.prototype.first,Ki.prototype.hasNext=Ki.prototype.Ad,Ki.prototype.next=Ki.prototype.next,Ki.prototype.reset=Ki.prototype.reset,Ki.className="ListIteratorBackwards";function Kt(t){vi(this),this._isFrozen=!1,this.s=[],this.Ja=0,this.Hg=this.Sa=null,typeof t=="string"&&lt("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type."),t!==void 0&&this.addAll(t)}T=Kt.prototype,T.xb=function(){var t=this.Ja;t++,999999999<t&&(t=0),this.Ja=t},T.freeze=function(){return this._isFrozen=!0,this},T.ka=function(){return this._isFrozen=!1,this},T.toString=function(){return"List()#"+Ti(this)},T.add=function(t){return t===null?this:(this._isFrozen&&Qt(this,t),this.s.push(t),this.xb(),this)},T.push=function(t){this.add(t)},T.addAll=function(t){if(t===null)return this;this._isFrozen&&Qt(this);var e=this.s;if(ce(t))for(var i=t.length,n=0;n<i;n++)e.push(t[n]);else for(t=t.iterator;t.next();)e.push(t.value);return this.xb(),this},T.clear=function(){this._isFrozen&&Qt(this),this.s.length=0,this.xb()},T.contains=function(t){return t===null?!1:this.s.indexOf(t)!==-1},T.has=function(t){return this.contains(t)},T.indexOf=function(t){return t===null?-1:this.s.indexOf(t)},T.M=function(t){var e=this.s;return(0>t||t>=e.length)&&me(t,"0 <= i < length",Kt,"elt:i"),e[t]},T.get=function(t){return this.M(t)},T.cd=function(t,e){var i=this.s;(0>t||t>=i.length)&&me(t,"0 <= i < length",Kt,"setElt:i"),this._isFrozen&&Qt(this,t),i[t]=e},T.set=function(t,e){this.cd(t,e)},T.first=function(){var t=this.s;return t.length===0?null:t[0]},T.jc=function(){var t=this.s,e=t.length;return 0<e?t[e-1]:null},T.pop=function(){this._isFrozen&&Qt(this);var t=this.s;return 0<t.length?t.pop():null},Kt.prototype.any=function(t){for(var e=this.s,i=e.length,n=0;n<i;n++)if(t(e[n]))return!0;return!1},Kt.prototype.all=function(t){for(var e=this.s,i=e.length,n=0;n<i;n++)if(!t(e[n]))return!1;return!0},Kt.prototype.each=function(t){for(var e=this.s,i=e.length,n=0;n<i;n++)t(e[n]);return this},Kt.prototype.map=function(t){for(var e=new Kt,i=[],n=this.s,s=n.length,a=0;a<s;a++)i.push(t(n[a]));return e.s=i,e.xb(),e},Kt.prototype.filter=function(t){for(var e=new Kt,i=[],n=this.s,s=n.length,a=0;a<s;a++){var l=n[a];t(l)&&i.push(l)}return e.s=i,e.xb(),e},T=Kt.prototype,T.Gb=function(t,e){0>t&&me(t,">= 0",Kt,"insertAt:i"),this._isFrozen&&Qt(this,t);var i=this.s;t>=i.length?i.push(e):i.splice(t,0,e),this.xb()},T.remove=function(t){if(t===null)return!1;this._isFrozen&&Qt(this,t);var e=this.s;return t=e.indexOf(t),t===-1?!1:(t===e.length-1?e.pop():e.splice(t,1),this.xb(),!0)},T.delete=function(t){return this.remove(t)},T.mb=function(t){var e=this.s;(0>t||t>=e.length)&&me(t,"0 <= i < length",Kt,"removeAt:i"),this._isFrozen&&Qt(this,t),t===e.length-1?e.pop():e.splice(t,1),this.xb()},T.removeRange=function(t,e){var i=this.s,n=i.length;if(0>t)t=0;else if(t>=n)return this;if(0>e)return this;if(e>=n&&(e=n-1),t>e)return this;this._isFrozen&&Qt(this);for(var s=t,a=e+1;a<n;)i[s++]=i[a++];return i.length=n-(e-t+1),this.xb(),this},Kt.prototype.copy=function(){var t=new Kt,e=this.s;return 0<e.length&&(t.s=Array.prototype.slice.call(e)),t},T=Kt.prototype,T.Fa=function(){for(var t=this.s,e=this.count,i=Array(e),n=0;n<e;n++)i[n]=t[n];return i},T.Iv=function(){for(var t=new At,e=this.s,i=this.count,n=0;n<i;n++)t.add(e[n]);return t},T.sort=function(t){return this._isFrozen&&Qt(this),this.s.sort(t),this.xb(),this},T.zi=function(t,e,i){var n=this.s,s=n.length;e===void 0&&(e=0),i===void 0&&(i=s),this._isFrozen&&Qt(this);var a=i-e;if(1>=a)return this;if((0>e||e>=s-1)&&me(e,"0 <= from < length",Kt,"sortRange:from"),a===2)return i=n[e],s=n[e+1],0<t(i,s)&&(n[e]=s,n[e+1]=i,this.xb()),this;if(e===0)if(i>=s)n.sort(t);else for(e=n.slice(0,i),e.sort(t),t=0;t<i;t++)n[t]=e[t];else if(i>=s)for(i=n.slice(e),i.sort(t),t=e;t<s;t++)n[t]=i[t-e];else for(s=n.slice(e,i),s.sort(t),t=e;t<i;t++)n[t]=s[t-e];return this.xb(),this},T.reverse=function(){return this._isFrozen&&Qt(this),this.s.reverse(),this.xb(),this},ct.Object.defineProperties(Kt.prototype,{_dataArray:{get:function(){return this.s}},count:{get:function(){return this.s.length}},size:{get:function(){return this.s.length}},length:{get:function(){return this.s.length}},iterator:{get:function(){if(0>=this.s.length)return Gi;var t=this.Sa;return t!==null?(t.reset(),t):new di(this)}},iteratorBackwards:{get:function(){if(0>=this.s.length)return Gi;var t=this.Hg;return t!==null?(t.reset(),t):new Ki(this)}}}),Kt.prototype.reverse=Kt.prototype.reverse,Kt.prototype.sortRange=Kt.prototype.zi,Kt.prototype.sort=Kt.prototype.sort,Kt.prototype.toSet=Kt.prototype.Iv,Kt.prototype.toArray=Kt.prototype.Fa,Kt.prototype.removeRange=Kt.prototype.removeRange,Kt.prototype.removeAt=Kt.prototype.mb,Kt.prototype.delete=Kt.prototype.delete,Kt.prototype.remove=Kt.prototype.remove,Kt.prototype.insertAt=Kt.prototype.Gb,Kt.prototype.pop=Kt.prototype.pop,Kt.prototype.last=Kt.prototype.jc,Kt.prototype.first=Kt.prototype.first,Kt.prototype.set=Kt.prototype.set,Kt.prototype.setElt=Kt.prototype.cd,Kt.prototype.get=Kt.prototype.get,Kt.prototype.elt=Kt.prototype.M,Kt.prototype.indexOf=Kt.prototype.indexOf,Kt.prototype.has=Kt.prototype.has,Kt.prototype.contains=Kt.prototype.contains,Kt.prototype.clear=Kt.prototype.clear,Kt.prototype.addAll=Kt.prototype.addAll,Kt.prototype.push=Kt.prototype.push,Kt.prototype.add=Kt.prototype.add,Kt.prototype.thaw=Kt.prototype.ka,Kt.prototype.freeze=Kt.prototype.freeze,Kt.className="List";function Ri(t){this.eg=t,t.Sa=null,this.qa=t.Ja,this.sa=null}Ri.prototype.reset=function(){var t=this.eg;t.Sa=null,this.qa=t.Ja,this.sa=null},Ri.prototype.next=function(){var t=this.eg;if(t.Ja!==this.qa&&this.key===null)return!1;var e=this.sa;return e=e===null?t.ea:e.va,e!==null?(this.sa=e,this.value=e.value,this.key=e.key,!0):(this.de(),!1)},Ri.prototype.Ad=function(){return this.next()},Ri.prototype.first=function(){var t=this.eg;if(this.qa=t.Ja,t=t.ea,t!==null){this.sa=t;var e=t.value;return this.key=t.key,this.value=e}return null},Ri.prototype.any=function(t){var e=this.eg;for(this.sa=e.Sa=null,e=e.ea;e!==null;){if(t(e.value))return!0;e=e.va}return!1},Ri.prototype.all=function(t){var e=this.eg;for(this.sa=e.Sa=null,e=e.ea;e!==null;){if(!t(e.value))return!1;e=e.va}return!0},Ri.prototype.each=function(t){var e=this.eg;for(this.sa=e.Sa=null,e=e.ea;e!==null;)t(e.value),e=e.va;return this},Ri.prototype.map=function(t){var e=this.eg;e.Sa=null;var i=new Kt;for(e=e.ea;e!==null;)i.add(t(e.value)),e=e.va;return i.iterator},Ri.prototype.filter=function(t){var e=this.eg;e.Sa=null;var i=new Kt;for(e=e.ea;e!==null;){var n=e.value;t(n)&&i.add(n),e=e.va}return i.iterator},Ri.prototype.de=function(){this.value=this.key=null,this.qa=-1,this.eg.Sa=this},Ri.prototype.toString=function(){return this.sa!==null?"SetIterator@"+this.sa.value:"SetIterator"},ct.Object.defineProperties(Ri.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.eg.Sb}}}),Ri.prototype.first=Ri.prototype.first,Ri.prototype.hasNext=Ri.prototype.Ad,Ri.prototype.next=Ri.prototype.next,Ri.prototype.reset=Ri.prototype.reset,Ri.className="SetIterator";function At(t){vi(this),this._isFrozen=!1,this.Tb={},this.Sb=0,this.Sa=null,this.Ja=0,this.kf=this.ea=null,typeof t=="string"&&lt("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type."),t!==void 0&&this.addAll(t)}T=At.prototype,T.xb=function(){var t=this.Ja;t++,999999999<t&&(t=0),this.Ja=t},T.freeze=function(){return this._isFrozen=!0,this},T.ka=function(){return this._isFrozen=!1,this},T.toString=function(){return"Set()#"+Ti(this)},T.add=function(t){if(t===null)return this;this._isFrozen&&Qt(this,t);var e=t;return Tt(t)&&(e=Qi(t)),this.Tb[e]===void 0&&(this.Sb++,t=new Je(t,t),this.Tb[e]=t,e=this.kf,e===null?this.ea=t:(t.ll=e,e.va=t),this.kf=t,this.xb()),this},T.addAll=function(t){if(t===null)return this;if(this._isFrozen&&Qt(this),ce(t))for(var e=t.length,i=0;i<e;i++)this.add(t[i]);else for(t=t.iterator;t.next();)this.add(t.value);return this},T.contains=function(t){if(t===null)return!1;var e=t;return Tt(t)&&(e=Ti(t),e===void 0)?!1:this.Tb[e]!==void 0},T.has=function(t){return this.contains(t)},T.Sy=function(t){if(t===null)return!0;for(t=t.iterator;t.next();)if(!this.contains(t.value))return!1;return!0},T.Ty=function(t){if(t===null)return!0;for(t=t.iterator;t.next();)if(this.contains(t.value))return!0;return!1},T.first=function(){var t=this.ea;return t===null?null:t.value},At.prototype.any=function(t){for(var e=this.ea;e!==null;){if(t(e.value))return!0;e=e.va}return!1},At.prototype.all=function(t){for(var e=this.ea;e!==null;){if(!t(e.value))return!1;e=e.va}return!0},At.prototype.each=function(t){for(var e=this.ea;e!==null;)t(e.value),e=e.va;return this},At.prototype.map=function(t){for(var e=new At,i=this.ea;i!==null;)e.add(t(i.value)),i=i.va;return e},At.prototype.filter=function(t){for(var e=new At,i=this.ea;i!==null;){var n=i.value;t(n)&&e.add(n),i=i.va}return e},T=At.prototype,T.remove=function(t){if(t===null)return!1;this._isFrozen&&Qt(this,t);var e=t;if(Tt(t)&&(e=Ti(t),e===void 0)||(t=this.Tb[e],t===void 0))return!1;var i=t.va,n=t.ll;return i!==null&&(i.ll=n),n!==null&&(n.va=i),this.ea===t&&(this.ea=i),this.kf===t&&(this.kf=n),delete this.Tb[e],this.Sb--,this.xb(),!0},T.delete=function(t){return this.remove(t)},T.hp=function(t){if(t===null)return this;if(this._isFrozen&&Qt(this),ce(t))for(var e=t.length,i=0;i<e;i++)this.remove(t[i]);else for(t=t.iterator;t.next();)this.remove(t.value);return this},T.pA=function(t){if(t===null||this.count===0)return this;this._isFrozen&&Qt(this);var e=new At;e.addAll(t),t=[];for(var i=this.iterator;i.next();){var n=i.value;e.contains(n)||t.push(n)}return this.hp(t),this},T.clear=function(){this._isFrozen&&Qt(this),this.Tb={},this.Sb=0,this.Sa!==null&&this.Sa.reset(),this.kf=this.ea=null,this.xb()},At.prototype.copy=function(){var t=new At,e=this.Tb,i;for(i in e)t.add(e[i].value);return t},At.prototype.Fa=function(){var t=Array(this.Sb),e=this.Tb,i=0,n;for(n in e)t[i]=e[n].value,i++;return t},At.prototype.Hv=function(){var t=new Kt,e=this.Tb,i;for(i in e)t.add(e[i].value);return t};function vi(t){t.__gohashid=gn++}function Qi(t){var e=t.__gohashid;return e===void 0&&(e=gn++,t.__gohashid=e),e}function Ti(t){return t.__gohashid}ct.Object.defineProperties(At.prototype,{count:{get:function(){return this.Sb}},size:{get:function(){return this.Sb}},iterator:{get:function(){if(0>=this.Sb)return Gi;var t=this.Sa;return t!==null?(t.reset(),t):new Ri(this)}}}),At.prototype.toList=At.prototype.Hv,At.prototype.toArray=At.prototype.Fa,At.prototype.clear=At.prototype.clear,At.prototype.retainAll=At.prototype.pA,At.prototype.removeAll=At.prototype.hp,At.prototype.delete=At.prototype.delete,At.prototype.remove=At.prototype.remove,At.prototype.first=At.prototype.first,At.prototype.containsAny=At.prototype.Ty,At.prototype.containsAll=At.prototype.Sy,At.prototype.has=At.prototype.has,At.prototype.contains=At.prototype.contains,At.prototype.addAll=At.prototype.addAll,At.prototype.add=At.prototype.add,At.prototype.thaw=At.prototype.ka,At.prototype.freeze=At.prototype.freeze;var gn=1;At.className="Set",At.uniqueHash=vi,At.hashIdUnique=Qi,At.hashId=Ti;function Mn(t){this.ma=t,this.qa=t.Ja,this.sa=null}Mn.prototype.reset=function(){this.qa=this.ma.Ja,this.sa=null},Mn.prototype.next=function(){var t=this.ma;if(t.Ja!==this.qa&&this.key===null)return!1;var e=this.sa;return e=e===null?t.ea:e.va,e!==null?(this.sa=e,this.value=this.key=t=e.key,!0):(this.de(),!1)},Mn.prototype.Ad=function(){return this.next()},Mn.prototype.first=function(){var t=this.ma;return this.qa=t.Ja,t=t.ea,t!==null?(this.sa=t,this.value=this.key=t=t.key):null},Mn.prototype.any=function(t){var e=this.ma;for(this.sa=null,e=e.ea;e!==null;){if(t(e.key))return!0;e=e.va}return!1},Mn.prototype.all=function(t){var e=this.ma;for(this.sa=null,e=e.ea;e!==null;){if(!t(e.key))return!1;e=e.va}return!0},Mn.prototype.each=function(t){var e=this.ma;for(this.sa=null,e=e.ea;e!==null;)t(e.key),e=e.va;return this},Mn.prototype.map=function(t){var e=this.ma;this.sa=null;var i=new Kt;for(e=e.ea;e!==null;)i.add(t(e.key)),e=e.va;return i.iterator},Mn.prototype.filter=function(t){var e=this.ma;this.sa=null;var i=new Kt;for(e=e.ea;e!==null;){var n=e.key;t(n)&&i.add(n),e=e.va}return i.iterator},Mn.prototype.de=function(){this.value=this.key=null,this.qa=-1},Mn.prototype.toString=function(){return this.sa!==null?"MapKeySetIterator@"+this.sa.value:"MapKeySetIterator"},ct.Object.defineProperties(Mn.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ma.Sb}}}),Mn.prototype.first=Mn.prototype.first,Mn.prototype.hasNext=Mn.prototype.Ad,Mn.prototype.next=Mn.prototype.next,Mn.prototype.reset=Mn.prototype.reset,Mn.className="MapKeySetIterator";function mi(t){At.call(this),vi(this),this._isFrozen=!0,this.ma=t}gi(mi,At),T=mi.prototype,T.freeze=function(){return this},T.ka=function(){return this},T.toString=function(){return"MapKeySet("+this.ma.toString()+")"},T.add=function(){lt("This Set is read-only: "+this.toString())},T.contains=function(t){return this.ma.contains(t)},T.has=function(t){return this.contains(t)},T.remove=function(){lt("This Set is read-only: "+this.toString())},T.delete=function(t){return this.remove(t)},T.clear=function(){lt("This Set is read-only: "+this.toString())},T.first=function(){var t=this.ma.ea;return t!==null?t.key:null},mi.prototype.any=function(t){for(var e=this.ma.ea;e!==null;){if(t(e.key))return!0;e=e.va}return!1},mi.prototype.all=function(t){for(var e=this.ma.ea;e!==null;){if(!t(e.key))return!1;e=e.va}return!0},mi.prototype.each=function(t){for(var e=this.ma.ea;e!==null;)t(e.key),e=e.va;return this},mi.prototype.map=function(t){for(var e=new At,i=this.ma.ea;i!==null;)e.add(t(i.key)),i=i.va;return e},mi.prototype.filter=function(t){for(var e=new At,i=this.ma.ea;i!==null;){var n=i.key;t(n)&&e.add(n),i=i.va}return e},mi.prototype.copy=function(){return new mi(this.ma)},mi.prototype.Iv=function(){var t=new At,e=this.ma.Tb,i;for(i in e)t.add(e[i].key);return t},mi.prototype.Fa=function(){var t=this.ma.Tb,e=Array(this.ma.Sb),i=0,n;for(n in t)e[i]=t[n].key,i++;return e},mi.prototype.Hv=function(){var t=new Kt,e=this.ma.Tb,i;for(i in e)t.add(e[i].key);return t},ct.Object.defineProperties(mi.prototype,{count:{get:function(){return this.ma.Sb}},size:{get:function(){return this.ma.Sb}},iterator:{get:function(){return 0>=this.ma.Sb?Gi:new Mn(this.ma)}}}),mi.prototype.toList=mi.prototype.Hv,mi.prototype.toArray=mi.prototype.Fa,mi.prototype.toSet=mi.prototype.Iv,mi.prototype.first=mi.prototype.first,mi.prototype.clear=mi.prototype.clear,mi.prototype.delete=mi.prototype.delete,mi.prototype.remove=mi.prototype.remove,mi.prototype.has=mi.prototype.has,mi.prototype.contains=mi.prototype.contains,mi.prototype.add=mi.prototype.add,mi.prototype.thaw=mi.prototype.ka,mi.prototype.freeze=mi.prototype.freeze,mi.className="MapKeySet";function Ye(t){this.ma=t,t.jf=null,this.qa=t.Ja,this.sa=null}Ye.prototype.reset=function(){var t=this.ma;t.jf=null,this.qa=t.Ja,this.sa=null},Ye.prototype.next=function(){var t=this.ma;if(t.Ja!==this.qa&&this.key===null)return!1;var e=this.sa;return e=e===null?t.ea:e.va,e!==null?(this.sa=e,this.value=e.value,this.key=e.key,!0):(this.de(),!1)},Ye.prototype.Ad=function(){return this.next()},Ye.prototype.first=function(){var t=this.ma;if(this.qa=t.Ja,t=t.ea,t!==null){this.sa=t;var e=t.value;return this.key=t.key,this.value=e}return null},Ye.prototype.any=function(t){var e=this.ma;for(this.sa=e.jf=null,e=e.ea;e!==null;){if(t(e.value))return!0;e=e.va}return!1},Ye.prototype.all=function(t){var e=this.ma;for(this.sa=e.jf=null,e=e.ea;e!==null;){if(!t(e.value))return!1;e=e.va}return!0},Ye.prototype.each=function(t){var e=this.ma;for(this.sa=e.jf=null,e=e.ea;e!==null;)t(e.value),e=e.va;return this},Ye.prototype.map=function(t){var e=this.ma;this.sa=e.jf=null;var i=new Kt;for(e=e.ea;e!==null;)i.add(t(e.value)),e=e.va;return i.iterator},Ye.prototype.filter=function(t){var e=this.ma;this.sa=e.jf=null;var i=new Kt;for(e=e.ea;e!==null;){var n=e.value;t(n)&&i.add(n),e=e.va}return i.iterator},Ye.prototype.de=function(){this.value=this.key=null,this.qa=-1,this.ma.jf=this},Ye.prototype.toString=function(){return this.sa!==null?"MapValueSetIterator@"+this.sa.value:"MapValueSetIterator"},ct.Object.defineProperties(Ye.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ma.Sb}}}),Ye.prototype.first=Ye.prototype.first,Ye.prototype.hasNext=Ye.prototype.Ad,Ye.prototype.next=Ye.prototype.next,Ye.prototype.reset=Ye.prototype.reset,Ye.className="MapValueSetIterator";function Je(t,e){this.key=t,this.value=e,this.ll=this.va=null}Je.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"},Je.className="KeyValuePair";function Oi(t){this.ma=t,t.Sa=null,this.qa=t.Ja,this.sa=null}Oi.prototype.reset=function(){var t=this.ma;t.Sa=null,this.qa=t.Ja,this.sa=null},Oi.prototype.next=function(){var t=this.ma;if(t.Ja!==this.qa&&this.key===null)return!1;var e=this.sa;return e=e===null?t.ea:e.va,e!==null?(this.sa=e,this.key=e.key,this.value=e.value,!0):(this.de(),!1)},Oi.prototype.Ad=function(){return this.next()},Oi.prototype.first=function(){var t=this.ma;return this.qa=t.Ja,t=t.ea,t!==null?(this.sa=t,this.key=t.key,this.value=t.value,t):null},Oi.prototype.any=function(t){var e=this.ma;for(this.sa=e.Sa=null,e=e.ea;e!==null;){if(t(e))return!0;e=e.va}return!1},Oi.prototype.all=function(t){var e=this.ma;for(this.sa=e.Sa=null,e=e.ea;e!==null;){if(!t(e))return!1;e=e.va}return!0},Oi.prototype.each=function(t){var e=this.ma;for(this.sa=e.Sa=null,e=e.ea;e!==null;)t(e),e=e.va;return this},Oi.prototype.map=function(t){var e=this.ma;this.sa=e.Sa=null;var i=new Kt;for(e=e.ea;e!==null;)i.add(t(e)),e=e.va;return i.iterator},Oi.prototype.filter=function(t){var e=this.ma;this.sa=e.Sa=null;var i=new Kt;for(e=e.ea;e!==null;)t(e)&&i.add(e),e=e.va;return i.iterator},Oi.prototype.de=function(){this.value=this.key=null,this.qa=-1,this.ma.Sa=this},Oi.prototype.toString=function(){return this.sa!==null?"MapIterator@"+this.sa:"MapIterator"},ct.Object.defineProperties(Oi.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ma.Sb}}}),Oi.prototype.first=Oi.prototype.first,Oi.prototype.hasNext=Oi.prototype.Ad,Oi.prototype.next=Oi.prototype.next,Oi.prototype.reset=Oi.prototype.reset,Oi.className="MapIterator";function pe(t){vi(this),this._isFrozen=!1,this.Tb={},this.Sb=0,this.jf=this.Sa=null,this.Ja=0,this.kf=this.ea=null,typeof t=="string"&&lt("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type."),t!==void 0&&this.addAll(t)}T=pe.prototype,T.xb=function(){var t=this.Ja;t++,999999999<t&&(t=0),this.Ja=t},T.freeze=function(){return this._isFrozen=!0,this},T.ka=function(){return this._isFrozen=!1,this},T.toString=function(){return"Map()#"+Ti(this)},T.add=function(t,e){this._isFrozen&&Qt(this,t);var i=t;Tt(t)&&(i=Qi(t));var n=this.Tb[i];return n===void 0?(this.Sb++,t=new Je(t,e),this.Tb[i]=t,i=this.kf,i===null?this.ea=t:(t.ll=i,i.va=t),this.kf=t,this.xb()):n.value=e,this},T.set=function(t,e){return this.add(t,e)},T.addAll=function(t){if(t===null)return this;if(ce(t))for(var e=t.length,i=0;i<e;i++){var n=t[i];this.add(n.key,n.value)}else if(t instanceof pe)for(t=t.iterator;t.next();)this.add(t.key,t.value);else for(t=t.iterator;t.next();)e=t.value,this.add(e.key,e.value);return this},T.first=function(){return this.ea},pe.prototype.any=function(t){for(var e=this.ea;e!==null;){if(t(e))return!0;e=e.va}return!1},pe.prototype.all=function(t){for(var e=this.ea;e!==null;){if(!t(e))return!1;e=e.va}return!0},pe.prototype.each=function(t){for(var e=this.ea;e!==null;)t(e),e=e.va;return this},pe.prototype.map=function(t){for(var e=new pe,i=this.ea;i!==null;)e.add(i.key,t(i)),i=i.va;return e},pe.prototype.filter=function(t){for(var e=new pe,i=this.ea;i!==null;)t(i)&&e.add(i.key,i.value),i=i.va;return e},T=pe.prototype,T.contains=function(t){var e=t;return Tt(t)&&(e=Ti(t),e===void 0)?!1:this.Tb[e]!==void 0},T.has=function(t){return this.contains(t)},T.I=function(t){var e=t;return Tt(t)&&(e=Ti(t),e===void 0)?null:(t=this.Tb[e],t===void 0?null:t.value)},T.get=function(t){return this.I(t)},T.remove=function(t){if(t===null)return!1;this._isFrozen&&Qt(this,t);var e=t;if(Tt(t)&&(e=Ti(t),e===void 0)||(t=this.Tb[e],t===void 0))return!1;var i=t.va,n=t.ll;return i!==null&&(i.ll=n),n!==null&&(n.va=i),this.ea===t&&(this.ea=i),this.kf===t&&(this.kf=n),delete this.Tb[e],this.Sb--,this.xb(),!0},T.delete=function(t){return this.remove(t)},T.clear=function(){this._isFrozen&&Qt(this),this.Tb={},this.Sb=0,this.Sa!==null&&this.Sa.reset(),this.jf!==null&&this.jf.reset(),this.kf=this.ea=null,this.xb()},pe.prototype.copy=function(){var t=new pe,e=this.Tb,i;for(i in e){var n=e[i];t.add(n.key,n.value)}return t},pe.prototype.Fa=function(){var t=this.Tb,e=Array(this.Sb),i=0,n;for(n in t){var s=t[n];e[i]=new Je(s.key,s.value),i++}return e},pe.prototype.Lf=function(){return new mi(this)},ct.Object.defineProperties(pe.prototype,{count:{get:function(){return this.Sb}},size:{get:function(){return this.Sb}},iterator:{get:function(){if(0>=this.count)return Gi;var t=this.Sa;return t!==null?(t.reset(),t):new Oi(this)}},iteratorKeys:{get:function(){return 0>=this.count?Gi:new Mn(this)}},iteratorValues:{get:function(){if(0>=this.count)return Gi;var t=this.jf;return t!==null?(t.reset(),t):new Ye(this)}}}),pe.prototype.toKeySet=pe.prototype.Lf,pe.prototype.toArray=pe.prototype.Fa,pe.prototype.clear=pe.prototype.clear,pe.prototype.delete=pe.prototype.delete,pe.prototype.remove=pe.prototype.remove,pe.prototype.get=pe.prototype.get,pe.prototype.getValue=pe.prototype.I,pe.prototype.has=pe.prototype.has,pe.prototype.contains=pe.prototype.contains,pe.prototype.first=pe.prototype.first,pe.prototype.addAll=pe.prototype.addAll,pe.prototype.set=pe.prototype.set,pe.prototype.add=pe.prototype.add,pe.prototype.thaw=pe.prototype.ka,pe.prototype.freeze=pe.prototype.freeze,pe.className="Map";function z(t,e){t===void 0?this.y=this.x=0:typeof t=="number"&&typeof e=="number"?(this.x=t,this.y=e):lt("Invalid arguments to Point constructor: "+t+", "+e),this._isFrozen=!1}var fn,vn,Qn,Kn,Ar;z.prototype.assign=function(t){return this.x=t.x,this.y=t.y,this},z.prototype.h=function(t,e){return this.x=t,this.y=e,this},z.prototype.sg=function(t,e){return this.x=t,this.y=e,this},z.prototype.set=function(t){return this.x=t.x,this.y=t.y,this},z.prototype.copy=function(){var t=new z;return t.x=this.x,t.y=this.y,t},T=z.prototype,T.ja=function(){return this._isFrozen=!0,Object.freeze(this),this},T.J=function(){return this._isFrozen||Object.isFrozen(this)?this:this.copy().freeze()},T.freeze=function(){return this._isFrozen=!0,this},T.ka=function(){return Object.isFrozen(this)&&lt("cannot thaw constant: "+this),this._isFrozen=!1,this};function tn(t){if(typeof t=="string"){t=t.split(" ");for(var e=0,i=0;t[e]==="";)e++;var n=t[e++];n&&(i=parseFloat(n));for(var s=0;t[e]==="";)e++;return(n=t[e++])&&(s=parseFloat(n)),new z(i,s)}return new z}function Hi(t){return t.x.toString()+" "+t.y.toString()}T.toString=function(){return"Point("+this.x+","+this.y+")"},T.D=function(t){return t instanceof z?this.x===t.x&&this.y===t.y:!1},T.hi=function(t,e){return this.x===t&&this.y===e},T.Xa=function(t){return ht.B(this.x,t.x)&&ht.B(this.y,t.y)},T.add=function(t){return this.x+=t.x,this.y+=t.y,this},T.re=function(t){return this.x-=t.x,this.y-=t.y,this},T.offset=function(t,e){return this.x+=t,this.y+=e,this},z.prototype.rotate=function(t){if(t===0)return this;var e=this.x,i=this.y;if(e===0&&i===0)return this;if(360<=t?t-=360:0>t&&(t+=360),t===90){t=0;var n=1}else t===180?(t=-1,n=0):t===270?(t=0,n=-1):(n=t*Math.PI/180,t=Math.cos(n),n=Math.sin(n));return this.x=t*e-n*i,this.y=n*e+t*i,this},T=z.prototype,T.scale=function(t,e){return this.x*=t,this.y*=e,this},T.Bf=function(t){var e=t.x-this.x;return t=t.y-this.y,e*e+t*t},T.zd=function(t,e){return t-=this.x,e-=this.y,t*t+e*e},T.normalize=function(){var t=this.x,e=this.y,i=Math.sqrt(t*t+e*e);return 0<i&&(this.x=t/i,this.y=e/i),this},T.ab=function(t){return Sn(t.x-this.x,t.y-this.y)},T.direction=function(t,e){return Sn(t-this.x,e-this.y)};function Sn(t,e){if(t===0)return 0<e?90:0>e?270:0;if(e===0)return 0<t?0:180;if(isNaN(t)||isNaN(e))return 0;var i=180*Math.atan(Math.abs(e/t))/Math.PI;return 0>t?i=0>e?i+180:180-i:0>e&&(i=360-i),i}T.Ry=function(t,e){return ht.Fl(t.x,t.y,e.x,e.y,this.x,this.y)},T.fA=function(t,e,i,n){return ht.qh(t,e,i,n,this.x,this.y,this),this},T.gA=function(t,e){return ht.qh(t.x,t.y,e.x,e.y,this.x,this.y,this),this},T.uA=function(t,e,i,n){return ht.No(this.x,this.y,t,e,i,n,this),this},T.vA=function(t,e){return ht.No(this.x,this.y,t.x,t.y,e.width,e.height,this),this},T.xi=function(t,e){return this.x=t.x+e.x*t.width+e.offsetX,this.y=t.y+e.y*t.height+e.offsetY,this},T.yi=function(t,e,i,n,s){return this.x=t+s.x*i+s.offsetX,this.y=e+s.y*n+s.offsetY,this},T.transform=function(t){return t.Ga(this),this};function Ji(t,e){return e.Cd(t),t}function Fn(t,e,i,n,s,a){var l=s-i,c=a-n,f=l*l+c*c;i-=t,n-=e;var m=-i*l-n*c;return 0>=m||m>=f?(l=s-t,c=a-e,Math.min(i*i+n*n,l*l+c*c)):(t=l*n-c*i,t*t/f)}function Xr(t,e,i,n){return t=i-t,e=n-e,t*t+e*e}function no(t,e,i,n){return t=i-t,e=n-e,t===0?0<e?90:0>e?270:0:e===0?0<t?0:180:isNaN(t)||isNaN(e)?0:(n=180*Math.atan(Math.abs(e/t))/Math.PI,0>t?n=0>e?n+180:180-n:0>e&&(n=360-n),n)}T.w=function(){return isFinite(this.x)&&isFinite(this.y)},z.alloc=function(){var t=Jn.pop();return t===void 0?new z:t},z.allocAt=function(t,e){var i=Jn.pop();return i===void 0?new z(t,e):(i.x=t,i.y=e,i)},z.free=function(t){Jn.push(t)},z.prototype.isReal=z.prototype.w,z.prototype.setSpot=z.prototype.yi,z.prototype.setRectSpot=z.prototype.xi,z.prototype.snapToGridPoint=z.prototype.vA,z.prototype.snapToGrid=z.prototype.uA,z.prototype.projectOntoLineSegmentPoint=z.prototype.gA,z.prototype.projectOntoLineSegment=z.prototype.fA,z.intersectingLineSegments=function(t,e,i,n,s,a,l,c){return ht.Rl(t,e,i,n,s,a,l,c)},z.prototype.compareWithLineSegmentPoint=z.prototype.Ry,z.compareWithLineSegment=function(t,e,i,n,s,a){return ht.Fl(t,e,i,n,s,a)},z.prototype.direction=z.prototype.direction,z.prototype.directionPoint=z.prototype.ab,z.prototype.normalize=z.prototype.normalize,z.prototype.distanceSquared=z.prototype.zd,z.prototype.distanceSquaredPoint=z.prototype.Bf,z.prototype.scale=z.prototype.scale,z.prototype.rotate=z.prototype.rotate,z.prototype.offset=z.prototype.offset,z.prototype.subtract=z.prototype.re,z.prototype.add=z.prototype.add,z.prototype.equalsApprox=z.prototype.Xa,z.prototype.equalTo=z.prototype.hi,z.prototype.equals=z.prototype.D,z.prototype.set=z.prototype.set,z.prototype.setTo=z.prototype.sg;var Jn=[];z.className="Point",z.parse=tn,z.stringify=Hi,z.distanceLineSegmentSquared=Fn,z.distanceSquared=Xr,z.direction=no,z.Origin=fn=new z(0,0).ja(),z.InfiniteTopLeft=vn=new z(-1/0,-1/0).ja(),z.InfiniteBottomRight=Qn=new z(1/0,1/0).ja(),z.SixPoint=Kn=new z(6,6).ja(),z.NoPoint=Ar=new z(NaN,NaN).ja(),z.parse=tn,z.stringify=Hi,z.distanceLineSegmentSquared=Fn,z.distanceSquared=Xr,z.direction=no;function ii(t,e){t===void 0?this.height=this.width=0:typeof t=="number"&&(0<=t||isNaN(t))&&typeof e=="number"&&(0<=e||isNaN(e))?(this.width=t,this.height=e):lt("Invalid arguments to Size constructor: "+t+", "+e),this._isFrozen=!1}var xr,wr,ko,br,po,ds,Ps;ii.prototype.assign=function(t){return this.width=t.width,this.height=t.height,this},ii.prototype.h=function(t,e){return this.width=t,this.height=e,this},ii.prototype.sg=function(t,e){return this.width=t,this.height=e,this},ii.prototype.set=function(t){return this.width=t.width,this.height=t.height,this},ii.prototype.copy=function(){var t=new ii;return t.width=this.width,t.height=this.height,t},T=ii.prototype,T.ja=function(){return this._isFrozen=!0,Object.freeze(this),this},T.J=function(){return this._isFrozen||Object.isFrozen(this)?this:this.copy().freeze()},T.freeze=function(){return this._isFrozen=!0,this},T.ka=function(){return Object.isFrozen(this)&&lt("cannot thaw constant: "+this),this._isFrozen=!1,this};function xs(t){if(typeof t=="string"){t=t.split(" ");for(var e=0,i=0;t[e]==="";)e++;var n=t[e++];n&&(i=parseFloat(n));for(var s=0;t[e]==="";)e++;return(n=t[e++])&&(s=parseFloat(n)),new ii(i,s)}return new ii}function Ns(t){return t.width.toString()+" "+t.height.toString()}T.toString=function(){return"Size("+this.width+","+this.height+")"},T.D=function(t){return t instanceof ii?this.width===t.width&&this.height===t.height:!1},T.hi=function(t,e){return this.width===t&&this.height===e},T.Xa=function(t){return ht.B(this.width,t.width)&&ht.B(this.height,t.height)},T.Bc=function(t,e){return t=this.width+t,this.width=0<=t?t:0,e=this.height+e,this.height=0<=e?e:0,this},T.w=function(){return isFinite(this.width)&&isFinite(this.height)},ii.alloc=function(){var t=ws.pop();return t===void 0?new ii:t},ii.free=function(t){ws.push(t)},ii.prototype.isReal=ii.prototype.w,ii.prototype.inflate=ii.prototype.Bc,ii.prototype.equalsApprox=ii.prototype.Xa,ii.prototype.equalTo=ii.prototype.hi,ii.prototype.equals=ii.prototype.D,ii.prototype.set=ii.prototype.set,ii.prototype.setTo=ii.prototype.sg;var ws=[];ii.className="Size",ii.parse=xs,ii.stringify=Ns,ii.ZeroSize=xr=new ii(0,0).ja(),ii.OneSize=wr=new ii(1,1).ja(),ii.SixSize=ko=new ii(6,6).ja(),ii.EightSize=br=new ii(8,8).ja(),ii.TenSize=po=new ii(10,10).ja(),ii.InfiniteSize=ds=new ii(1/0,1/0).ja(),ii.NoSize=Ps=new ii(NaN,NaN).ja(),ii.parse=xs,ii.stringify=Ns;function It(t,e,i,n){t===void 0?this.height=this.width=this.y=this.x=0:typeof t=="number"&&typeof e=="number"&&typeof i=="number"&&(0<=i||isNaN(i))&&typeof n=="number"&&(0<=n||isNaN(n))?(this.x=t,this.y=e,this.width=i,this.height=n):t instanceof z?(i=t.x,t=t.y,e instanceof z?(n=e.x,e=e.y,this.x=Math.min(i,n),this.y=Math.min(t,e),this.width=Math.abs(i-n),this.height=Math.abs(t-e)):e instanceof ii?(this.x=i,this.y=t,this.width=e.width,this.height=e.height):lt("Incorrect second argument supplied to Rect constructor "+e)):lt("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+n),this._isFrozen=!1}T=It.prototype,T.assign=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},T.h=function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this};function Lo(t,e,i){t.width=e,t.height=i}T.sg=function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},T.set=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},T.dd=function(t){return this.x=t.x,this.y=t.y,this},T.tA=function(t){return this.width=t.width,this.height=t.height,this},It.prototype.copy=function(){var t=new It;return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},T=It.prototype,T.ja=function(){return this._isFrozen=!0,Object.freeze(this),this},T.J=function(){return this._isFrozen||Object.isFrozen(this)?this:this.copy().freeze()},T.freeze=function(){return this._isFrozen=!0,this},T.ka=function(){return Object.isFrozen(this)&&lt("cannot thaw constant: "+this),this._isFrozen=!1,this};function Va(t){if(typeof t=="string"){t=t.split(" ");for(var e=0,i=0;t[e]==="";)e++;var n=t[e++];n&&(i=parseFloat(n));for(var s=0;t[e]==="";)e++;(n=t[e++])&&(s=parseFloat(n));for(var a=0;t[e]==="";)e++;(n=t[e++])&&(a=parseFloat(n));for(var l=0;t[e]==="";)e++;return(n=t[e++])&&(l=parseFloat(n)),new It(i,s,a,l)}return new It}function Ia(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}T.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"},T.D=function(t){return t instanceof It?this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height:!1},T.hi=function(t,e,i,n){return this.x===t&&this.y===e&&this.width===i&&this.height===n},T.Xa=function(t){return ht.B(this.x,t.x)&&ht.B(this.y,t.y)&&ht.B(this.width,t.width)&&ht.B(this.height,t.height)};function Xs(t,e){return ht.$(t.x,e.x)&&ht.$(t.y,e.y)&&ht.$(t.width,e.width)&&ht.$(t.height,e.height)}T.ca=function(t){return this.x<=t.x&&this.x+this.width>=t.x&&this.y<=t.y&&this.y+this.height>=t.y},T.Re=function(t){return this.x<=t.x&&t.x+t.width<=this.x+this.width&&this.y<=t.y&&t.y+t.height<=this.y+this.height},T.contains=function(t,e,i,n){return i===void 0&&(i=0),n===void 0&&(n=0),this.x<=t&&t+i<=this.x+this.width&&this.y<=e&&e+n<=this.y+this.height},T.offset=function(t,e){return this.x+=t,this.y+=e,this},T.Bc=function(t,e){return Ao(this,e,t,e,t)},T.Co=function(t){return Ao(this,t.top,t.right,t.bottom,t.left)},T.Fv=function(t){return Ao(this,-t.top,-t.right,-t.bottom,-t.left)},T.Hz=function(t,e,i,n){return Ao(this,t,e,i,n)};function Ao(t,e,i,n,s){var a=t.width;return i+s<=-a?(t.x+=a/2,t.width=0):(t.x-=s,t.width+=i+s),i=t.height,e+n<=-i?(t.y+=i/2,t.height=0):(t.y-=e,t.height+=e+n),t}T.Ex=function(t){return al(this,t.x,t.y,t.width,t.height)},T.Uu=function(t,e,i,n){return al(this,t,e,i,n)};function al(t,e,i,n,s){var a=Math.max(t.x,e),l=Math.max(t.y,i);return e=Math.min(t.x+t.width,e+n),i=Math.min(t.y+t.height,i+s),t.x=a,t.y=l,t.width=Math.max(0,e-a),t.height=Math.max(0,i-l),t}T.Yc=function(t){return this.Vu(t.x,t.y,t.width,t.height)},T.Vu=function(t,e,i,n){var s=this.width,a=this.x;return s!==1/0&&i!==1/0&&(s+=a,i+=t,isNaN(i)||isNaN(s)||a>i||t>s)?!1:(t=this.height,i=this.y,!(t!==1/0&&n!==1/0&&(t+=i,n+=e,isNaN(n)||isNaN(t)||i>n||e>t)))};function oa(t,e){var i=t.width,n=t.x,s=e.x-10;return n>e.width+10+10+s||s>i+n?!1:(i=t.height,t=t.y,n=e.y-10,!(t>e.height+10+10+n||n>i+t))}T.Ye=function(t){return vr(this,t.x,t.y,0,0)},T.ed=function(t){return vr(this,t.x,t.y,t.width,t.height)},T.Kv=function(t,e,i,n){return i===void 0&&(i=0),n===void 0&&(n=0),vr(this,t,e,i,n)};function vr(t,e,i,n,s){var a=Math.min(t.x,e),l=Math.min(t.y,i);return e=Math.max(t.x+t.width,e+n),i=Math.max(t.y+t.height,i+s),t.x=a,t.y=l,t.width=e-a,t.height=i-l,t}T.yi=function(t,e,i){return this.x=t-i.offsetX-i.x*this.width,this.y=e-i.offsetY-i.y*this.height,this};function jr(t,e,i,n,s,a,l,c){return l===void 0&&(l=0),c===void 0&&(c=0),t<=s&&s+l<=t+i&&e<=a&&a+c<=e+n}function ya(t,e,i,n,s,a,l,c){return t>l+s||s>i+t?!1:!(e>c+a||a>n+e)}T.w=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},T.Mz=function(){return this.width===0&&this.height===0},It.alloc=function(){var t=Pn.pop();return t===void 0?new It:t},It.allocAt=function(t,e,i,n){var s=Pn.pop();return s===void 0?new It(t,e,i,n):s.h(t,e,i,n)},It.free=function(t){Pn.push(t)},ct.Object.defineProperties(It.prototype,{left:{get:function(){return this.x},set:function(t){this.x=t}},top:{get:function(){return this.y},set:function(t){this.y=t}},right:{get:function(){return this.x+this.width},set:function(t){this.x+=t-(this.x+this.width)}},bottom:{get:function(){return this.y+this.height},set:function(t){this.y+=t-(this.y+this.height)}},position:{get:function(){return new z(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},size:{get:function(){return new ii(this.width,this.height)},set:function(t){this.width=t.width,this.height=t.height}},center:{get:function(){return new z(this.x+this.width/2,this.y+this.height/2)},set:function(t){this.x=t.x-this.width/2,this.y=t.y-this.height/2}},centerX:{get:function(){return this.x+this.width/2},set:function(t){this.x=t-this.width/2}},centerY:{get:function(){return this.y+this.height/2},set:function(t){this.y=t-this.height/2}}}),It.prototype.isEmpty=It.prototype.Mz,It.prototype.isReal=It.prototype.w,It.intersectsLineSegment=function(t,e,i,n,s,a,l,c){return ht.Fx(t,e,i,n,s,a,l,c)},It.prototype.setSpot=It.prototype.yi,It.prototype.union=It.prototype.Kv,It.prototype.unionRect=It.prototype.ed,It.prototype.unionPoint=It.prototype.Ye,It.prototype.intersects=It.prototype.Vu,It.prototype.intersectsRect=It.prototype.Yc,It.prototype.intersect=It.prototype.Uu,It.prototype.intersectRect=It.prototype.Ex,It.prototype.grow=It.prototype.Hz,It.prototype.subtractMargin=It.prototype.Fv,It.prototype.addMargin=It.prototype.Co,It.prototype.inflate=It.prototype.Bc,It.prototype.offset=It.prototype.offset,It.prototype.contains=It.prototype.contains,It.prototype.containsRect=It.prototype.Re,It.prototype.containsPoint=It.prototype.ca,It.prototype.equalsApprox=It.prototype.Xa,It.prototype.equalTo=It.prototype.hi,It.prototype.equals=It.prototype.D,It.prototype.setSize=It.prototype.tA,It.prototype.setPoint=It.prototype.dd,It.prototype.set=It.prototype.set,It.prototype.setTo=It.prototype.sg;var yn=null,Xn=null,Pn=[];It.className="Rect",It.parse=Va,It.stringify=Ia,It.contains=jr,It.intersects=ya,It.ZeroRect=yn=new It(0,0,0,0).ja(),It.NoRect=Xn=new It(NaN,NaN,NaN,NaN).ja(),It.parse=Va,It.stringify=Ia,It.contains=jr,It.intersects=ya;function ai(t,e,i,n){t===void 0?this.left=this.bottom=this.right=this.top=0:e===void 0?this.left=this.bottom=this.right=this.top=t:i===void 0?(this.top=t,this.right=e,this.bottom=t,this.left=e):n!==void 0?(this.top=t,this.right=e,this.bottom=i,this.left=n):lt("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+n),this._isFrozen=!1}ai.prototype.assign=function(t){return this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left,this},ai.prototype.sg=function(t,e,i,n){return this.top=t,this.right=e,this.bottom=i,this.left=n,this},ai.prototype.set=function(t){return this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left,this},ai.prototype.copy=function(){var t=new ai;return t.top=this.top,t.right=this.right,t.bottom=this.bottom,t.left=this.left,t},T=ai.prototype,T.ja=function(){return this._isFrozen=!0,Object.freeze(this),this},T.J=function(){return this._isFrozen||Object.isFrozen(this)?this:this.copy().freeze()},T.freeze=function(){return this._isFrozen=!0,this},T.ka=function(){return Object.isFrozen(this)&&lt("cannot thaw constant: "+this),this._isFrozen=!1,this};function cr(t){if(typeof t=="string"){t=t.split(" ");for(var e=0,i=NaN;t[e]==="";)e++;var n=t[e++];if(n&&(i=parseFloat(n)),isNaN(i))return new ai;for(var s=NaN;t[e]==="";)e++;if((n=t[e++])&&(s=parseFloat(n)),isNaN(s))return new ai(i);for(var a=NaN;t[e]==="";)e++;if((n=t[e++])&&(a=parseFloat(n)),isNaN(a))return new ai(i,s);for(var l=NaN;t[e]==="";)e++;return(n=t[e++])&&(l=parseFloat(n)),isNaN(l)?new ai(i,s):new ai(i,s,a,l)}return new ai}function _r(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}T.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"},T.D=function(t){return t instanceof ai?this.top===t.top&&this.right===t.right&&this.bottom===t.bottom&&this.left===t.left:!1},T.hi=function(t,e,i,n){return this.top===t&&this.right===e&&this.bottom===i&&this.left===n},T.Xa=function(t){return ht.B(this.top,t.top)&&ht.B(this.right,t.right)&&ht.B(this.bottom,t.bottom)&&ht.B(this.left,t.left)},T.w=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)},ai.alloc=function(){var t=Do.pop();return t===void 0?new ai:t},ai.free=function(t){Do.push(t)},ai.prototype.isReal=ai.prototype.w,ai.prototype.equalsApprox=ai.prototype.Xa,ai.prototype.equalTo=ai.prototype.hi,ai.prototype.equals=ai.prototype.D,ai.prototype.set=ai.prototype.set,ai.prototype.setTo=ai.prototype.sg;var ro=null,Eo=null,Do=[];ai.className="Margin",ai.parse=cr,ai.stringify=_r,ai.ZeroMargin=ro=new ai(0,0,0,0).ja(),ai.TwoMargin=Eo=new ai(2,2,2,2).ja(),ai.parse=cr,ai.stringify=_r;function Ze(t,e,i,n){t===void 0?this.offsetY=this.offsetX=this.y=this.x=0:(e===void 0&&(e=0),i===void 0&&(i=0),n===void 0&&(n=0),this.x=t,this.y=e,this.offsetX=i,this.offsetY=n),this._isFrozen=!1}var Nn,An,Rr,Io,Oo,on,Il,Ys,Rs,Go,Ol,sa,fs,jo,ll,Ml,Cl,yu,Bl,aa,zs,Wr,kl,xu,Ll,zn,dr,ho,Ms,_o,oo,co,so,ao,Oa,Ba;Ze.prototype.assign=function(t){return this.x=t.x,this.y=t.y,this.offsetX=t.offsetX,this.offsetY=t.offsetY,this},Ze.prototype.sg=function(t,e,i,n){return this.x=t,this.y=e,this.offsetX=i,this.offsetY=n,this},Ze.prototype.set=function(t){return this.x=t.x,this.y=t.y,this.offsetX=t.offsetX,this.offsetY=t.offsetY,this},Ze.prototype.copy=function(){var t=new Ze;return t.x=this.x,t.y=this.y,t.offsetX=this.offsetX,t.offsetY=this.offsetY,t},T=Ze.prototype,T.ja=function(){return this._isFrozen=!0,Object.freeze(this),this},T.J=function(){return this._isFrozen||Object.isFrozen(this)?this:this.copy().freeze()},T.freeze=function(){return this._isFrozen=!0,this},T.ka=function(){return Object.isFrozen(this)&&lt("cannot thaw constant: "+this),this._isFrozen=!1,this};function Ur(t,e){return t.x=NaN,t.y=NaN,t.offsetX=e,t}function tc(t){if(typeof t=="string"){if(t=t.trim(),t==="None")return Nn;if(t==="TopLeft")return An;if(t==="Top"||t==="TopCenter"||t==="MiddleTop")return Rr;if(t==="TopRight")return Io;if(t==="Left"||t==="LeftCenter"||t==="MiddleLeft")return Oo;if(t==="Center")return on;if(t==="Right"||t==="RightCenter"||t==="MiddleRight")return Il;if(t==="BottomLeft")return Ys;if(t==="Bottom"||t==="BottomCenter"||t==="MiddleBottom")return Rs;if(t==="BottomRight")return Go;if(t==="TopSide")return Ol;if(t==="LeftSide")return sa;if(t==="RightSide")return fs;if(t==="BottomSide")return jo;if(t==="TopBottomSides")return ll;if(t==="LeftRightSides")return Ml;if(t==="TopLeftSides")return Cl;if(t==="TopRightSides")return yu;if(t==="BottomLeftSides")return Bl;if(t==="BottomRightSides")return aa;if(t==="NotTopSide")return zs;if(t==="NotLeftSide")return Wr;if(t==="NotRightSide")return kl;if(t==="NotBottomSide")return xu;if(t==="AllSides")return Ll;if(t==="Default")return zn;t=t.split(" ");for(var e=0,i=0;t[e]==="";)e++;var n=t[e++];n!==void 0&&0<n.length&&(i=parseFloat(n));for(var s=0;t[e]==="";)e++;n=t[e++],n!==void 0&&0<n.length&&(s=parseFloat(n));for(var a=0;t[e]==="";)e++;n=t[e++],n!==void 0&&0<n.length&&(a=parseFloat(n));for(var l=0;t[e]==="";)e++;return n=t[e++],n!==void 0&&0<n.length&&(l=parseFloat(n)),new Ze(i,s,a,l)}return new Ze}function wu(t){return t.sb()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}T.toString=function(){return this.sb()?this.offsetX===0&&this.offsetY===0?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.D(Nn)?"None":this.D(An)?"TopLeft":this.D(Rr)?"Top":this.D(Io)?"TopRight":this.D(Oo)?"Left":this.D(on)?"Center":this.D(Il)?"Right":this.D(Ys)?"BottomLeft":this.D(Rs)?"Bottom":this.D(Go)?"BottomRight":this.D(Ol)?"TopSide":this.D(sa)?"LeftSide":this.D(fs)?"RightSide":this.D(jo)?"BottomSide":this.D(ll)?"TopBottomSides":this.D(Ml)?"LeftRightSides":this.D(Cl)?"TopLeftSides":this.D(yu)?"TopRightSides":this.D(Bl)?"BottomLeftSides":this.D(aa)?"BottomRightSides":this.D(zs)?"NotTopSide":this.D(Wr)?"NotLeftSide":this.D(kl)?"NotRightSide":this.D(xu)?"NotBottomSide":this.D(Ll)?"AllSides":this.D(zn)?"Default":"None"},T.D=function(t){return t instanceof Ze?(this.x===t.x||isNaN(this.x)&&isNaN(t.x))&&(this.y===t.y||isNaN(this.y)&&isNaN(t.y))&&this.offsetX===t.offsetX&&this.offsetY===t.offsetY:!1},T.gv=function(){return new Ze(.5-(this.x-.5),.5-(this.y-.5),-this.offsetX,-this.offsetY)},T.Hf=function(t){if(!this.$c())return!1;if(!t.$c())if(t.D(dr))t=sa;else if(t.D(ho))t=fs;else if(t.D(Ms))t=Ol;else if(t.D(_o))t=jo;else return!1;return t=t.offsetY,(this.offsetY&t)===t},T.sb=function(){return!isNaN(this.x)&&!isNaN(this.y)},T.Mc=function(){return isNaN(this.x)||isNaN(this.y)},T.$c=function(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===1&&this.offsetY!==0},T.ys=function(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===0&&this.offsetY===0},T.Xb=function(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===-1&&this.offsetY===0},Ze.alloc=function(){var t=ec.pop();return t===void 0?new Ze:t},Ze.free=function(t){ec.push(t)},Ze.prototype.isDefault=Ze.prototype.Xb,Ze.prototype.isNone=Ze.prototype.ys,Ze.prototype.isSide=Ze.prototype.$c,Ze.prototype.isNoSpot=Ze.prototype.Mc,Ze.prototype.isSpot=Ze.prototype.sb,Ze.prototype.includesSide=Ze.prototype.Hf,Ze.prototype.opposite=Ze.prototype.gv,Ze.prototype.equals=Ze.prototype.D,Ze.prototype.set=Ze.prototype.set,Ze.prototype.setTo=Ze.prototype.sg;var ec=[];Ze.className="Spot",Ze.parse=tc,Ze.stringify=wu,Ze.None=Nn=Ur(new Ze(0,0,0,0),0).ja(),Ze.Default=zn=Ur(new Ze(0,0,-1,0),-1).ja(),Ze.TopLeft=An=new Ze(0,0,0,0).ja(),Ze.TopCenter=Rr=new Ze(.5,0,0,0).ja(),Ze.TopRight=Io=new Ze(1,0,0,0).ja(),Ze.LeftCenter=Oo=new Ze(0,.5,0,0).ja(),Ze.Center=on=new Ze(.5,.5,0,0).ja(),Ze.RightCenter=Il=new Ze(1,.5,0,0).ja(),Ze.BottomLeft=Ys=new Ze(0,1,0,0).ja(),Ze.BottomCenter=Rs=new Ze(.5,1,0,0).ja(),Ze.BottomRight=Go=new Ze(1,1,0,0).ja(),Ze.MiddleTop=oo=Rr,Ze.MiddleLeft=co=Oo,Ze.MiddleRight=so=Il,Ze.MiddleBottom=ao=Rs,Ze.Top=Ms=Rr,Ze.Left=dr=Oo,Ze.Right=ho=Il,Ze.Bottom=_o=Rs,Ze.TopSide=Ol=Ur(new Ze(0,0,1,1),1).ja(),Ze.LeftSide=sa=Ur(new Ze(0,0,1,2),1).ja(),Ze.RightSide=fs=Ur(new Ze(0,0,1,4),1).ja(),Ze.BottomSide=jo=Ur(new Ze(0,0,1,8),1).ja(),Ze.TopBottomSides=ll=Ur(new Ze(0,0,1,9),1).ja(),Ze.LeftRightSides=Ml=Ur(new Ze(0,0,1,6),1).ja(),Ze.TopLeftSides=Cl=Ur(new Ze(0,0,1,3),1).ja(),Ze.TopRightSides=yu=Ur(new Ze(0,0,1,5),1).ja(),Ze.BottomLeftSides=Bl=Ur(new Ze(0,0,1,10),1).ja(),Ze.BottomRightSides=aa=Ur(new Ze(0,0,1,12),1).ja(),Ze.NotTopSide=zs=Ur(new Ze(0,0,1,14),1).ja(),Ze.NotLeftSide=Wr=Ur(new Ze(0,0,1,13),1).ja(),Ze.NotRightSide=kl=Ur(new Ze(0,0,1,11),1).ja(),Ze.NotBottomSide=xu=Ur(new Ze(0,0,1,7),1).ja(),Ze.AllSides=Ll=Ur(new Ze(0,0,1,15),1).ja(),Oa=new Ze(.156,.156).ja(),Ba=new Ze(.844,.844).ja(),Ze.parse=tc,Ze.stringify=wu;function nn(){this.m11=1,this.m21=this.m12=0,this.m22=1,this.dy=this.dx=0}nn.prototype.set=function(t){return this.m11=t.m11,this.m12=t.m12,this.m21=t.m21,this.m22=t.m22,this.dx=t.dx,this.dy=t.dy,this},nn.prototype.setTransform=function(t,e,i,n,s,a){return this.m11=t,this.m12=e,this.m21=i,this.m22=n,this.dx=s,this.dy=a,this},nn.prototype.copy=function(){var t=new nn;return t.m11=this.m11,t.m12=this.m12,t.m21=this.m21,t.m22=this.m22,t.dx=this.dx,t.dy=this.dy,t},nn.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"},nn.prototype.D=function(t){return this.m11===t.m11&&this.m12===t.m12&&this.m21===t.m21&&this.m22===t.m22&&this.dx===t.dx&&this.dy===t.dy},nn.prototype.ws=function(){return this.dx===0&&this.dy===0&&this.m11===1&&this.m12===0&&this.m21===0&&this.m22===1},nn.prototype.reset=function(){return this.m11=1,this.m21=this.m12=0,this.m22=1,this.dy=this.dx=0,this},nn.prototype.multiply=function(t){var e=this.m11*t.m11+this.m21*t.m12,i=this.m12*t.m11+this.m22*t.m12,n=this.m11*t.m21+this.m21*t.m22,s=this.m12*t.m21+this.m22*t.m22;return this.dx=this.m11*t.dx+this.m21*t.dy+this.dx,this.dy=this.m12*t.dx+this.m22*t.dy+this.dy,this.m11=e,this.m12=i,this.m21=n,this.m22=s,this},nn.prototype.bv=function(t){var e=1/(t.m11*t.m22-t.m12*t.m21),i=t.m22*e,n=-t.m12*e,s=-t.m21*e,a=t.m11*e,l=e*(t.m21*t.dy-t.m22*t.dx);return t=e*(t.m12*t.dx-t.m11*t.dy),e=this.m11*i+this.m21*n,i=this.m12*i+this.m22*n,n=this.m11*s+this.m21*a,s=this.m12*s+this.m22*a,this.dx=this.m11*l+this.m21*t+this.dx,this.dy=this.m12*l+this.m22*t+this.dy,this.m11=e,this.m12=i,this.m21=n,this.m22=s,this},nn.prototype.Vj=function(){var t=1/(this.m11*this.m22-this.m12*this.m21),e=-this.m12*t,i=-this.m21*t,n=this.m11*t,s=t*(this.m21*this.dy-this.m22*this.dx),a=t*(this.m12*this.dx-this.m11*this.dy);return this.m11=this.m22*t,this.m12=e,this.m21=i,this.m22=n,this.dx=s,this.dy=a,this},nn.prototype.rotate=function(t,e,i){if(360<=t?t-=360:0>t&&(t+=360),t===0)return this;if(this.translate(e,i),t===90){t=0;var n=1}else t===180?(t=-1,n=0):t===270?(t=0,n=-1):(n=t*Math.PI/180,t=Math.cos(n),n=Math.sin(n));var s=this.m12*t+this.m22*n,a=this.m11*-n+this.m21*t,l=this.m12*-n+this.m22*t;return this.m11=this.m11*t+this.m21*n,this.m12=s,this.m21=a,this.m22=l,this.translate(-e,-i),this},T=nn.prototype,T.translate=function(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this},T.scale=function(t,e){return e===void 0&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this},T.Ga=function(t){var e=t.x,i=t.y;return t.h(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)},T.Cd=function(t){var e=1/(this.m11*this.m22-this.m12*this.m21),i=t.x,n=t.y;return t.h(i*this.m22*e+n*-this.m21*e+e*(this.m21*this.dy-this.m22*this.dx),i*-this.m12*e+n*this.m11*e+e*(this.m12*this.dx-this.m11*this.dy))},T.Eu=function(t){var e=1/(this.m11*this.m22-this.m12*this.m21),i=1.25*t.x,n=1.2*t.y;return t.h(i*this.m22*e+n*-this.m21*e+e*(this.m21*this.dy-this.m22*this.dx),i*-this.m12*e+n*this.m11*e+e*(this.m12*this.dx-this.m11*this.dy))},T.pp=function(t){var e=t.x,i=t.y,n=e+t.width,s=i+t.height,a=this.m11,l=this.m12,c=this.m21,f=this.m22,m=this.dx,v=this.dy,w=e*a+i*c+m,C=e*l+i*f+v,k=n*a+i*c+m,L=n*l+i*f+v;return i=e*a+s*c+m,e=e*l+s*f+v,a=n*a+s*c+m,n=n*l+s*f+v,s=Math.min(w,k),w=Math.max(w,k),k=Math.min(C,L),C=Math.max(C,L),s=Math.min(s,i),w=Math.max(w,i),k=Math.min(k,e),C=Math.max(C,e),s=Math.min(s,a),w=Math.max(w,a),k=Math.min(k,n),C=Math.max(C,n),t.h(s,k,w-s,C-k),t},nn.alloc=function(){var t=kd.pop();return t===void 0?new nn:t},nn.free=function(t){kd.push(t)},nn.prototype.transformRect=nn.prototype.pp,nn.prototype.transformPoint=nn.prototype.Ga,nn.prototype.scale=nn.prototype.scale,nn.prototype.translate=nn.prototype.translate,nn.prototype.rotate=nn.prototype.rotate,nn.prototype.invert=nn.prototype.Vj,nn.prototype.multiplyInverted=nn.prototype.bv,nn.prototype.multiply=nn.prototype.multiply,nn.prototype.reset=nn.prototype.reset,nn.prototype.isIdentity=nn.prototype.ws,nn.prototype.equals=nn.prototype.D,nn.prototype.setTransform=nn.prototype.setTransform,nn.prototype.set=nn.prototype.set;var kd=[];nn.className="Transform",nn.xF="54a702f3e53909c447824c6706603faf4c";var ht={AA:"7da71ca0ad381e90",wg:(Math.sqrt(2)-1)/3*4,Uv:null,sqrt:function(t){if(0>=t)return 0;var e=ht.Uv;if(e===null){e=[];for(var i=0;2e3>=i;i++)e[i]=Math.sqrt(i);ht.Uv=e}return 1>t?(i=1/t,2e3>=i?1/e[i|0]:Math.sqrt(t)):2e3>=t?e[t|0]:Math.sqrt(t)},B:function(t,e){return t-=e,.5>t&&-.5<t},$:function(t,e){return t-=e,5e-8>t&&-5e-8<t},Yb:function(t,e,i,n,s,a,l){if(0>=s&&(s=1e-6),t<i)var c=t,f=i;else c=i,f=t;if(e<n)var m=e,v=n;else m=n,v=e;if(t===i)return m<=l&&l<=v&&t-s<=a&&a<=t+s;if(e===n)return c<=a&&a<=f&&e-s<=l&&l<=e+s;if(f+=s,c-=s,c<=a&&a<=f&&(v+=s,m-=s,m<=l&&l<=v))if(f-c>v-m)if(t-i>s||i-t>s){if(a=(n-e)/(i-t)*(a-t)+e,a-s<=l&&l<=a+s)return!0}else return!0;else if(e-n>s||n-e>s){if(l=(i-t)/(n-e)*(l-e)+t,l-s<=a&&a<=l+s)return!0}else return!0;return!1},cs:function(t,e,i,n,s,a,l,c,f,m,v,w){if(ht.Yb(t,e,l,c,w,i,n)&&ht.Yb(t,e,l,c,w,s,a))return ht.Yb(t,e,l,c,w,m,v);var C=(t+i)/2,k=(e+n)/2,L=(i+s)/2,A=(n+a)/2;s=(s+l)/2,a=(a+c)/2,n=(C+L)/2,i=(k+A)/2,L=(L+s)/2,A=(A+a)/2;var H=(n+L)/2,R=(i+A)/2;return ht.cs(t,e,C,k,n,i,H,R,f,m,v,w)||ht.cs(H,R,L,A,s,a,l,c,f,m,v,w)},ax:function(t,e,i,n,s,a,l,c,f){var m=(i+s)/2,v=(n+a)/2;return f.h((((t+i)/2+m)/2+(m+(s+l)/2)/2)/2,(((e+n)/2+v)/2+(v+(a+c)/2)/2)/2),f},My:function(t,e,i,n,s,a,l,c){var f=(i+s)/2,m=(n+a)/2;return no(((t+i)/2+f)/2,((e+n)/2+m)/2,(f+(s+l)/2)/2,(m+(a+c)/2)/2)},Dl:function(t,e,i,n,s,a,l,c,f,m){if(ht.Yb(t,e,l,c,f,i,n)&&ht.Yb(t,e,l,c,f,s,a))vr(m,t,e,0,0),vr(m,l,c,0,0);else{var v=(t+i)/2,w=(e+n)/2,C=(i+s)/2,k=(n+a)/2;s=(s+l)/2,a=(a+c)/2,n=(v+C)/2,i=(w+k)/2,C=(C+s)/2,k=(k+a)/2;var L=(n+C)/2,A=(i+k)/2;ht.Dl(t,e,v,w,n,i,L,A,f,m),ht.Dl(L,A,C,k,s,a,l,c,f,m)}return m},Qe:function(t,e,i,n,s,a,l,c,f,m){if(ht.Yb(t,e,l,c,f,i,n)&&ht.Yb(t,e,l,c,f,s,a))m.length===0&&(m.push(t),m.push(e)),m.push(l),m.push(c);else{var v=(t+i)/2,w=(e+n)/2,C=(i+s)/2,k=(n+a)/2;s=(s+l)/2,a=(a+c)/2,n=(v+C)/2,i=(w+k)/2,C=(C+s)/2,k=(k+a)/2;var L=(n+C)/2,A=(i+k)/2;ht.Qe(t,e,v,w,n,i,L,A,f,m),ht.Qe(L,A,C,k,s,a,l,c,f,m)}return m},jv:function(t,e,i,n,s,a,l,c,f,m){if(ht.Yb(t,e,s,a,m,i,n))return ht.Yb(t,e,s,a,m,c,f);var v=(t+i)/2,w=(e+n)/2;i=(i+s)/2,n=(n+a)/2;var C=(v+i)/2,k=(w+n)/2;return ht.jv(t,e,v,w,C,k,l,c,f,m)||ht.jv(C,k,i,n,s,a,l,c,f,m)},OA:function(t,e,i,n,s,a,l){return l.h(((t+i)/2+(i+s)/2)/2,((e+n)/2+(n+a)/2)/2),l},iv:function(t,e,i,n,s,a,l,c){if(ht.Yb(t,e,s,a,l,i,n))vr(c,t,e,0,0),vr(c,s,a,0,0);else{var f=(t+i)/2,m=(e+n)/2;i=(i+s)/2,n=(n+a)/2;var v=(f+i)/2,w=(m+n)/2;ht.iv(t,e,f,m,v,w,l,c),ht.iv(v,w,i,n,s,a,l,c)}return c},ep:function(t,e,i,n,s,a,l,c){if(ht.Yb(t,e,s,a,l,i,n))c.length===0&&(c.push(t),c.push(e)),c.push(s),c.push(a);else{var f=(t+i)/2,m=(e+n)/2;i=(i+s)/2,n=(n+a)/2;var v=(f+i)/2,w=(m+n)/2;ht.ep(t,e,f,m,v,w,l,c),ht.ep(v,w,i,n,s,a,l,c)}return c},Eo:function(t,e,i,n,s,a,l,c,f,m,v,w,C,k){if(ht.Yb(t,e,l,c,C,i,n)&&ht.Yb(t,e,l,c,C,s,a))return!ht.Rl(t,e,l,c,f,m,v,w)||(C=(t-l)*(m-w)-(e-c)*(f-v),C===0)?!1:(k.h(((t*c-e*l)*(f-v)-(t-l)*(f*w-m*v))/C,((t*c-e*l)*(m-w)-(e-c)*(f*w-m*v))/C),!0);var L=(t+i)/2,A=(e+n)/2,H=(i+s)/2,R=(n+a)/2;s=(s+l)/2,a=(a+c)/2,n=(L+H)/2,i=(A+R)/2,H=(H+s)/2,R=(R+a)/2;var X=(n+H)/2,Y=(i+R)/2,tt=1/0,st=!1,bt=0,Te=0;return ht.Eo(t,e,L,A,n,i,X,Y,f,m,v,w,C,k)&&(t=(k.x-f)*(k.x-f)+(k.y-m)*(k.y-m),t<tt&&(tt=t,st=!0,bt=k.x,Te=k.y)),ht.Eo(X,Y,H,R,s,a,l,c,f,m,v,w,C,k)&&(k.x-f)*(k.x-f)+(k.y-m)*(k.y-m)<tt&&(st=!0,bt=k.x,Te=k.y),st&&(k.x=bt,k.y=Te),st},Fo:function(t,e,i,n,s,a,l,c,f,m,v,w,C){var k=0;if(ht.Yb(t,e,l,c,C,i,n)&&ht.Yb(t,e,l,c,C,s,a)){if(C=(t-l)*(m-w)-(e-c)*(f-v),C===0)return k;var L=((t*c-e*l)*(f-v)-(t-l)*(f*w-m*v))/C,A=((t*c-e*l)*(m-w)-(e-c)*(f*w-m*v))/C;if(L>=v)return k;if((f>v?f-v:v-f)<(m>w?m-w:w-m)){if(e<c?(f=e,t=c):(f=c,t=e),A<f||A>t)return k}else if(t<l?(f=t,t=l):f=l,L<f||L>t)return k;0<C?k++:0>C&&k--}else{L=(t+i)/2,A=(e+n)/2;var H=(i+s)/2,R=(n+a)/2;s=(s+l)/2,a=(a+c)/2,n=(L+H)/2,i=(A+R)/2,H=(H+s)/2,R=(R+a)/2;var X=(n+H)/2,Y=(i+R)/2;k+=ht.Fo(t,e,L,A,n,i,X,Y,f,m,v,w,C),k+=ht.Fo(X,Y,H,R,s,a,l,c,f,m,v,w,C)}return k},qh:function(t,e,i,n,s,a,l){return ht.$(t,i)?(e<n?(i=e,e=n):i=n,a<i?(l.h(t,i),!1):a>e?(l.h(t,e),!1):(l.h(t,a),!0)):ht.$(e,n)?(t<i?(n=t,t=i):n=i,s<n?(l.h(n,e),!1):s>t?(l.h(t,e),!1):(l.h(s,e),!0)):(s=((t-s)*(t-i)+(e-a)*(e-n))/((i-t)*(i-t)+(n-e)*(n-e)),-5e-6>s?(l.h(t,e),!1):1.000005<s?(l.h(i,n),!1):(l.h(t+s*(i-t),e+s*(n-e)),!0))},Ve:function(t,e,i,n,s,a,l,c,f){return ht.B(t,i)&&ht.B(e,n)?(f.h(t,e),!1):ht.$(s,l)?ht.$(t,i)?(ht.qh(t,e,i,n,s,a,f),!1):ht.qh(t,e,i,n,s,(n-e)/(i-t)*(s-t)+e,f):(c=(c-a)/(l-s),ht.$(t,i)?(i=c*(t-s)+a,e<n?(s=e,e=n):s=n,i<s?(f.h(t,s),!1):i>e?(f.h(t,e),!1):(f.h(t,i),!0)):(l=(n-e)/(i-t),ht.$(c,l)?(ht.qh(t,e,i,n,s,a,f),!1):(s=(l*t-c*s+a-e)/(l-c),ht.$(l,0)?(t<i?(n=t,t=i):n=i,s<n?(f.h(n,e),!1):s>t?(f.h(t,e),!1):(f.h(s,e),!0)):ht.qh(t,e,i,n,s,l*(s-t)+e,f))))},MA:function(t,e,i,n,s){return ht.Ve(i.x,i.y,n.x,n.y,t.x,t.y,e.x,e.y,s)},KA:function(t,e,i,n,s,a,l,c,f,m){function v(H,R){var X=(H-t)*(H-t)+(R-e)*(R-e);X<w&&(w=X,f.h(H,R))}var w=1/0;v(f.x,f.y);var C=0,k=0,L=0,A=0;if(s<l?(C=s,k=l):(C=l,k=s),a<c?(L=s,A=l):(L=l,A=s),C=(k-C)/2+m,m=(A-L)/2+m,s=(s+l)/2,a=(a+c)/2,C===0||m===0)return f;if(.5>(i>t?i-t:t-i)){if(C=1-(i-s)*(i-s)/(C*C),0>C)return f;C=Math.sqrt(C),n=-m*C+a,v(i,m*C+a),v(i,n)}else{if(i=(n-e)/(i-t),n=1/(C*C)+i*i/(m*m),c=2*i*(e-i*t)/(m*m)-2*i*a/(m*m)-2*s/(C*C),C=c*c-4*n*(2*i*t*a/(m*m)-2*e*a/(m*m)+a*a/(m*m)+s*s/(C*C)-1+(e-i*t)*(e-i*t)/(m*m)),0>C)return f;C=Math.sqrt(C),m=(-c+C)/(2*n),v(m,i*m-i*t+e),C=(-c-C)/(2*n),v(C,i*C-i*t+e)}return f},Ff:function(t,e,i,n,s,a,l,c,f){var m=1e21,v=t,w=e;if(ht.Ve(t,e,t,n,s,a,l,c,f)){var C=(f.x-s)*(f.x-s)+(f.y-a)*(f.y-a);C<m&&(m=C,v=f.x,w=f.y)}return ht.Ve(i,e,i,n,s,a,l,c,f)&&(C=(f.x-s)*(f.x-s)+(f.y-a)*(f.y-a),C<m&&(m=C,v=f.x,w=f.y)),ht.Ve(t,e,i,e,s,a,l,c,f)&&(e=(f.x-s)*(f.x-s)+(f.y-a)*(f.y-a),e<m&&(m=e,v=f.x,w=f.y)),ht.Ve(t,n,i,n,s,a,l,c,f)&&(t=(f.x-s)*(f.x-s)+(f.y-a)*(f.y-a),t<m&&(m=t,v=f.x,w=f.y)),f.h(v,w),1e21>m},us:function(t,e,i){return ht.Fx(t.x,t.y,t.width,t.height,e.x,e.y,i.x,i.y)},Fx:function(t,e,i,n,s,a,l,c){var f=t+i,m=e+n;return s===l?(a<c?(l=a,a=c):l=c,t<=s&&s<=f&&l<=m&&a>=e):a===c?(s<l?(c=s,s=l):c=l,e<=a&&a<=m&&c<=f&&s>=t):!!(jr(t,e,i,n,s,a)||jr(t,e,i,n,l,c)||ht.Rl(t,e,f,e,s,a,l,c)||ht.Rl(f,e,f,m,s,a,l,c)||ht.Rl(f,m,t,m,s,a,l,c)||ht.Rl(t,m,t,e,s,a,l,c))},Rl:function(t,e,i,n,s,a,l,c){return t===i&&e===n&&s===l&&a===c?t===s&&e===a:0>=ht.Fl(t,e,i,n,s,a)*ht.Fl(t,e,i,n,l,c)&&0>=ht.Fl(s,a,l,c,t,e)*ht.Fl(s,a,l,c,i,n)},Fl:function(t,e,i,n,s,a){return i-=t,n-=e,t=s-t,e=a-e,a=t*n-e*i,a===0&&(a=t*i+e*n,0<a&&(a=(t-i)*i+(e-n)*n,0>a&&(a=0))),a},bp:function(t){return 0>t&&(t+=360),360<=t&&(t-=360),t},jx:function(t,e,i,n,s,a){var l=Math.PI;a||(n*=l/180,s*=l/180);var c=n>s?-1:1;a=[];var f=l/2,m=n;if(n=Math.min(2*l,Math.abs(s-n)),1e-5>n)return f=m+c*Math.min(n,f),c=t+i*Math.cos(m),m=e+i*Math.sin(m),t+=i*Math.cos(f),e+=i*Math.sin(f),i=(c+t)/2,f=(m+e)/2,a.push([c,m,i,f,i,f,t,e]),a;for(;1e-5<n;)s=m+c*Math.min(n,f),a.push(ht.Vy(i,m,s,t,e)),n-=Math.abs(s-m),m=s;return a},Vy:function(t,e,i,n,s){var a=(i-e)/2,l=t*Math.cos(a),c=t*Math.sin(a),f=-c,m=l*l+f*f,v=m+l*l+f*c;return m=4/3*(Math.sqrt(2*m*v)-v)/(l*c-f*l),c=l-m*f,l=f+m*l,f=-l,m=a+e,a=Math.cos(m),m=Math.sin(m),[n+t*Math.cos(e),s+t*Math.sin(e),n+c*a-l*m,s+c*m+l*a,n+c*a-f*m,s+c*m+f*a,n+t*Math.cos(i),s+t*Math.sin(i)]},No:function(t,e,i,n,s,a,l){i=Math.floor((t-i)/s)*s+i,n=Math.floor((e-n)/a)*a+n;var c=i;return i+s-t<s/2&&(c=i+s),t=n,n+a-e<a/2&&(t=n+a),l.h(c,t),l},vx:function(t,e){var i=Math.max(t,e);t=Math.min(t,e);var n;do e=i%t,i=n=t,t=e;while(0<e);return n},$y:function(t,e,i,n){var s=0>i,a=0>n;if(t<e)var l=1,c=0;else l=0,c=1;var f=l===0?t:e,m=l===0?i:n;return(l===0?s:a)&&(m=-m),l=c,i=l===0?i:n,(l===0?s:a)&&(i=-i),ht.az(f,l===0?t:e,m,i,0,0)},az:function(t,e,i,n,s,a){if(0<n)if(0<i){s=t*t,a=e*e,t*=i;var l=e*n,c=-a+l,f=-a+Math.sqrt(t*t+l*l);e=c;for(var m=0;9999999999>m&&(e=.5*(c+f),!(e===c||e===f));++m){var v=t/(e+s),w=l/(e+a);if(v=v*v+w*w-1,0<v)c=e;else if(0>v)f=e;else break}i=s*i/(e+s)-i,n=a*n/(e+a)-n,i=Math.sqrt(i*i+n*n)}else i=Math.abs(n-e);else n=t*t-e*e,a=t*i,a<n?(n=a/n,a=e*Math.sqrt(Math.abs(1-n*n)),i=t*n-i,i=Math.sqrt(i*i+a*a)):i=Math.abs(i-t);return i},Ze:new ci,um:new ci,Mf:new ci,Nf:0,vm:100};ht.za=ht.AA;function fe(t){vi(this),this.l=2,t===void 0&&(t=fe.o),this.na=t,this.Ec=this.Dc=this.pd=this.od=0,t===fe.o?this.ee=new Kt:(fe.V===null&&(fe.V=new Kt().freeze()),this.ee=fe.V),this.aq=this.ee.Ja,this.Ip=new It().freeze(),this.ym=this.tk=null,this.zm=NaN,this.fg=An,this.gg=Go,this.Rk=this.Sk=NaN,this.Uf=ie}fe.prototype.copy=function(){var t=new fe;if(t.l=this.l&-2,t.na=this.na,t.od=this.od,t.pd=this.pd,t.Dc=this.Dc,t.Ec=this.Ec,this.na===fe.o){for(var e=this.ee.s,i=t.ee,n=0;n<e.length;n++)i.add(e[n].copy());t.ee=i}else t.ee=this.ee;return t.aq=this.aq,t.Ip.assign(this.Ip),t.tk=this.tk,t.ym=this.ym,t.zm=this.zm,t.fg=this.fg.J(),t.gg=this.gg.J(),t.Sk=this.Sk,t.Rk=this.Rk,t.Uf=this.Uf,t},fe.prototype.ja=function(){return this.freeze(),Object.freeze(this),this},fe.prototype.freeze=function(){if(this._isFrozen=!0,this.type!==fe.o)return this;var t=this.figures;t.freeze(),t=t.s;for(var e=t.length,i=0;i<e;i++)t[i].freeze();return this},fe.prototype.ka=function(){if(Object.isFrozen(this)&&lt("cannot thaw constant: "+this),this._isFrozen=!1,this.type!==fe.o)return this;var t=this.figures;t.ka(),t=t.s;for(var e=t.length,i=0;i<e;i++)t[i].ka();return this},fe.prototype.Xa=function(t){if(!(t instanceof fe))return!1;if(this.type!==t.type)return this.type===fe.j&&t.type===fe.o?ju(this,t):t.type===fe.j&&this.type===fe.o?ju(t,this):!1;if(this.type===fe.o){var e=this.figures.s;t=t.figures.s;var i=e.length;if(i!==t.length)return!1;for(var n=0;n<i;n++)if(!e[n].Xa(t[n]))return!1;return!0}return ht.B(this.startX,t.startX)&&ht.B(this.startY,t.startY)&&ht.B(this.endX,t.endX)&&ht.B(this.endY,t.endY)};function ju(t,e){return t.type!==fe.j||e.type!==fe.o?!1:!!(e.figures.count===1&&(e=e.figures.M(0),e.segments.count===1&&ht.B(t.startX,e.startX)&&ht.B(t.startY,e.startY)&&(e=e.segments.M(0),e.type===er&&ht.B(t.endX,e.endX)&&ht.B(t.endY,e.endY))))}fe.ia=function(t){return t.toString()},fe.prototype.qb=function(t){t.classType===fe&&(this.type=t)},fe.prototype.toString=function(t){switch(t===void 0&&(t=-1),this.type){case fe.j:return 0>t?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+this.startX.toFixed(t)+" "+this.startY.toFixed(t)+"L"+this.endX.toFixed(t)+" "+this.endY.toFixed(t);case fe.u:var e=new It(this.startX,this.startY,0,0);return e.Kv(this.endX,this.endY,0,0),0>t?"M"+e.x.toString()+" "+e.y.toString()+"H"+e.right.toString()+"V"+e.bottom.toString()+"H"+e.left.toString()+"z":"M"+e.x.toFixed(t)+" "+e.y.toFixed(t)+"H"+e.right.toFixed(t)+"V"+e.bottom.toFixed(t)+"H"+e.left.toFixed(t)+"z";case fe.F:if(e=new It(this.startX,this.startY,0,0),e.Kv(this.endX,this.endY,0,0),0>t)return t=e.left.toString()+" "+(e.y+e.height/2).toString(),"M"+t+"A"+(e.width/2).toString()+" "+(e.height/2).toString()+" 0 0 1 "+(e.right.toString()+" "+(e.y+e.height/2).toString())+"A"+(e.width/2).toString()+" "+(e.height/2).toString()+" 0 0 1 "+t;var i=e.left.toFixed(t)+" "+(e.y+e.height/2).toFixed(t);return"M"+i+"A"+(e.width/2).toFixed(t)+" "+(e.height/2).toFixed(t)+" 0 0 1 "+(e.right.toFixed(t)+" "+(e.y+e.height/2).toFixed(t))+"A"+(e.width/2).toFixed(t)+" "+(e.height/2).toFixed(t)+" 0 0 1 "+i;case fe.o:e="",i=this.figures.s;for(var n=i.length,s=0;s<n;s++){var a=i[s];0<s&&(e+=" x "),a.isFilled&&(e+="F "),e+=a.toString(t)}return e;default:return this.type.toString()}},fe.nb=function(t){t=t.split(/[Xx]/);for(var e=t.length,i="",n=0;n<e;n++){var s=t[n];i=s.match(/[Ff]/)!==null?n===0?i+s:i+("X"+(s[0]===" "?"":" ")+s):i+((n===0?"":"X ")+"F"+(s[0]===" "?"":" ")+s)}return i},fe.parse=function(t,e){function i(){return A>=tt-1?!0:m[A+1].match(st)!==null}function n(){return A++,m[A]}function s(Wi){var Di=parseFloat(n()),In=parseFloat(n());H===H.toLowerCase()&&(Di=Y.x+Di,In=Y.y+In),Wi.h(Di,In)}function a(){return s(Y),Y}function l(){return s(X),X}function c(){var Wi=R.toLowerCase();return Wi!=="c"&&Wi!=="s"&&Wi!=="q"&&Wi!=="t"?Y:new z(2*Y.x-X.x,2*Y.y-X.y)}e===void 0&&(e=!1);var f=/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm;t=t.replace(/,/gm," "),t=t.replace(f,"$1 $2"),t=t.replace(f,"$1 $2"),t=t.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^s])/gm,"$1 $2"),t=t.replace(/([^s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2"),t=t.replace(/([0-9])([+\-])/gm,"$1 $2"),t=t.replace(/[\s\r\t\n]+/gm," "),t=t.replace(/^\s+|\s+$/g,"");var m=t.split(" ");for(t=0;t<m.length;t++){var v=m[t];if(v.match(/(\.[0-9]*)(\.)/gm)!==null){f=Pe();for(var w="",C=!1,k=0;k<v.length;k++){var L=v[k];L!=="."||C?L==="."?(f.push(w),w="."):w+=L:(C=!0,w+=L)}for(f.push(w),m.splice(t,1),v=0;v<f.length;v++)m.splice(t+v,0,f[v]);t+=f.length-1,qe(f)}}var A=-1,H="",R="";f=new z(0,0);var X=new z(0,0),Y=new z(0,0),tt=m.length;t=ny(null),C=w=v=!1,k=!0,L=null;for(var st=/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/;!(A>=tt-1);)if(R=H,H=n(),H!=="")switch(H.toUpperCase()){case"X":k=!0,w=v=!1;break;case"M":for(L=a(),t.mc===null||k===!0?(Qd(t,L.x,L.y,v,!w,C),k=!1):t.moveTo(L.x,L.y),f.assign(Y);!i();)L=a(),t.lineTo(L.x,L.y);break;case"L":for(;!i();)L=a(),t.lineTo(L.x,L.y);break;case"H":for(;!i();)Y=new z((H===H.toLowerCase()?Y.x:0)+parseFloat(n()),Y.y),t.lineTo(Y.x,Y.y);break;case"V":for(;!i();)Y=new z(Y.x,(H===H.toLowerCase()?Y.y:0)+parseFloat(n())),t.lineTo(Y.x,Y.y);break;case"C":for(;!i();){L=new z,s(L);var bt=l(),Te=a();Zl(t,L.x,L.y,bt.x,bt.y,Te.x,Te.y)}break;case"S":for(;!i();)L=c(),bt=l(),Te=a(),Zl(t,L.x,L.y,bt.x,bt.y,Te.x,Te.y);break;case"Q":for(;!i();)L=l(),bt=a(),sd(t,L.x,L.y,bt.x,bt.y);break;case"T":for(;!i();)X=L=c(),bt=a(),sd(t,L.x,L.y,bt.x,bt.y);break;case"B":for(;!i();){L=parseFloat(n()),bt=parseFloat(n()),Te=parseFloat(n());var Ke=parseFloat(n()),Oe=parseFloat(n()),he=Oe,Gt=!1;i()||(he=parseFloat(n()),i()||(Gt=parseFloat(n())!==0)),H===H.toLowerCase()&&(Te+=Y.x,Ke+=Y.y),t.arcTo(L,bt,Te,Ke,Oe,he,Gt)}break;case"A":for(;!i();)L=Math.abs(parseFloat(n())),bt=Math.abs(parseFloat(n())),Te=parseFloat(n()),Oe=Ke=!1,Gt=he=0,he=n(),he.length===1?(Ke=!!parseFloat(he),Oe=!!parseFloat(n()),he=parseFloat(n())):he.length===2?(Ke=!!parseFloat(he[0]),Oe=!!parseFloat(he[1]),he=parseFloat(n())):(Ke=!!parseFloat(he[0]),Oe=!!parseFloat(he[1]),he=parseFloat(he.slice(2))),Gt=parseFloat(n()),H===H.toLowerCase()&&(he=Y.x+he,Gt=Y.y+Gt),Y.h(he,Gt),tf(t,L,bt,Te,Ke,Oe,he,Gt);break;case"Z":fx(t),Y.assign(f);break;case"F":for(L="",bt=1;m[A+bt];)if(m[A+bt]==="0")C=!0,bt++;else if(m[A+bt].match(/[Uu]/)!==null)bt++;else if(m[A+bt].match(st)===null)bt++;else{L=m[A+bt];break}L.match(/[Mm]/)?v=!0:0<t.mc.segments.length&&(t.mc.isFilled=!0);break;case"U":for(L="",bt=1;m[A+bt];)if(m[A+bt].match(/[Ff]/)!==null)bt++;else if(m[A+bt].match(st)===null)bt++;else{L=m[A+bt];break}L.match(/[Mm]/)?w=!0:t.mc.isShadowed=!1}if(f=t.os,lp=t,e)for(e=f.figures.iterator;e.next();)e.value.isFilled=!0;return f},fe.Ha=function(t,e){for(var i=t.length,n=z.alloc(),s=0;s<i;s++){var a=t[s];n.x=a[0],n.y=a[1],e.Ga(n),a[0]=n.x,a[1]=n.y,n.x=a[2],n.y=a[3],e.Ga(n),a[2]=n.x,a[3]=n.y,n.x=a[4],n.y=a[5],e.Ga(n),a[4]=n.x,a[5]=n.y,n.x=a[6],n.y=a[7],e.Ga(n),a[6]=n.x,a[7]=n.y}z.free(n)},fe.prototype.Zu=function(){if(this._isInvalidBounds)return!0;if(this.type===fe.o){if(this.aq!==this.figures.Ja)return!0;for(var t=this.figures.s,e=t.length,i=0;i<e;i++)if(t[i].Zu())return!0}return!1},fe.prototype.computeBounds=function(){if(this._isInvalidBounds=!1,this.ym=this.tk=null,this.zm=NaN,this.type===fe.o){this.aq=this.figures.Ja;for(var t=this.figures.s,e=t.length,i=0;i<e;i++){var n=t[i];n._isInvalidBounds=!1;var s=n.segments;n.sr=s.Ja,n=s.s,s=n.length;for(var a=0;a<s;a++){var l=n[a];l._isInvalidBounds=!1,l.ae=null}}}t=this.Ip,t.ka(),isNaN(this.Sk)||isNaN(this.Rk)?t.h(0,0,0,0):t.h(0,0,this.Sk,this.Rk),Rc(this,t,!1),vr(t,0,0,0,0),t.freeze()},fe.prototype.ix=function(){var t=new It;return Rc(this,t,!0),t};function Rc(t,e,i){switch(t.type){case fe.j:case fe.u:case fe.F:i?e.h(t.od,t.pd,0,0):vr(e,t.od,t.pd,0,0),vr(e,t.Dc,t.Ec,0,0);break;case fe.o:var n=t.figures;t=n.s,n=n.length;for(var s=0;s<n;s++){var a=t[s];i&&s===0?e.h(a.startX,a.startY,0,0):vr(e,a.startX,a.startY,0,0);for(var l=a.segments.s,c=l.length,f=a.startX,m=a.startY,v=0;v<c;v++){var w=l[v];switch(w.type){case er:case mo:f=w.endX,m=w.endY,vr(e,f,m,0,0);break;case $o:ht.Dl(f,m,w.point1X,w.point1Y,w.point2X,w.point2Y,w.endX,w.endY,.5,e),f=w.endX,m=w.endY;break;case ps:ht.iv(f,m,w.point1X,w.point1Y,w.endX,w.endY,.5,e),f=w.endX,m=w.endY;break;case Or:case xa:var C=w.type===Or?Cs(w,a):js(w,a,f,m),k=C.length;if(k===0){f=w.type===Or?w.centerX:w.endX,m=w.type===Or?w.centerY:w.endY,vr(e,f,m,0,0);break}w=null;for(var L=0;L<k;L++)w=C[L],ht.Dl(w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7],.5,e);w!==null&&(f=w[6],m=w[7]);break;default:lt("Unknown Segment type: "+w.type)}}}break;default:lt("Unknown Geometry type: "+t.type)}}fe.prototype.normalize=function(){this._isFrozen&&Qt(this);var t=this.ix();return this.offset(-t.x,-t.y),new z(-t.x,-t.y)},fe.prototype.offset=function(t,e){return this._isFrozen&&Qt(this),this.transform(1,0,0,1,t,e),this},fe.prototype.scale=function(t,e){return this._isFrozen&&Qt(this),this.transform(t,0,0,e,0,0),this},fe.prototype.rotate=function(t,e,i){this._isFrozen&&Qt(this),e===void 0&&(e=0),i===void 0&&(i=0);var n=nn.alloc();return n.reset(),n.rotate(t,e,i),this.transform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),nn.free(n),this},T=fe.prototype,T.transform=function(t,e,i,n,s,a){switch(this.type){case fe.j:case fe.u:case fe.F:var l=this.od,c=this.pd;this.od=l*t+c*i+s,this.pd=l*e+c*n+a,l=this.Dc,c=this.Ec,this.Dc=l*t+c*i+s,this.Ec=l*e+c*n+a;break;case fe.o:for(var f=this.figures.s,m=f.length,v=0;v<m;v++){var w=f[v];l=w.startX,c=w.startY,w.startX=l*t+c*i+s,w.startY=l*e+c*n+a,w=w.segments.s;for(var C=w.length,k=0;k<C;k++){var L=w[k];switch(L.type){case er:case mo:l=L.endX,c=L.endY,L.endX=l*t+c*i+s,L.endY=l*e+c*n+a;break;case $o:l=L.point1X,c=L.point1Y,L.point1X=l*t+c*i+s,L.point1Y=l*e+c*n+a,l=L.point2X,c=L.point2Y,L.point2X=l*t+c*i+s,L.point2Y=l*e+c*n+a,l=L.endX,c=L.endY,L.endX=l*t+c*i+s,L.endY=l*e+c*n+a;break;case ps:l=L.point1X,c=L.point1Y,L.point1X=l*t+c*i+s,L.point1Y=l*e+c*n+a,l=L.endX,c=L.endY,L.endX=l*t+c*i+s,L.endY=l*e+c*n+a;break;case Or:l=L.centerX,c=L.centerY,L.centerX=l*t+c*i+s,L.centerY=l*e+c*n+a,e!==0&&(l=180*Math.atan2(e,t)/Math.PI,0>l&&(l+=360),L.startAngle+=l),0>t&&(L.startAngle=180-L.startAngle,L.sweepAngle=-L.sweepAngle),0>n&&(L.startAngle=-L.startAngle,L.sweepAngle=-L.sweepAngle),L.radiusX*=Math.sqrt(t*t+i*i),L.radiusY!==void 0&&(L.radiusY*=Math.sqrt(e*e+n*n));break;case xa:if(l=L.endX,c=L.endY,L.endX=l*t+c*i+s,L.endY=l*e+c*n+a,L.radiusX===0||L.radiusY===0)break;e!==0&&(l=180*Math.atan2(e,t)/Math.PI,0>l&&(l+=360),L.xAxisRotation+=l),0>t&&(L.xAxisRotation=180-L.xAxisRotation,L.isClockwiseArc=!L.isClockwiseArc),0>n&&(L.xAxisRotation=-L.xAxisRotation,L.isClockwiseArc=!L.isClockwiseArc),L.radiusX*=Math.sqrt(t*t+i*i),L.radiusY*=Math.sqrt(e*e+n*n);break;default:lt("Unknown Segment type: "+L.type)}}}}return this._isInvalidBounds=!0,this},T.ca=function(t,e){e===void 0&&(e=0);var i=this.od,n=this.pd,s=this.Dc,a=this.Ec;switch(this.type){case fe.j:return ht.Yb(i,n,s,a,e,t.x,t.y);case fe.u:var l=It.allocAt(Math.min(i,s)-e,Math.min(n,a)-e,Math.abs(s-i)+2*e,Math.abs(a-n)+2*e);return t=l.ca(t),It.free(l),t;case fe.F:l=Math.min(i,s)-e;var c=Math.min(n,a)-e;return i=(Math.abs(s-i)+2*e)/2,e=(Math.abs(a-n)+2*e)/2,0>=i||0>=e?!1:(l=t.x-(l+i),c=t.y-(c+e),1>=l*l/(i*i)+c*c/(e*e));case fe.o:return eu(this,t,e,!0,!1);default:return!1}};function eu(t,e,i,n,s){var a=e.x;e=e.y;for(var l=t.bounds.x-20,c=0,f,m,v,w,C=t.figures.s,k=C.length,L=0;L<k;L++){var A=C[L],H=!A.isEvenOdd;if(A.isFilled){if(n&&A.ca(a,e,i))return!0;var R=A.segments;f=A.startX,m=A.startY;for(var X=f,Y=m,tt=R.s,st=0;st<=R.length;st++){var bt=void 0;if(st!==R.length){bt=tt[st];var Te=bt.type;t=bt.endX,w=bt.endY}else Te=er,t=X,w=Y;switch(Te){case mo:if(X=iu(a,e,l,e,f,m,X,Y),isNaN(X))return!0;c+=X,X=t,Y=w;break;case er:if(f=iu(a,e,l,e,f,m,t,w),isNaN(f))return!0;c+=f;break;case $o:v=ht.Fo(f,m,bt.point1X,bt.point1Y,bt.point2X,bt.point2Y,t,w,l,e,a,e,.5),c+=v;break;case ps:v=ht.Fo(f,m,(f+2*bt.point1X)/3,(m+2*bt.point1Y)/3,(2*bt.point1X+t)/3,(2*bt.point1Y+w)/3,t,w,l,e,a,e,.5),c+=v;break;case Or:case xa:Te=bt.type===Or?Cs(bt,A):js(bt,A,f,m);var Ke=Te.length;if(Ke===0){if(f=iu(a,e,l,e,f,m,bt.type===Or?bt.centerX:bt.endX,bt.type===Or?bt.centerY:bt.endY),isNaN(f))return!0;c+=f;break}bt=null;for(var Oe=0;Oe<Ke;Oe++){if(bt=Te[Oe],Oe===0){if(v=iu(a,e,l,e,f,m,bt[0],bt[1]),isNaN(v))return!0;c+=v}v=ht.Fo(bt[0],bt[1],bt[2],bt[3],bt[4],bt[5],bt[6],bt[7],l,e,a,e,.5),c+=v}bt!==null&&(t=bt[6],w=bt[7]);break;default:lt("Unknown Segment type: "+bt.type)}f=t,m=w}if(H){if(c!==0)return!0}else if(c%2!==0)return!0;c=0}else if(A.ca(a,e,s?i:i+2))return!0}return!1}function iu(t,e,i,n,s,a,l,c){if(ht.Yb(s,a,l,c,.05,t,e))return NaN;var f=(t-i)*(a-c);if(f===0)return 0;var m=((t*n-e*i)*(s-l)-(t-i)*(s*c-a*l))/f;if(e=(t*n-e*i)*(a-c)/f,m>=t)return 0;if((s>l?s-l:l-s)<(a>c?a-c:c-a)){if(a<c){if(e<a||e>c)return 0}else if(e<c||e>a)return 0}else if(s<l){if(m<s||m>l)return 0}else if(m<l||m>s)return 0;return 0<f?1:-1}function $r(t,e,i,n){t=t.figures.s;for(var s=t.length,a=0;a<s;a++)if(t[a].ca(e,i,n))return!0;return!1}T.Pu=function(t,e){if(0>t?t=0:1<t&&(t=1),e===void 0&&(e=new z),this.type===fe.j)return e.h(this.startX+t*(this.endX-this.startX),this.startY+t*(this.endY-this.startY)),e;for(var i=this.flattenedSegments,n=this.flattenedLengths,s=i.length,a=this.flattenedTotalLength*t,l=0,c=0;c<s;c++){var f=n[c],m=f.length;for(t=0;t<m;t++){var v=f[t];if(l+v>=a)return n=a-l,n=v===0?0:n/v,i=i[c],c=i[2*t],s=i[2*t+1],e.h(c+(i[2*t+2]-c)*n,s+(i[2*t+3]-s)*n),e;l+=v}}return e},T.wx=function(t){if(0>t?t=0:1<t&&(t=1),this.type===fe.j)return 180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI;for(var e=this.flattenedSegments,i=this.flattenedLengths,n=e.length,s=this.flattenedTotalLength*t,a=0,l=0;l<n;l++){var c=i[l],f=c.length;for(t=0;t<f;t++){var m=c[t];if(a+m>=s)return s=e[l],e=s[2*t],i=s[2*t+1],n=s[2*t+2],t=s[2*t+3],1>Math.abs(n-e)&&1>Math.abs(t-i)?0:1>Math.abs(n-e)?0<=t-i?90:270:1>Math.abs(t-i)?0<=n-e?0:180:180*Math.atan2(t-i,n-e)/Math.PI;a+=m}}return NaN},T.Qu=function(t,e){if(0>t?t=0:1<t&&(t=1),e===void 0&&(e=[]),e.length=3,this.type===fe.j)return e[0]=this.startX+t*(this.endX-this.startX),e[1]=this.startY+t*(this.endY-this.startY),e[2]=180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI,e;for(var i=this.flattenedSegments,n=this.flattenedLengths,s=i.length,a=this.flattenedTotalLength*t,l=0,c=0;c<s;c++){var f=n[c],m=f.length;for(t=0;t<m;t++){var v=f[t];if(l+v>=a)return n=a-l,n=v===0?0:n/v,v=i[c],i=v[2*t],c=v[2*t+1],s=v[2*t+2],t=v[2*t+3],e[0]=i+(s-i)*n,e[1]=c+(t-c)*n,e[2]=1>Math.abs(s-i)&&1>Math.abs(t-c)?0:1>Math.abs(s-i)?0<=t-c?90:270:1>Math.abs(t-c)?0<=s-i?0:180:180*Math.atan2(t-c,s-i)/Math.PI,e;l+=v}}return e},T.xx=function(t){if(this.type===fe.j){var e=this.startX,i=this.startY,n=this.endX,s=this.endY;if(e!==n||i!==s){var a=t.x;if(t=t.y,e===n){if(i<s){var l=i;n=s}else l=s,n=i;return t<=l?l===i?0:1:t>=n?n===i?0:1:Math.abs(t-i)/(n-l)}if(i===s)return e<n?l=e:(l=n,n=e),a<=l?l===e?0:1:a>=n?n===e?0:1:Math.abs(a-e)/(n-l);l=(n-e)*(n-e)+(s-i)*(s-i);var c=z.alloc();return ht.qh(e,i,n,s,a,t,c),t=c.x,a=c.y,z.free(c),Math.sqrt(((t-e)*(t-e)+(a-i)*(a-i))/l)}}else if(this.type===fe.u){l=this.startX,c=this.startY;var f=this.endX;if(s=this.endY,l!==f||c!==s){e=f-l,i=s-c,a=2*e+2*i,n=t.x,t=t.y,n=Math.min(Math.max(n,l),f),t=Math.min(Math.max(t,c),s),l=Math.abs(n-l),f=Math.abs(n-f),c=Math.abs(t-c),s=Math.abs(t-s);var m=Math.min(l,f,c,s);if(m===c)return n/a;if(m===f)return(e+t)/a;if(m===s)return(2*e+i-n)/a;if(m===l)return(2*e+2*i-t)/a}}else{e=this.flattenedSegments,i=this.flattenedLengths,a=this.flattenedTotalLength,n=z.alloc(),s=1/0,c=l=0,f=e.length;for(var v=m=0,w=0;w<f;w++)for(var C=e[w],k=i[w],L=C.length,A=0;A<L;A+=2){var H=C[A],R=C[A+1];if(A!==0){ht.qh(m,v,H,R,t.x,t.y,n);var X=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y);X<s&&(s=X,l=c,l+=Math.sqrt((n.x-m)*(n.x-m)+(n.y-v)*(n.y-v))),c+=k[(A-2)/2]}m=H,v=R}return z.free(n),t=l/a,0>t?0:1<t?1:t}return 0};function Zr(t){if(t.tk===null){var e=t.tk=[],i=t.ym=[],n=[],s=[];if(t.type===fe.j)n.push(t.startX),n.push(t.startY),n.push(t.endX),n.push(t.endY),e.push(n),s.push(Math.sqrt((t.startX-t.endX)*(t.startX-t.endX)+(t.startY-t.endY)*(t.startY-t.endY))),i.push(s);else if(t.type===fe.u)n.push(t.startX),n.push(t.startY),n.push(t.endX),n.push(t.startY),n.push(t.endX),n.push(t.endY),n.push(t.startX),n.push(t.endY),n.push(t.startX),n.push(t.startY),e.push(n),s.push(Math.abs(t.startX-t.endX)),s.push(Math.abs(t.startY-t.endY)),s.push(Math.abs(t.startX-t.endX)),s.push(Math.abs(t.startY-t.endY)),i.push(s);else if(t.type===fe.F){var a=new Mr;a.startX=t.endX,a.startY=(t.startY+t.endY)/2;var l=new an(Or);if(l.startAngle=0,l.sweepAngle=360,l.centerX=(t.startX+t.endX)/2,l.centerY=(t.startY+t.endY)/2,l.radiusX=Math.abs(t.startX-t.endX)/2,l.radiusY=Math.abs(t.startY-t.endY)/2,a.add(l),t=Cs(l,a),s=t.length,s===0)n.push(l.centerX),n.push(l.centerY);else{l=a.startX,a=a.startY;for(var c=0;c<s;c++){var f=t[c];ht.Qe(l,a,f[2],f[3],f[4],f[5],f[6],f[7],.5,n),l=f[6],a=f[7]}}e.push(n),i.push(fo(n))}else for(t=t.figures.iterator;t.next();){s=t.value,n=[],n.push(s.startX),n.push(s.startY),l=s.startX,a=s.startY,c=l,f=a;for(var m=s.segments.s,v=m.length,w=0;w<v;w++){var C=m[w];switch(C.type){case mo:4<=n.length&&(e.push(n),i.push(fo(n))),n=[],n.push(C.endX),n.push(C.endY),l=C.endX,a=C.endY,c=l,f=a;break;case er:n.push(C.endX),n.push(C.endY),l=C.endX,a=C.endY;break;case $o:ht.Qe(l,a,C.point1X,C.point1Y,C.point2X,C.point2Y,C.endX,C.endY,.5,n),l=C.endX,a=C.endY;break;case ps:ht.ep(l,a,C.point1X,C.point1Y,C.endX,C.endY,.5,n),l=C.endX,a=C.endY;break;case Or:var k=Cs(C,s),L=k.length;if(L===0){n.push(C.centerX),n.push(C.centerY),l=C.centerX,a=C.centerY;break}for(var A=0;A<L;A++){var H=k[A];ht.Qe(l,a,H[2],H[3],H[4],H[5],H[6],H[7],.5,n),l=H[6],a=H[7]}break;case xa:if(k=js(C,s,l,a),L=k.length,A=C.endX,H=C.endY,L===0){n.push(A),n.push(H),l=A,a=H;break}for(A=0;A<L;A++)H=k[A],ht.Qe(l,a,H[2],H[3],H[4],H[5],H[6],H[7],.5,n),l=H[6],a=H[7];break;default:lt("Segment not of valid type: "+C.type)}C.isClosed&&(n.push(c),n.push(f))}4<=n.length&&(e.push(n),i.push(fo(n)))}}}function fo(t){for(var e=[],i=0,n=0,s=t.length,a=0;a<s;a+=2){var l=t[a],c=t[a+1];a!==0&&e.push(Math.sqrt(Xr(i,n,l,c))),i=l,n=c}return e}T.add=function(t){return this.ee.add(t),this},T.pm=function(t,e,i,n,s,a,l,c){return this._isFrozen&&Qt(this),this.fg=new Ze(t,e,s,a).freeze(),this.gg=new Ze(i,n,l,c).freeze(),this},ct.Object.defineProperties(fe.prototype,{_isFrozen:{get:function(){return(this.l&1)!==0},set:function(t){this.l=t?this.l|1:this.l&-2}},_isInvalidBounds:{get:function(){return(this.l&2)!==0},set:function(t){this.l=t?this.l|2:this.l&-3}},flattenedSegments:{get:function(){return Zr(this),this.tk}},flattenedLengths:{get:function(){return Zr(this),this.ym}},flattenedTotalLength:{get:function(){var t=this.zm;if(isNaN(t)){if(this.type===fe.j){t=Math.abs(this.endX-this.startX);var e=Math.abs(this.endY-this.startY);t=Math.sqrt(t*t+e*e)}else if(this.type===fe.u)t=2*Math.abs(this.endX-this.startX)+2*Math.abs(this.endY-this.startY);else{e=this.flattenedLengths;for(var i=e.length,n=t=0;n<i;n++)for(var s=e[n],a=s.length,l=0;l<a;l++)t+=s[l]}this.zm=t}return t}},type:{get:function(){return this.na},set:function(t){this.na!==t&&(this._isFrozen&&Qt(this,t),this.na=t,t===fe.o?this.ee=new Kt:(fe.V===null&&(fe.V=new Kt().freeze()),this.ee=fe.V),this._isInvalidBounds=!0)}},startX:{get:function(){return this.od},set:function(t){this.od!==t&&(this._isFrozen&&Qt(this,t),this.od=t,this._isInvalidBounds=!0)}},startY:{get:function(){return this.pd},set:function(t){this.pd!==t&&(this._isFrozen&&Qt(this,t),this.pd=t,this._isInvalidBounds=!0)}},endX:{get:function(){return this.Dc},set:function(t){this.Dc!==t&&(this._isFrozen&&Qt(this,t),this.Dc=t,this._isInvalidBounds=!0)}},endY:{get:function(){return this.Ec},set:function(t){this.Ec!==t&&(this._isFrozen&&Qt(this,t),this.Ec=t,this._isInvalidBounds=!0)}},figures:{get:function(){return this.ee},set:function(t){this.ee!==t&&(this._isFrozen&&Qt(this,t),this.ee=t,this._isInvalidBounds=!0)}},spot1:{get:function(){return this.fg},set:function(t){this._isFrozen&&Qt(this,t),this.fg=t.J()}},spot2:{get:function(){return this.gg},set:function(t){this._isFrozen&&Qt(this,t),this.gg=t.J()}},defaultStretch:{get:function(){return this.Uf},set:function(t){this._isFrozen&&Qt(this,t),this.Uf=t}},bounds:{get:function(){return this.Zu()&&this.computeBounds(),this.Ip}}}),fe.prototype.setSpots=fe.prototype.pm,fe.prototype.add=fe.prototype.add,fe.prototype.getFractionForPoint=fe.prototype.xx,fe.prototype.getPointAndAngleAlongPath=fe.prototype.Qu,fe.prototype.getAngleAlongPath=fe.prototype.wx,fe.prototype.getPointAlongPath=fe.prototype.Pu,fe.prototype.containsPoint=fe.prototype.ca,fe.prototype.transform=fe.prototype.transform,fe.prototype.rotate=fe.prototype.rotate,fe.prototype.scale=fe.prototype.scale,fe.prototype.offset=fe.prototype.offset,fe.prototype.normalize=fe.prototype.normalize,fe.prototype.computeBoundsWithoutOrigin=fe.prototype.ix,fe.prototype.equalsApprox=fe.prototype.Xa,fe.className="Geometry",fe.j=new mt(fe,"Line",0),fe.u=new mt(fe,"Rectangle",1),fe.F=new mt(fe,"Ellipse",2),fe.o=new mt(fe,"Path",3),fe.V=null,fe.hb="UuBbMmZzLlHhVvCcSsQqTtAaFfXx",fe.className="Geometry",fe.stringify=fe.ia,fe.fillPath=fe.nb,fe.parse=fe.parse,fe.Line=fe.j,fe.Rectangle=fe.u,fe.Ellipse=fe.F,fe.Path=fe.o;function Mr(t,e,i,n,s){vi(this),i===void 0&&(i=!0),n===void 0&&(n=!0),s===void 0&&(s=!1),this.l=2|(i?4:0)|(n?8:0)|(s?16:0),t!==void 0?this.od=t:this.od=0,e!==void 0?this.pd=e:this.pd=0,this.pl=new Kt,this.sr=this.pl.Ja,this.fw=null}Mr.prototype.copy=function(){var t=new Mr;t.l=this.l&-2,t.od=this.od,t.pd=this.pd;for(var e=this.pl.s,i=e.length,n=t.pl,s=0;s<i;s++){var a=e[s].copy();n.add(a)}return t.sr=this.sr,t.fw=this.fw,t},T=Mr.prototype,T.Xa=function(t){if(!(t instanceof Mr&&ht.B(this.startX,t.startX)&&ht.B(this.startY,t.startY)))return!1;var e=this.segments.s;t=t.segments.s;var i=e.length;if(i!==t.length)return!1;for(var n=0;n<i;n++)if(!e[n].Xa(t[n]))return!1;return!0},T.toString=function(t){t===void 0&&(t=-1);for(var e=0>t?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(t)+" "+this.startY.toFixed(t),i=this.segments.s,n=i.length,s=0;s<n;s++)e+=" "+i[s].toString(t);return e},T.freeze=function(){this._isFrozen=!0;var t=this.segments;t.freeze();var e=t.s;t=t.length;for(var i=0;i<t;i++)e[i].freeze();return this},T.ka=function(){this._isFrozen=!1;var t=this.segments;t.ka(),t=t.s;for(var e=t.length,i=0;i<e;i++)t[i].ka();return this},T.Zu=function(){if(this._isInvalidBounds)return!0;var t=this.segments;if(this.sr!==t.Ja)return!0;t=t.s;for(var e=t.length,i=0;i<e;i++)if(t[i]._isInvalidBounds)return!0;return!1},T.add=function(t){return this.pl.add(t),this},T.ca=function(t,e,i){for(var n=this.startX,s=this.startY,a=n,l=s,c=this.segments.s,f=c.length,m=0;m<f;m++){var v=c[m];switch(v.type){case mo:a=v.endX,l=v.endY,n=v.endX,s=v.endY;break;case er:if(ht.Yb(n,s,v.endX,v.endY,i,t,e))return!0;n=v.endX,s=v.endY;break;case $o:if(ht.cs(n,s,v.point1X,v.point1Y,v.point2X,v.point2Y,v.endX,v.endY,.5,t,e,i))return!0;n=v.endX,s=v.endY;break;case ps:if(ht.jv(n,s,v.point1X,v.point1Y,v.endX,v.endY,.5,t,e,i))return!0;n=v.endX,s=v.endY;break;case Or:case xa:var w=v.type===Or?Cs(v,this):js(v,this,n,s),C=w.length,k=v.type===Or?v.centerX:v.endX,L=v.type===Or?v.centerY:v.endY;if(C===0){if(ht.Yb(n,s,k,L,i,t,e))return!0;n=k,s=L;break}for(k=null,L=0;L<C;L++)if(k=w[L],L===0&&ht.Yb(n,s,k[0],k[1],i,t,e)||ht.cs(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],.5,t,e,i))return!0;k!==null&&(n=k[6],s=k[7]);break;default:lt("Unknown Segment type: "+v.type)}if(v.isClosed&&(n!==a||s!==l)&&ht.Yb(n,s,a,l,i,t,e))return!0}return!1},ct.Object.defineProperties(Mr.prototype,{_isFrozen:{get:function(){return(this.l&1)!==0},set:function(t){this.l=t?this.l|1:this.l&-2}},_isInvalidBounds:{get:function(){return(this.l&2)!==0},set:function(t){this.l=t?this.l|2:this.l&-3}},isFilled:{get:function(){return(this.l&4)!==0},set:function(t){this._isFrozen&&Qt(this,t),this.l=t?this.l|4:this.l&-5}},isShadowed:{get:function(){return(this.l&8)!==0},set:function(t){this._isFrozen&&Qt(this,t),this.l=t?this.l|8:this.l&-9}},isEvenOdd:{get:function(){return(this.l&16)!==0},set:function(t){this._isFrozen&&Qt(this,t),this.l=t?this.l|16:this.l&-17}},startX:{get:function(){return this.od},set:function(t){this._isFrozen&&Qt(this,t),this.od=t,this._isInvalidBounds=!0}},startY:{get:function(){return this.pd},set:function(t){this._isFrozen&&Qt(this,t),this.pd=t,this._isInvalidBounds=!0}},segments:{get:function(){return this.pl},set:function(t){this._isFrozen&&Qt(this,t),this.pl=t,this._isInvalidBounds=!0}}}),Mr.prototype.add=Mr.prototype.add,Mr.prototype.equalsApprox=Mr.prototype.Xa,Mr.className="PathFigure";function an(t,e,i,n,s,a,l,c){vi(this),t===void 0&&(t=er),this.na=t,this.l=2,e!==void 0?this.Dc=e:this.Dc=0,i!==void 0?this.Ec=i:this.Ec=0,n===void 0&&(n=0),s===void 0&&(s=0),a===void 0&&(a=0),l===void 0&&(l=0),t===xa?(t=a%360,0>t&&(t+=360),this.Ne=t,this.Vh=0,this.Wh=Math.max(n,0),this.Pg=Math.max(s,0),typeof l=="boolean"?l&&(this.isLargeArc=!0):typeof l=="number"&&l&&(this.isLargeArc=!0),c&&(this.isClockwiseArc=!0)):(this.Ne=n,this.Vh=s,t===Or&&(a=Math.max(a,0)),this.Wh=a,typeof l=="number"?(t===Or&&(l=Math.max(l,0)),this.Pg=l):this.Pg=0),this.ae=null}an.prototype.copy=function(){var t=new an;return t.na=this.na,t.l=this.l&-2,t.Dc=this.Dc,t.Ec=this.Ec,t.Ne=this.Ne,t.Vh=this.Vh,t.Wh=this.Wh,t.Pg=this.Pg,t},T=an.prototype,T.Xa=function(t){if(!(t instanceof an)||this.type!==t.type||this.isClosed!==t.isClosed)return!1;switch(this.type){case mo:case er:return ht.B(this.endX,t.endX)&&ht.B(this.endY,t.endY);case $o:return ht.B(this.endX,t.endX)&&ht.B(this.endY,t.endY)&&ht.B(this.point1X,t.point1X)&&ht.B(this.point1Y,t.point1Y)&&ht.B(this.point2X,t.point2X)&&ht.B(this.point2Y,t.point2Y);case ps:return ht.B(this.endX,t.endX)&&ht.B(this.endY,t.endY)&&ht.B(this.point1X,t.point1X)&&ht.B(this.point1Y,t.point1Y);case Or:return ht.B(this.startAngle,t.startAngle)&&ht.B(this.sweepAngle,t.sweepAngle)&&ht.B(this.centerX,t.centerX)&&ht.B(this.centerY,t.centerY)&&ht.B(this.radiusX,t.radiusX)&&ht.B(this.radiusY,t.radiusY);case xa:return this.isClockwiseArc===t.isClockwiseArc&&this.isLargeArc===t.isLargeArc&&ht.B(this.xAxisRotation,t.xAxisRotation)&&ht.B(this.endX,t.endX)&&ht.B(this.endY,t.endY)&&ht.B(this.radiusX,t.radiusX)&&ht.B(this.radiusY,t.radiusY);default:return!1}},T.qb=function(t){t.classType===an&&(this.type=t)},T.toString=function(t){switch(t===void 0&&(t=-1),this.type){case mo:t=0>t?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(t)+" "+this.endY.toFixed(t);break;case er:t=0>t?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(t)+" "+this.endY.toFixed(t);break;case $o:t=0>t?"C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"C"+this.point1X.toFixed(t)+" "+this.point1Y.toFixed(t)+" "+this.point2X.toFixed(t)+" "+this.point2Y.toFixed(t)+" "+this.endX.toFixed(t)+" "+this.endY.toFixed(t);break;case ps:t=0>t?"Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"Q"+this.point1X.toFixed(t)+" "+this.point1Y.toFixed(t)+" "+this.endX.toFixed(t)+" "+this.endY.toFixed(t);break;case Or:t=0>t?"B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+" "+this.radiusX.toString()+" "+this.radiusY.toString():"B"+this.startAngle.toFixed(t)+" "+this.sweepAngle.toFixed(t)+" "+this.centerX.toFixed(t)+" "+this.centerY.toFixed(t)+" "+this.radiusX.toFixed(t)+" "+this.radiusY.toFixed(t);break;case xa:t=0>t?"A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():"A"+this.radiusX.toFixed(t)+" "+this.radiusY.toFixed(t)+" "+this.xAxisRotation.toFixed(t)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toFixed(t)+" "+this.endY.toFixed(t);break;default:t=this.type.toString()}return t+(this.isClosed?"z":"")},T.freeze=function(){return this._isFrozen=!0,this},T.ka=function(){return this._isFrozen=!1,this},T.close=function(){return this.isClosed=!0,this};function Cs(t,e){if(t.ae!==null&&e._isInvalidBounds===!1)return t.ae;var i=t.radiusX,n=t.radiusY;if(n===void 0&&(n=i),i===0||n===0)return t.ae=[],t.ae;e=t.Ne;var s=t.Vh,a=ht.jx(0,0,i<n?i:n,t.startAngle,t.startAngle+t.sweepAngle,!1);if(i!==n){var l=nn.alloc();l.reset(),i<n?l.scale(1,n/i):l.scale(i/n,1),fe.Ha(a,l),nn.free(l)}for(i=a.length,n=0;n<i;n++)l=a[n],l[0]+=e,l[1]+=s,l[2]+=e,l[3]+=s,l[4]+=e,l[5]+=s,l[6]+=e,l[7]+=s;return t.ae=a,t.ae}function js(t,e,i,n){function s(A,H,R,X){return(A*X<H*R?-1:1)*Math.acos((A*R+H*X)/(Math.sqrt(A*A+H*H)*Math.sqrt(R*R+X*X)))}if(t.ae!==null&&e._isInvalidBounds===!1)return t.ae;if(t.radiusX===0||t.radiusY===0)return t.ae=[],t.ae;e=t.Wh;var a=t.Pg;e===0&&(e=1e-4),a===0&&(a=1e-4);var l=Math.PI/180*t.Ne,c=t.isLargeArc,f=t.isClockwiseArc,m=t.Dc,v=t.Ec,w=Math.cos(l),C=Math.sin(l),k=w*(i-m)/2+C*(n-v)/2;l=-C*(i-m)/2+w*(n-v)/2;var L=k*k/(e*e)+l*l/(a*a);return 1<L&&(e*=Math.sqrt(L),a*=Math.sqrt(L)),L=(c===f?-1:1)*Math.sqrt((e*e*a*a-e*e*l*l-a*a*k*k)/(e*e*l*l+a*a*k*k)),isNaN(L)&&(L=0),c=L*e*l/a,L=L*-a*k/e,isNaN(c)&&(c=0),isNaN(L)&&(L=0),i=(i+m)/2+w*c-C*L,n=(n+v)/2+C*c+w*L,v=s(1,0,(k-c)/e,(l-L)/a),w=(k-c)/e,m=(l-L)/a,k=(-k-c)/e,c=(-l-L)/a,l=s(w,m,k,c),k=(w*k+m*c)/(Math.sqrt(w*w+m*m)*Math.sqrt(k*k+c*c)),-1>=k?l=Math.PI:1<=k&&(l=0),!f&&0<l&&(l-=2*Math.PI),f&&0>l&&(l+=2*Math.PI),f=e>a?1:e/a,k=e>a?a/e:1,e=ht.jx(0,0,e>a?e:a,v,v+l,!0),a=nn.alloc(),a.reset(),a.translate(i,n),a.rotate(t.Ne,0,0),a.scale(f,k),fe.Ha(e,a),nn.free(a),t.ae=e,t.ae}ct.Object.defineProperties(an.prototype,{_isFrozen:{get:function(){return(this.l&1)!==0},set:function(t){this.l=t?this.l|1:this.l&-2}},_isInvalidBounds:{get:function(){return(this.l&2)!==0},set:function(t){this.l=t?this.l|2:this.l&-3}},isClosed:{get:function(){return(this.l&8)!==0},set:function(t){this.isClosed!==t&&(this.l=t?this.l|8:this.l&-9,this._isInvalidBounds=!0)}},type:{get:function(){return this.na},set:function(t){this._isFrozen&&Qt(this,t),this.na=t,this._isInvalidBounds=!0}},endX:{get:function(){return this.Dc},set:function(t){this._isFrozen&&Qt(this,t),this.Dc=t,this._isInvalidBounds=!0}},endY:{get:function(){return this.Ec},set:function(t){this._isFrozen&&Qt(this,t),this.Ec=t,this._isInvalidBounds=!0}},point1X:{get:function(){return this.Ne},set:function(t){this._isFrozen&&Qt(this,t),this.Ne=t,this._isInvalidBounds=!0}},point1Y:{get:function(){return this.Vh},set:function(t){this._isFrozen&&Qt(this,t),this.Vh=t,this._isInvalidBounds=!0}},point2X:{get:function(){return this.Wh},set:function(t){this._isFrozen&&Qt(this,t),this.Wh=t,this._isInvalidBounds=!0}},point2Y:{get:function(){return this.Pg},set:function(t){this._isFrozen&&Qt(this,t),this.Pg=t,this._isInvalidBounds=!0}},centerX:{get:function(){return this.Ne},set:function(t){this._isFrozen&&Qt(this,t),this.Ne=t,this._isInvalidBounds=!0}},centerY:{get:function(){return this.Vh},set:function(t){this._isFrozen&&Qt(this,t),this.Vh=t,this._isInvalidBounds=!0}},radiusX:{get:function(){return this.Wh},set:function(t){0>t&&me(t,">= zero",an,"radiusX"),this._isFrozen&&Qt(this,t),this.Wh=t,this._isInvalidBounds=!0}},radiusY:{get:function(){return this.Pg},set:function(t){0>t&&me(t,">= zero",an,"radiusY"),this._isFrozen&&Qt(this,t),this.Pg=t,this._isInvalidBounds=!0}},startAngle:{get:function(){return this.Dc},set:function(t){this._isFrozen&&Qt(this,t),t%=360,0>t&&(t+=360),this.Dc=t,this._isInvalidBounds=!0}},sweepAngle:{get:function(){return this.Ec},set:function(t){this._isFrozen&&Qt(this,t),360<t&&(t=360),-360>t&&(t=-360),this.Ec=t,this._isInvalidBounds=!0}},isClockwiseArc:{get:function(){return(this.l&4)!==0},set:function(t){this._isFrozen&&Qt(this,t),this.l=t?this.l|4:this.l&-5,this._isInvalidBounds=!0}},isLargeArc:{get:function(){return(this.l&16)!==0},set:function(t){this._isFrozen&&Qt(this,t),this.l=t?this.l|16:this.l&-17,this._isInvalidBounds=!0}},xAxisRotation:{get:function(){return this.Ne},set:function(t){this._isFrozen&&Qt(this,t),t%=360,0>t&&(t+=360),this.Ne=t,this._isInvalidBounds=!0}}}),an.prototype.equalsApprox=an.prototype.Xa;var mo=new mt(an,"Move",0),er=new mt(an,"Line",1),$o=new mt(an,"Bezier",2),ps=new mt(an,"QuadraticBezier",3),Or=new mt(an,"Arc",4),xa=new mt(an,"SvgArc",4);an.className="PathSegment",an.Move=mo,an.Line=er,an.Bezier=$o,an.QuadraticBezier=ps,an.Arc=Or,an.SvgArc=xa;function As(){this.H=null,this.xu=new z(0,0).freeze(),this.mt=new z(0,0).freeze(),this.Bp=this.Rq=0,this.Cp=1,this.xq="",this.Wr=this.Tp=!1,this.Rp=this.Ep=0,this.xg=this.nq=this.tq=!1,this.Zp=null,this.Rr=0,this.xd=this.Nr=null}As.prototype.copy=function(){var t=new As;return this.clone(t)},As.prototype.clone=function(t){return t.H=this.H,t.xu.assign(this.viewPoint),t.mt.assign(this.documentPoint),t.Rq=this.Rq,t.Bp=this.Bp,t.Cp=this.Cp,t.xq=this.xq,t.Tp=this.Tp,t.Wr=this.Wr,t.Ep=this.Ep,t.Rp=this.Rp,t.tq=this.tq,t.nq=this.nq,t.xg=this.xg,t.Zp=this.Zp,t.Rr=this.Rr,t.Nr=this.Nr,t.xd=this.xd,t},As.prototype.toString=function(){var t="^";return this.modifiers!==0&&(t+="M:"+this.modifiers),this.button!==0&&(t+="B:"+this.button),this.key!==""&&(t+="K:"+this.key),this.clickCount!==0&&(t+="C:"+this.clickCount),this.delta!==0&&(t+="D:"+this.delta),this.handled&&(t+="h"),this.bubbles&&(t+="b"),this.documentPoint!==null&&(t+="@"+this.documentPoint.toString()),t},As.prototype.So=function(t,e){var i=this.diagram;return i===null||Oh(i,t,e),e},As.prototype.Bz=function(t,e){var i=this.diagram;return i===null||(Oh(i,t,e),e.assign(i.Ps(e))),e},ct.Object.defineProperties(As.prototype,{diagram:{get:function(){return this.H},set:function(t){this.H=t}},viewPoint:{get:function(){return this.xu},set:function(t){this.xu.assign(t)}},documentPoint:{get:function(){return this.mt},set:function(t){this.mt.assign(t)}},modifiers:{get:function(){return this.Rq},set:function(t){this.Rq=t}},button:{get:function(){return this.Bp},set:function(t){if(this.Bp=t,this.event===null)switch(t){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}}},buttons:{get:function(){return this.Cp},set:function(t){this.Cp=t}},key:{get:function(){return this.xq},set:function(t){this.xq=t}},down:{get:function(){return this.Tp},set:function(t){this.Tp=t}},up:{get:function(){return this.Wr},set:function(t){this.Wr=t}},clickCount:{get:function(){return this.Ep},set:function(t){this.Ep=t}},delta:{get:function(){return this.Rp},set:function(t){this.Rp=t}},isMultiTouch:{get:function(){return this.tq},set:function(t){this.tq=t}},handled:{get:function(){return this.nq},set:function(t){this.nq=t}},bubbles:{get:function(){return this.xg},set:function(t){this.xg=t}},event:{get:function(){return this.Zp},set:function(t){this.Zp=t}},isTouchEvent:{get:function(){var t=this.event;return t===null?!1:t.pointerType==="touch"||t.pointerType==="pen"}},timestamp:{get:function(){return this.Rr},set:function(t){this.Rr=t}},targetDiagram:{get:function(){return this.Nr},set:function(t){this.Nr=t}},targetObject:{get:function(){return this.xd},set:function(t){this.xd=t}},control:{get:function(){return(this.modifiers&1)!==0},set:function(t){this.modifiers=t?this.modifiers|1:this.modifiers&-2}},shift:{get:function(){return(this.modifiers&4)!==0},set:function(t){this.modifiers=t?this.modifiers|4:this.modifiers&-5}},alt:{get:function(){return(this.modifiers&2)!==0},set:function(t){this.modifiers=t?this.modifiers|2:this.modifiers&-3}},meta:{get:function(){return(this.modifiers&8)!==0},set:function(t){this.modifiers=t?this.modifiers|8:this.modifiers&-9}},left:{get:function(){var t=this.event;return t===null||t.type!=="mousedown"&&t.type!=="mouseup"&&t.type!=="pointerdown"&&t.type!=="pointerup"?(this.buttons&1)!==0:this.button===0},set:function(t){this.buttons=t?this.buttons|1:this.buttons&-2}},right:{get:function(){var t=this.event;return t===null||t.type!=="mousedown"&&t.type!=="mouseup"&&t.type!=="pointerdown"&&t.type!=="pointerup"?(this.buttons&2)!==0:this.button===2},set:function(t){this.buttons=t?this.buttons|2:this.buttons&-3}},middle:{get:function(){var t=this.event;return t===null||t.type!=="mousedown"&&t.type!=="mouseup"&&t.type!=="pointerdown"&&t.type!=="pointerup"?(this.buttons&4)!==0:this.button===1},set:function(t){this.buttons=t?this.buttons|4:this.buttons&-5}}}),As.prototype.getMultiTouchDocumentPoint=As.prototype.Bz,As.prototype.getMultiTouchViewPoint=As.prototype.So,As.className="InputEvent";function Sh(){this.H=null,this.xa="",this.ar=this.Lr=null}Sh.prototype.copy=function(){var t=new Sh;return t.H=this.H,t.xa=this.xa,t.Lr=this.Lr,t.ar=this.ar,t},Sh.prototype.toString=function(){var t="*"+this.name;return this.subject!==null&&(t+=":"+this.subject.toString()),this.parameter!==null&&(t+="("+this.parameter.toString()+")"),t},ct.Object.defineProperties(Sh.prototype,{diagram:{get:function(){return this.H},set:function(t){this.H=t}},name:{get:function(){return this.xa},set:function(t){this.xa=t}},subject:{get:function(){return this.Lr},set:function(t){this.Lr=t}},parameter:{get:function(){return this.ar},set:function(t){this.ar=t}}}),Sh.className="DiagramEvent";function Cr(){this.Fm=Sr,this.rf=this.Qq="",this.Ln=this.Mn=this.Rn=this.Sn=this.Qn=this.H=this.cc=null}Cr.prototype.clear=function(){this.Ln=this.Mn=this.Rn=this.Sn=this.Qn=this.H=this.cc=null},Cr.prototype.copy=function(){var t=new Cr;t.Fm=this.Fm,t.Qq=this.Qq,t.rf=this.rf,t.cc=this.cc,t.H=this.H,t.Qn=this.Qn;var e=this.Sn;return t.Sn=Tt(e)&&typeof e.J=="function"?e.J():e,e=this.Rn,t.Rn=Tt(e)&&typeof e.J=="function"?e.J():e,e=this.Mn,t.Mn=Tt(e)&&typeof e.J=="function"?e.J():e,e=this.Ln,t.Ln=Tt(e)&&typeof e.J=="function"?e.J():e,t},Cr.prototype.qb=function(t){t.classType===Cr&&(this.change=t)},Cr.prototype.toString=function(){var t="";return t=this.change===wa?t+"* ":this.change===Sr?t+(this.model!==null?"!m":"!d"):t+((this.model!==null?"!m":"!d")+this.change),this.propertyName&&typeof this.propertyName=="string"&&(t+=" "+this.propertyName),this.modelChange&&this.modelChange!==this.propertyName&&(t+=" "+this.modelChange),t+=": ",this.change===wa?this.oldValue!==null&&(t+=" "+this.oldValue):(this.object!==null&&(t+=ni(this.object)),this.oldValue!==null&&(t+=" old: "+ni(this.oldValue)),this.oldParam!==null&&(t+=" "+this.oldParam),this.newValue!==null&&(t+=" new: "+ni(this.newValue)),this.newParam!==null&&(t+=" "+this.newParam)),t},Cr.prototype.I=function(t){return t?this.oldValue:this.newValue},Cr.prototype.Dz=function(t){return t?this.oldParam:this.newParam},Cr.prototype.canUndo=function(){return this.model!==null||this.diagram!==null},Cr.prototype.undo=function(){this.canUndo()&&(this.model!==null?this.model.changeState(this,!0):this.diagram!==null&&this.diagram.changeState(this,!0))},Cr.prototype.canRedo=function(){return this.model!==null||this.diagram!==null},Cr.prototype.redo=function(){this.canRedo()&&(this.model!==null?this.model.changeState(this,!1):this.diagram!==null&&this.diagram.changeState(this,!1))},ct.Object.defineProperties(Cr.prototype,{model:{get:function(){return this.cc},set:function(t){this.cc=t}},diagram:{get:function(){return this.H},set:function(t){this.H=t}},change:{get:function(){return this.Fm},set:function(t){this.Fm=t}},modelChange:{get:function(){return this.Qq},set:function(t){this.Qq=t}},propertyName:{get:function(){return this.rf},set:function(t){this.rf=t}},isTransactionFinished:{get:function(){return this.Fm===wa&&(this.rf==="CommittedTransaction"||this.rf==="FinishedUndo"||this.rf==="FinishedRedo")}},object:{get:function(){return this.Qn},set:function(t){this.Qn=t}},oldValue:{get:function(){return this.Sn},set:function(t){this.Sn=t}},oldParam:{get:function(){return this.Rn},set:function(t){this.Rn=t}},newValue:{get:function(){return this.Mn},set:function(t){this.Mn=t}},newParam:{get:function(){return this.Ln},set:function(t){this.Ln=t}}}),Cr.prototype.redo=Cr.prototype.redo,Cr.prototype.canRedo=Cr.prototype.canRedo,Cr.prototype.undo=Cr.prototype.undo,Cr.prototype.canUndo=Cr.prototype.canUndo,Cr.prototype.getParam=Cr.prototype.Dz,Cr.prototype.getValue=Cr.prototype.I,Cr.prototype.clear=Cr.prototype.clear;var wa=new mt(Cr,"Transaction",-1),Sr=new mt(Cr,"Property",0),Yr=new mt(Cr,"Insert",1),Jr=new mt(Cr,"Remove",2);Cr.className="ChangedEvent",Cr.Transaction=wa,Cr.Property=Sr,Cr.Insert=Yr,Cr.Remove=Jr;function Bo(){this.o=new Kt().freeze(),this.xa="",this.j=!1}Bo.prototype.toString=function(t){var e="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(t!==void 0&&0<t){t=this.changes.count;for(var i=0;i<t;i++){var n=this.changes.M(i);n!==null&&(e+=`
`+n.toString())}}return e},Bo.prototype.clear=function(){var t=this.changes;t.ka();for(var e=t.count-1;0<=e;e--){var i=t.M(e);i!==null&&i.clear()}t.clear(),t.freeze()},Bo.prototype.canUndo=function(){return this.isComplete},Bo.prototype.undo=function(){if(this.canUndo())for(var t=this.changes.count-1;0<=t;t--){var e=this.changes.M(t);e!==null&&e.undo()}},Bo.prototype.canRedo=function(){return this.isComplete},Bo.prototype.redo=function(){if(this.canRedo())for(var t=this.changes.count,e=0;e<t;e++){var i=this.changes.M(e);i!==null&&i.redo()}},Bo.prototype.ak=function(){if(this.isComplete){var t=this.changes;t.ka();for(var e=new pe,i=0;i<t.count;i++){var n=t.M(i);if(n!==null&&n.change===Sr&&n.object){var s=e.get(n.object);s||(s=new pe,e.set(n.object,s));var a=s.get(n.propertyName);a===null?s.set(n.propertyName,-1):(0<a&&t.cd(a,null),s.set(n.propertyName,i))}}for(i=e=0;i<t.count;i++)n=t.M(i),n!==null&&(i>e&&t.cd(e,n),e++);for(;t.length>e;)t.pop();t.freeze()}},ct.Object.defineProperties(Bo.prototype,{changes:{get:function(){return this.o}},name:{get:function(){return this.xa},set:function(t){this.xa=t}},isComplete:{get:function(){return this.j},set:function(t){this.j=t}}}),Bo.prototype.optimize=Bo.prototype.ak,Bo.prototype.redo=Bo.prototype.redo,Bo.prototype.canRedo=Bo.prototype.canRedo,Bo.prototype.undo=Bo.prototype.undo,Bo.prototype.canUndo=Bo.prototype.canUndo,Bo.prototype.clear=Bo.prototype.clear,Bo.className="Transaction";function Tr(){this.Pt=new At,this.Jd=!1,this.u=new Kt().freeze(),this.Ce=-1,this.o=999,this.Fe=!1,this.Np=null,this.bi=0,this.j=!1,this.Ie=new Kt().freeze(),this.hl=new Kt,this.tt=!0,this.Dt=this.rq=this.Gt=this.Ft=!1}Tr.prototype.toString=function(t){var e="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;e+="[";for(var i=this.nestedTransactionNames.count,n=0;n<i;n++)0<n&&(e+=" "),e+=this.nestedTransactionNames.M(n);if(e+="]",t!==void 0&&0<t)for(i=this.history.count,n=0;n<i;n++)e+=`
`+this.history.M(n).toString(t-1);return e},Tr.prototype.clear=function(){var t=this.history;t.ka();for(var e=t.count-1;0<=e;e--){var i=t.M(e);i!==null&&i.clear()}t.clear(),this.Ce=-1,t.freeze(),this.Fe=!1,this.Np=null,this.bi=0,this.Ie.ka(),this.Ie.clear(),this.Ie.freeze(),this.hl.clear(),this.Dt=this.rq=this.Gt=this.Ft=!1},Tr.prototype.copyProperties=function(t){this.isEnabled=t.isEnabled,this.maxHistoryLength=t.maxHistoryLength,this.checksTransactionLevel=t.checksTransactionLevel},T=Tr.prototype,T.Xw=function(t){this.Pt.add(t)},T.Rx=function(t){this.Pt.remove(t)},T.Ea=function(t){if(t===void 0&&(t=""),t===null&&(t=""),this.isUndoingRedoing)return!1;this.tt===!0&&(this.tt=!1,this.bi++,this.isInternalTransaction||this.Ob("StartingFirstTransaction",t,this.currentTransaction),0<this.bi&&this.bi--),this.isEnabled&&(this.Ie.ka(),this.Ie.add(t),this.Ie.freeze(),this.currentTransaction===null?this.hl.add(0):this.hl.add(this.currentTransaction.changes.count)),this.bi++;var e=this.transactionLevel===1;return e&&(this.isInternalTransaction||this.Ob("StartedTransaction",t,this.currentTransaction)),e},T.eb=function(t){return t===void 0&&(t=""),ic(this,!0,t)},T.Kf=function(){return ic(this,!1,"")};function ic(t,e,i){if(t.isUndoingRedoing)return!1;t.checksTransactionLevel&&1>t.transactionLevel&&Fe("Ending transaction without having started a transaction: "+i);var n=t.transactionLevel===1,s=t.currentTransaction;n&&e&&(t.isInternalTransaction||t.Ob("CommittingTransaction",i,s));var a=0;if(0<t.transactionLevel&&(t.bi--,t.isEnabled)){var l=t.Ie.count;0<l&&(i===""&&(i=t.Ie.M(0)),t.Ie.ka(),t.Ie.mb(l-1),t.Ie.freeze()),l=t.hl.count,0<l&&(a=t.hl.M(l-1),t.hl.mb(l-1))}if(n){if(e)t.rq=!1,s===null&&i!==""&&(s=t.currentTransaction),t.isEnabled&&s!==null&&(s.isComplete||(s.isComplete=!0,s.name=i),t.lx(),e=t.history,e.ka(),n=t.maxHistoryLength,0<=n&&(n===0?e.clear():e.count>=n&&(a=e.M(0),a!==null&&a.clear(),e.mb(0),t.Ce--)),n===0||e.count!==0&&e.get(e.count-1)===s||(e.add(s),t.Ce++),e.freeze()),t.isInternalTransaction||t.Ob("CommittedTransaction",i,s);else{t.Fe=!0;try{t.isEnabled&&s!==null&&(s.isComplete=!0,s.undo())}finally{t.isInternalTransaction||t.Ob("RolledBackTransaction",i,s),t.Fe=!1}s!==null&&s.clear()}return t.Np=null,t.isPendingClear&&t.clear(),t.isPendingClear=!1,t.isPendingUnmodified=!1,!0}if(t.isEnabled&&!e&&s!==null){for(t=a,i=s.changes,s=i.count-1;s>=t;s--)e=i.M(s),e!==null&&e.undo(),i.ka(),i.mb(s);i.freeze()}return!1}T.lx=function(){if(!this.isUndoingRedoing&&this.canRedo()){var t=this.history;t.ka();for(var e=t.count-1;e>this.historyIndex;e--){var i=t.M(e);i!==null&&i.clear(),t.mb(e),this.rq=!0}t.freeze()}},Tr.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var t=this.transactionToUndo;return!!(t!==null&&t.canUndo())},Tr.prototype.undo=function(){if(this.canUndo()){var t=this.transactionToUndo;try{this.Fe=!0,this.Ob("StartingUndo","Undo",t),this.Ce--,t.undo()}catch(e){Fe("undo error: "+e.toString())}finally{this.Ob("FinishedUndo","Undo",t),this.Fe=!1}}},Tr.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var t=this.transactionToRedo;return!!(t!==null&&t.canRedo())},Tr.prototype.redo=function(){if(this.canRedo()){var t=this.transactionToRedo;try{this.Fe=!0,this.Ob("StartingRedo","Redo",t),this.Ce++,t.redo()}catch(e){Fe("redo error: "+e.toString())}finally{this.Ob("FinishedRedo","Redo",t),this.Fe=!1}}},Tr.prototype.Ob=function(t,e,i){i===void 0&&(i=null);var n=new Cr;for(n.change=wa,n.propertyName=t,n.object=i,n.oldValue=e,t=this.models;t.next();)e=t.value,n.model=e,e.ds(n)},Tr.prototype.Tu=function(t){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(t)){var e=this.currentTransaction;e===null&&(this.Np=e=new Bo);var i=t.copy();e=e.changes,e.ka(),e.add(i),e.freeze(),this.checksTransactionLevel&&0>=this.transactionLevel&&!this.tt&&(t=t.diagram,t!==null&&t.pi===!1||Fe("Change not within a transaction: "+i.toString()))}},Tr.prototype.skipsEvent=function(t){if(t===null||0>t.change.value)return!0;if(t=t.object,t===null)return!1;if(t.layer!==void 0){if(t=t.layer,t!==null&&t.isTemporary)return!0}else if(t.isTemporary)return!0;return!1},ct.Object.defineProperties(Tr.prototype,{models:{get:function(){return this.Pt.iterator}},isEnabled:{get:function(){return this.Jd},set:function(t){this.Jd=t}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.M(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndex<this.history.count-1?this.history.M(this.historyIndex+1):null}},isUndoingRedoing:{get:function(){return this.Fe}},history:{get:function(){return this.u}},maxHistoryLength:{get:function(){return this.o},set:function(t){this.o=t}},historyIndex:{get:function(){return this.Ce}},currentTransaction:{get:function(){return this.Np}},transactionLevel:{get:function(){return this.bi}},isInTransaction:{get:function(){return 0<this.bi}},checksTransactionLevel:{get:function(){return this.j},set:function(t){this.j=t}},nestedTransactionNames:{get:function(){return this.Ie}},isPendingClear:{get:function(){return this.Ft},set:function(t){this.Ft=t}},isPendingUnmodified:{get:function(){return this.Gt},set:function(t){this.Gt=t}},isInternalTransaction:{get:function(){return this.Dt},set:function(t){this.Dt=t}},isJustDiscarded:{get:function(){return this.rq}}}),Tr.prototype.handleChanged=Tr.prototype.Tu,Tr.prototype.redo=Tr.prototype.redo,Tr.prototype.undo=Tr.prototype.undo,Tr.prototype.canUndo=Tr.prototype.canUndo,Tr.prototype.discardHistoryAfterIndex=Tr.prototype.lx,Tr.prototype.rollbackTransaction=Tr.prototype.Kf,Tr.prototype.commitTransaction=Tr.prototype.eb,Tr.prototype.startTransaction=Tr.prototype.Ea,Tr.prototype.removeModel=Tr.prototype.Rx,Tr.prototype.addModel=Tr.prototype.Xw,Tr.prototype.clear=Tr.prototype.clear,Tr.className="UndoManager";function kn(){vi(this),this.H=fr,this.xa="",this.Jd=!0,this.nb=!1,this.wm=null,this.yy=new As,this.Zr=-1}kn.prototype.toString=function(){return this.name!==""?this.name+" Tool":Re(this.constructor)},kn.prototype.updateAdornments=function(){},kn.prototype.canStart=function(){return this.isEnabled},kn.prototype.doStart=function(){},kn.prototype.doActivate=function(){this.isActive=!0},kn.prototype.doDeactivate=function(){this.isActive=!1},kn.prototype.doStop=function(){},kn.prototype.doCancel=function(){this.transactionResult=null,this.stopTool()},kn.prototype.stopTool=function(){var t=this.diagram;t.currentTool===this&&(t.currentTool=null,t.currentCursor="")},kn.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()},kn.prototype.doMouseMove=function(){},kn.prototype.doMouseUp=function(){this.stopTool()},kn.prototype.doMouseWheel=function(){},kn.prototype.canStartMultiTouch=function(){return!0},kn.prototype.standardPinchZoomStart=function(){var t=this.diagram,e=t.lastInput,i=e.So(0,z.allocAt(NaN,NaN)),n=e.So(1,z.allocAt(NaN,NaN));if(i.w()&&n.w()&&(this.doCancel(),t.Ql("hasGestureZoom"))){t.Bw=t.scale;var s=n.x-i.x,a=n.y-i.y;t.Jw=Math.sqrt(s*s+a*a),e.bubbles=!1}z.free(i),z.free(n)},kn.prototype.standardPinchZoomMove=function(){var t=this.diagram,e=t.lastInput,i=e.So(0,z.allocAt(NaN,NaN)),n=e.So(1,z.allocAt(NaN,NaN));if(i.w()&&n.w()&&(this.doCancel(),t.Ql("hasGestureZoom"))){var s=n.x-i.x,a=n.y-i.y;a=Math.sqrt(s*s+a*a)/t.Jw,s=new z((Math.min(n.x,i.x)+Math.max(n.x,i.x))/2,(Math.min(n.y,i.y)+Math.max(n.y,i.y))/2),a*=t.Bw;var l=t.commandHandler;if(a!==t.scale&&l.canResetZoom(a)){var c=t.zoomPoint;t.zoomPoint=s,l.resetZoom(a),t.zoomPoint=c}e.bubbles=!1}z.free(i),z.free(n)},kn.prototype.doKeyDown=function(){this.diagram.lastInput.key==="Esc"&&this.doCancel()},kn.prototype.doKeyUp=function(){},kn.prototype.Ea=function(t){return t===void 0&&(t=this.name),this.transactionResult=null,this.diagram.Ea(t)},kn.prototype.stopTransaction=function(){var t=this.diagram;return this.transactionResult===null?t.Kf():t.eb(this.transactionResult)},kn.prototype.standardMouseSelect=function(){var t=this.diagram;if(t.allowSelect){var e=t.lastInput,i=t.Ol(e.documentPoint,!1);if(i!==null){if(re?e.meta:e.control){for(t.R("ChangingSelection",t.selection),e=i;e!==null&&!e.canSelect();)e=e.containingGroup;e!==null&&(e.isSelected=!e.isSelected),t.R("ChangedSelection",t.selection)}else if(e.shift){if(!i.isSelected){for(t.R("ChangingSelection",t.selection),e=i;e!==null&&!e.canSelect();)e=e.containingGroup;e!==null&&(e.isSelected=!0),t.R("ChangedSelection",t.selection)}}else if(!i.isSelected){for(e=i;e!==null&&!e.canSelect();)e=e.containingGroup;e!==null&&t.select(e)}}else!e.left||(re?e.meta:e.control)||e.shift||t.clearSelection()}},kn.prototype.standardMouseClick=function(t,e){t===void 0&&(t=null),e===void 0&&(e=function(s){return!s.layer.isTemporary});var i=this.diagram,n=i.lastInput;return t=i.ic(n.documentPoint,t,e),n.targetObject=t,K0(t,n,i),n.handled};function K0(t,e,i){if(e.handled=!1,t===null||t.If()){var n=0;e.left?n=e.clickCount===1?1:e.clickCount===2?2:1:e.right&&e.clickCount===1&&(n=3);var s="ObjectSingleClicked";if(t!==null){switch(n){case 1:s="ObjectSingleClicked";break;case 2:s="ObjectDoubleClicked";break;case 3:s="ObjectContextClicked"}n!==0&&i.R(s,t)}else{switch(n){case 1:s="BackgroundSingleClicked";break;case 2:s="BackgroundDoubleClicked";break;case 3:s="BackgroundContextClicked"}n!==0&&i.R(s)}if(t!==null)for(;t!==null;){switch(i=null,n){case 1:i=t.click;break;case 2:i=t.doubleClick?t.doubleClick:t.click;break;case 3:i=t.contextClick}if(i!==null&&(i(e,t),e.handled))break;t=t.panel}else{switch(t=null,n){case 1:t=i.click;break;case 2:t=i.doubleClick?i.doubleClick:i.click;break;case 3:t=i.contextClick}t!==null&&t(e)}}}kn.prototype.standardMouseOver=function(){var t=this.diagram,e=t.lastInput;if(t.animationManager.zb!==!0){var i=t.skipsUndoManager;t.skipsUndoManager=!0;var n=t.viewportBounds.ca(e.documentPoint)?t.ic(e.documentPoint,null,null):null;!e.event||e.event.type!=="pointercancel"&&e.event.type!=="pointerout"||(n=null),e.targetObject=n;var s=!1;if(n!==t.Ck){var a=t.Ck,l=a;for(t.Ck=n,this.doCurrentObjectChanged(a,n),e.handled=!1;a!==null;){var c=a.mouseLeave;if(c!==null&&(n===a||n!==null&&n.rg(a)||(c(e,a,n),s=!0,e.handled)))break;a=a.panel}for(a=l,e.handled=!1;n!==null&&(l=n.mouseEnter,!(l!==null&&(a===n||a!==null&&a.rg(n)||(l(e,n,a),s=!0,e.handled))));)n=n.panel;n=t.Ck}if(n!==null){for(a=n,l="";a!==null&&(l=a.cursor,l==="");)a=a.panel;for(t.currentCursor=l,e.handled=!1,a=n;a!==null&&(n=a.mouseOver,!(n!==null&&(n(e,a),s=!0,e.handled)));)a=a.panel}else this.doUpdateCursor(null),n=t.mouseOver,n!==null&&(n(e),s=!0);s&&t.$b(),t.skipsUndoManager=i}},kn.prototype.doUpdateCursor=function(){var t=this.diagram;t&&(t.currentCursor="")},kn.prototype.doCurrentObjectChanged=function(){},kn.prototype.standardMouseWheel=function(){var t=this.diagram,e=t.lastInput,i=e.delta;if(i!==0&&t.documentBounds.w()){var n=t.commandHandler,s=t.toolManager.mouseWheelBehavior;if(n!==null&&(s===Ld&&!e.shift||s===Fl&&e.control))(0<i?n.canIncreaseZoom():n.canDecreaseZoom())&&(s=t.zoomPoint,t.zoomPoint=e.viewPoint,0<i?n.increaseZoom():n.decreaseZoom(),t.zoomPoint=s),e.bubbles=!1;else if(s===Ld&&e.shift||s===Fl&&!e.control){n=t.position.copy();var a=e.event;s=a.deltaMode;var l=a.deltaX;a=a.deltaY;var c="pixel";if(l===0&&a===0||e.shift)!e.shift&&t.allowVerticalScroll?(i=3*i*t.scrollVerticalLineChange,t.scroll(c,0<i?"up":"down",Math.abs(i))):e.shift&&t.allowHorizontalScroll&&(i=3*i*t.scrollHorizontalLineChange,t.scroll(c,0<i?"left":"right",Math.abs(i)));else{switch(s){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page"}l!==0&&t.allowHorizontalScroll&&(l*=t.scrollHorizontalLineChange/16,t.scroll(c,0<l?"right":"left",Math.abs(l))),a!==0&&t.allowVerticalScroll&&(a*=t.scrollVerticalLineChange/16,t.scroll(c,0<a?"down":"up",Math.abs(a)))}this.doWheelChange(t,n,e)}}},kn.prototype.doWheelChange=function(t,e,i){t.position.D(e)&&i.event.wheelDeltaX===0||(i.bubbles=!1)},kn.prototype.standardWaitAfter=function(t,e){e===void 0&&(e=this.diagram.lastInput),this.cancelWaitAfter();var i=this,n=e.clone(this.yy);this.Zr=ge(function(){i.doWaitAfter(n)},t)},kn.prototype.cancelWaitAfter=function(){this.Zr!==-1&&Z.clearTimeout(this.Zr),this.Zr=-1},kn.prototype.doWaitAfter=function(){},kn.prototype.findToolHandleAt=function(t,e){return t=this.diagram.ic(t,function(i){for(;i!==null&&!(i.panel instanceof Cn);)i=i.panel;return i}),t===null?null:t.part.category===e?t:null},kn.prototype.isBeyondDragSize=function(t,e){var i=this.diagram;t===void 0&&(t=i.firstInput.viewPoint),e===void 0&&(e=i.lastInput.viewPoint);var n=i.toolManager.dragSize,s=n.width;return n=n.height,i.firstInput.isTouchEvent&&(s+=6,n+=6),Math.abs(e.x-t.x)>s||Math.abs(e.y-t.y)>n},ct.Object.defineProperties(kn.prototype,{diagram:{get:function(){return this.H},set:function(t){t instanceof wt&&(this.H=t)}},name:{get:function(){return this.xa},set:function(t){this.xa=t}},isEnabled:{get:function(){return this.Jd},set:function(t){this.Jd=t}},isActive:{get:function(){return this.nb},set:function(t){this.nb=t}},transactionResult:{get:function(){return this.wm},set:function(t){this.wm=t}}}),kn.prototype.startTransaction=kn.prototype.Ea,kn.className="Tool";function Vn(){kn.call(this),this.name="ToolManager",this.hb=new Kt,this.ob=new Kt,this.Hb=new Kt,this.F=this.V=850,this.o=new ii(2,2).ja(),this.Ha=5e3,this.ia=Fl,this.u=Tf,this.Mp=this.j=null,this.zj=-1}gi(Vn,kn),Vn.prototype.initializeStandardTools=function(){},Vn.prototype.updateAdornments=function(t){var e=this.currentToolTip;if(e instanceof Cn&&this.Mp===t){var i=e.adornedObject;(t!==null?i.part===t:i===null)?this.showToolTip(e,i):this.hideToolTip()}},Vn.prototype.doMouseDown=function(){var t=this.diagram,e=t.lastInput;if(e.isTouchEvent&&this.gestureBehavior===Ku&&(e.bubbles=!1),e.isMultiTouch){if(this.cancelWaitAfter(),this.gestureBehavior===Mh){e.bubbles=!0;return}if(this.gestureBehavior===Ku)return;if(t.currentTool.canStartMultiTouch()){t.currentTool.standardPinchZoomStart();return}}for(var i=this.mouseDownTools.length,n=0;n<i;n++){var s=this.mouseDownTools.M(n);if(s.diagram=this.diagram,s.canStart()){t.doFocus(),t.currentTool=s,t.currentTool===s&&(s.isActive||s.doActivate(),s.doMouseDown());return}}t.lastInput.button===1&&(this.mouseWheelBehavior===Fl?this.mouseWheelBehavior=Ld:this.mouseWheelBehavior===Ld&&(this.mouseWheelBehavior=Fl)),this.doActivate(),this.standardWaitAfter(this.holdDelay,e)},Vn.prototype.doMouseMove=function(){var t=this.diagram,e=t.lastInput;if(e.isMultiTouch){if(this.gestureBehavior===Mh){e.bubbles=!0;return}if(this.gestureBehavior===Ku)return;if(t.currentTool.canStartMultiTouch()){t.currentTool.standardPinchZoomMove();return}}if(this.isActive)for(var i=this.mouseMoveTools.length,n=0;n<i;n++){var s=this.mouseMoveTools.M(n);if(s.diagram=this.diagram,s.canStart()){t.doFocus(),t.currentTool=s,t.currentTool===s&&(s.isActive||s.doActivate(),s.doMouseMove());return}}$u(this,t),t=e.event,t===null||t.type!=="pointermove"&&t.cancelable||(e.bubbles=!0)};function $u(t,e){t.standardMouseOver(),t.isBeyondDragSize()&&t.standardWaitAfter(t.isActive?t.holdDelay:t.hoverDelay,e.lastInput)}Vn.prototype.doCurrentObjectChanged=function(t,e){t=this.currentToolTip,t===null||e!==null&&t instanceof Cn&&(e===t||e.rg(t))||this.hideToolTip()},Vn.prototype.doWaitAfter=function(t){var e=this.diagram;e.ta!==null&&(this.doMouseHover(),this.isActive||this.doToolTip(),t.isTouchEvent&&!e.lastInput.handled&&(t=t.copy(),t.button=2,t.buttons=2,e.lastInput=t,e.qu=!0,e.doMouseUp()))},Vn.prototype.doMouseHover=function(){var t=this.diagram,e=t.lastInput;e.targetObject===null&&(e.targetObject=t.ic(e.documentPoint,null,null));var i=e.targetObject;if(i!==null)for(e.handled=!1;i!==null&&(t=this.isActive?i.mouseHold:i.mouseHover,!(t!==null&&(t(e,i),e.handled)));)i=i.panel;else i=this.isActive?t.mouseHold:t.mouseHover,i!==null&&i(e)},Vn.prototype.doToolTip=function(){var t=this.diagram,e=t.lastInput;if(e.targetObject===null&&(e.targetObject=t.ic(e.documentPoint,null,null)),e=e.targetObject,e!==null){if(t=this.currentToolTip,!(t instanceof Cn)||e!==t&&!e.rg(t)){for(;e!==null;){if(t=e.toolTip,t!==null){this.showToolTip(t,e);return}e=e.panel}this.hideToolTip()}}else e=t.toolTip,e!==null?this.showToolTip(e,null):this.hideToolTip()},Vn.prototype.showToolTip=function(t,e){var i=this.diagram;if(t!==this.currentToolTip&&this.hideToolTip(),t instanceof Cn){t.layerName="Tool",t.selectable=!1,t.scale=1/i.scale,t.category="ToolTip",t.placeholder!==null&&(t.placeholder.scale=i.scale);var n=t.diagram;n!==null&&n!==i&&n.remove(t),i.add(t),e!==null?t.adornedObject=e:t.data=i.model,t.Va(),this.positionToolTip(t,e)}else t instanceof Ua&&t!==this.currentToolTip&&t.show(e,i,this);if(this.currentToolTip=t,this.zj!==-1&&(Z.clearTimeout(this.zj),this.zj=-1),t=this.toolTipDuration,0<t&&t!==1/0){var s=this;this.zj=ge(function(){s.hideToolTip()},t)}},Vn.prototype.positionToolTip=function(t){if(t.placeholder===null){var e=this.diagram,i=e.lastInput.documentPoint.copy(),n=t.measuredBounds,s=e.viewportBounds;e.lastInput.isTouchEvent&&(i.x-=n.width),i.x+n.width>s.right&&(i.x-=n.width+5/e.scale),i.x<s.x&&(i.x=s.x),i.y=i.y+20/e.scale+n.height>s.bottom?i.y-(n.height+5/e.scale):i.y+20/e.scale,i.y<s.y&&(i.y=s.y),t.position=i}},Vn.prototype.hideToolTip=function(){this.zj!==-1&&(Z.clearTimeout(this.zj),this.zj=-1);var t=this.diagram,e=this.currentToolTip;e!==null&&(e instanceof Cn?(t.remove(e),this.Mp!==null&&this.Mp.Jf(e.category),e.data=null,e.adornedObject=null):e instanceof Ua&&e.hide!==null&&e.hide(t,this),this.currentToolTip=null)},Vn.prototype.doMouseUp=function(){this.cancelWaitAfter();var t=this.diagram;if(this.isActive)for(var e=this.mouseUpTools.length,i=0;i<e;i++){var n=this.mouseUpTools.M(i);if(n.diagram=this.diagram,n.canStart()){t.doFocus(),t.currentTool=n,t.currentTool===n&&(n.isActive||n.doActivate(),n.doMouseUp());return}}t.doFocus(),this.doDeactivate()},Vn.prototype.doMouseWheel=function(){this.standardMouseWheel()},Vn.prototype.doKeyDown=function(){var t=this.diagram;t.commandHandler!==null&&t.commandHandler.doKeyDown()},Vn.prototype.doKeyUp=function(){var t=this.diagram;t.commandHandler!==null&&t.commandHandler.doKeyUp()},Vn.prototype.findTool=function(t){for(var e=this.mouseDownTools.length,i=0;i<e;i++){var n=this.mouseDownTools.M(i);if(n.name===t)return n}for(e=this.mouseMoveTools.length,i=0;i<e;i++)if(n=this.mouseMoveTools.M(i),n.name===t)return n;for(e=this.mouseUpTools.length,i=0;i<e;i++)if(n=this.mouseUpTools.M(i),n.name===t)return n;return null},Vn.prototype.replaceTool=function(t,e){e!==null&&(e.diagram=this.diagram);for(var i=this.mouseDownTools.length,n=0;n<i;n++){var s=this.mouseDownTools.M(n);if(s.name===t)return e!==null?this.mouseDownTools.cd(n,e):this.mouseDownTools.mb(n),s}for(i=this.mouseMoveTools.length,n=0;n<i;n++)if(s=this.mouseMoveTools.M(n),s.name===t)return e!==null?this.mouseMoveTools.cd(n,e):this.mouseMoveTools.mb(n),s;for(i=this.mouseUpTools.length,n=0;n<i;n++)if(s=this.mouseUpTools.M(n),s.name===t)return e!==null?this.mouseUpTools.cd(n,e):this.mouseUpTools.mb(n),s;return null},Vn.prototype.gb=function(t,e,i){e!==null&&(e.name=t,e.diagram=this.diagram),this.findTool(t)?this.replaceTool(t,e):e!==null&&i.add(e)},ct.Object.defineProperties(Vn.prototype,{mouseWheelBehavior:{get:function(){return this.ia},set:function(t){this.ia=t}},gestureBehavior:{get:function(){return this.u},set:function(t){this.u=t}},currentToolTip:{get:function(){return this.j},set:function(t){this.j=t,this.Mp=t!==null&&t instanceof Cn?t.adornedPart:null}},mouseDownTools:{get:function(){return this.hb}},mouseMoveTools:{get:function(){return this.ob}},mouseUpTools:{get:function(){return this.Hb}},hoverDelay:{get:function(){return this.V},set:function(t){this.V=t}},holdDelay:{get:function(){return this.F},set:function(t){this.F=t}},dragSize:{get:function(){return this.o},set:function(t){this.o=t.J()}},toolTipDuration:{get:function(){return this.Ha},set:function(t){this.Ha=t}}}),Vn.prototype.replaceStandardTool=Vn.prototype.gb;var Fl=new mt(Vn,"WheelScroll",0),Ld=new mt(Vn,"WheelZoom",1),_f=new mt(Vn,"WheelNone",2),Tf=new mt(Vn,"GestureZoom",3),Ku=new mt(Vn,"GestureCancel",4),Mh=new mt(Vn,"GestureNone",5);Vn.className="ToolManager",Vn.WheelScroll=Fl,Vn.WheelZoom=Ld,Vn.WheelNone=_f,Vn.GestureZoom=Tf,Vn.GestureCancel=Ku,Vn.GestureNone=Mh;function Pr(){kn.call(this),this.name="Dragging",this.u=this.Sw=this.ob=!0,this.o=this.Ha=this.V=this.Oe=null,this.Ym=this.Hb=!1,this.tl=new z(NaN,NaN),this.Fr=new z,this.hb=!0,this.Ik=100,this.Cg=[],this.te=new At().freeze(),this.ia=new p,this.Bn=null,this.F="copy",this.Oc="",this.Pc="no-drop"}var bu;gi(Pr,kn),Pr.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;if(t.isReadOnly&&!t.allowDragOut||!t.allowMove&&!t.allowCopy&&!t.allowDragOut||!t.allowSelect)return!1;var e=t.lastInput;return!e.left||t.currentTool!==this&&(!this.isBeyondDragSize()||e.isTouchEvent&&e.timestamp-t.firstInput.timestamp<this.Ik)?!1:this.findDraggablePart()!==null},Pr.prototype.findDraggablePart=function(){var t=this.diagram;if(t=t.Ol(t.firstInput.documentPoint,!1),t===null)return null;for(;t!==null&&!t.canSelect();)t=t.containingGroup;return t!==null&&(t.canMove()||t.canCopy())?t:null},Pr.prototype.standardMouseSelect=function(){var t=this.diagram;if(t.allowSelect){var e=t.Ol(t.firstInput.documentPoint,!1);if(e!==null){for(;e!==null&&!e.canSelect();)e=e.containingGroup;this.currentPart=e,this.currentPart===null||this.currentPart.isSelected||(t.R("ChangingSelection",t.selection),e=t.lastInput,(re?e.meta:e.control)||e.shift||t.clearSelection(!0),this.currentPart.isSelected=!0,t.R("ChangedSelection",t.selection))}}},Pr.prototype.doActivate=function(){var t=this.diagram;this.Bn=null,this.currentPart===null&&this.standardMouseSelect();var e=this.currentPart;e!==null&&(e.canMove()||e.canCopy())&&(t.Fu(!0),Xo=null,this.isActive=!0,this.tl.set(t.position),Pf(this,t.selection),this.Cg.length=0,t.animationManager.Cc(),this.draggedParts=this.computeEffectiveCollection(t.selection,this.dragOptions),this.Sw=this.diagram.layout.isRealtime,this.diagram.layout.isRealtime=!1,t.Ns=!0,t.Gf("temporaryPixelRatio")===!0&&30<t.$w&&os(t),Rh(t,this.draggedParts),this.Ea("Drag"),this.startPoint=t.firstInput.documentPoint,t.isMouseCaptured=!0,t.allowDragOut&&(this.isDragOutStarted=!0,this.Ym=!1,Xo=this,kh=this.diagram,this.doSimulatedDragOut()))};function Pf(t,e){if(t.dragsLink){var i=t.diagram;i.allowRelink&&(i.model.Wj()&&e.count===1&&e.first()instanceof ue?(t.draggedLink=e.first(),t.draggedLink.canRelinkFrom()&&t.draggedLink.canRelinkTo()&&t.draggedLink.Ej(),t.Oe=i.toolManager.findTool("Relinking"),t.Oe===null&&(t.Oe=new Fa,t.Oe.diagram=i),t.Oe.originalLink=t.draggedLink):(t.draggedLink=null,t.Oe=null))}}Pr.prototype.computeEffectiveCollection=function(t,e){return this.diagram.commandHandler.computeEffectiveCollection(t,e)},Pr.prototype.Pd=function(t){return t===void 0?new Ra(fn):this.isGridSnapEnabled?new Ra(new z(Math.round(1e3*t.x)/1e3,Math.round(1e3*t.y)/1e3)):new Ra(t.copy())},Pr.prototype.doDeactivate=function(){this.isActive=!1;var t=this.diagram;if(this.diagram.layout.isRealtime=this.Sw,t.Fu(!1),t.ug(),Hu(this),Kl(t,this.draggedParts),this.draggedParts=this.currentPart=this.Bn=null,this.Ym=this.isDragOutStarted=!1,0<bu.count){for(var e=bu,i=e.length,n=0;n<i;n++){var s=e.M(n);Wu(s),ul(s),Hu(s),s.diagram.ug()}e.clear()}Wu(this),this.tl.h(NaN,NaN),kh!==null&&(kh.currentCursor=""),Xo=kh=null,ul(this),t.isMouseCaptured=!1,t.currentCursor="",t.Ns=!1,this.stopTransaction(),Nd(t,!0)},Pr.prototype.stopTransaction=function(){var t=this.diagram,e=kn.prototype.stopTransaction.call(this);return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.ak(),e};function Hu(t){var e=t.diagram,i=e.skipsUndoManager;e.skipsUndoManager=!0,Op(t,e.lastInput,null),e.skipsUndoManager=i,t.Cg.length=0}function Ip(){var t=Xo;ul(t),Uu(t);var e=t.diagram;t.tl.w()&&(e.position=t.tl),e.ug()}Pr.prototype.doCancel=function(){ul(this),Uu(this);var t=this.diagram;this.tl.w()&&(t.position=this.tl),this.stopTool()},Pr.prototype.doKeyDown=function(){var t=this.diagram,e=t.lastInput;this.isActive&&(e.key==="Esc"?this.doCancel():e.key!==t.previousInput.key&&this.doMouseMove())},Pr.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};function Vu(t,e){if(t.copiedParts===null){var i=t.diagram;if((!e||!i.isReadOnly&&!i.isModelReadOnly)&&t.draggedParts!==null){var n=i.undoManager;for(n.isEnabled&&n.isInTransaction?n.currentTransaction!==null&&0<n.currentTransaction.changes.count&&(i.undoManager.Kf(),i.Ea("Drag")):Uu(t),i.skipsUndoManager=!e,i.partManager.addsToTemporaryLayer=!e,t.startPoint=i.firstInput.documentPoint,e=t.copiesEffectiveCollection?t.draggedParts.Lf():i.selection,e=i.Kj(e,i,!0),i=new pe,n=t.draggedParts.iterator;n.next();){var s=n.key;if(s.Zc()&&s.canCopy()){var a=e.I(s);a!==null&&(a.location=s.location,a.Va(),i.add(a,t.Pd(a.location)))}}for(e=e.iterator;e.next();)n=e.value,n instanceof ue&&n.canCopy()&&i.add(n,t.Pd());t.copiedParts=i,Pf(t,i.Lf()),t.draggedLink!==null&&(i=t.draggedLink,e=i.routeBounds,kc(i,t.startPoint.x-(e.x+e.width/2),t.startPoint.y-(e.y+e.height/2))),t.doUpdateCursor(null)}}}function ul(t){var e=t.diagram;if(t.copiedParts!==null){if(e.Is(t.copiedParts.Lf(),!1),t.copiedParts=null,t.draggedParts!==null)for(var i=t.draggedParts.iterator;i.next();)i.key instanceof ue&&(i.value.point=new z(0,0));t.doUpdateCursor(null)}e.skipsUndoManager=!1,e.partManager.addsToTemporaryLayer=!1,t.startPoint=e.firstInput.documentPoint}function Wu(t){if(t.draggedLink!==null){if(t.dragsLink&&t.Oe!==null){var e=t.Oe;e.diagram.remove(e.temporaryFromNode),e.diagram.remove(e.temporaryToNode),t.Oe.originalLink=null}t.draggedLink=null,t.Oe=null}}function Js(t,e,i){var n=t.diagram,s=t.startPoint,a=z.alloc();a.assign(n.lastInput.documentPoint),t.moveParts(e,a.re(s),i),z.free(a),n.Gf("temporaryPixelRatio")===!0&&n.Yh===null&&30<n.$w&&(os(n),n.hk())}Pr.prototype.moveParts=function(t,e,i){i===void 0&&(i=!1);var n=this.diagram;n!==null&&vc(n,t,e,this.dragOptions,i)};function Uu(t){if(t.draggedParts!==null){for(var e=t.diagram,i=t.draggedParts.iterator;i.next();){var n=i.key;n.Zc()&&(n.location=i.value.point)}for(i=t.draggedParts.iterator;i.next();)if(n=i.key,n instanceof ue&&n.suspendsRouting){var s=i.value.point;t.draggedParts.add(n,t.Pd()),kc(n,-s.x,-s.y)}e.bd()}}function Ed(t,e){var i=t.diagram;t.dragsLink&&(t.draggedLink!==null&&(t.draggedLink.fromNode=null,t.draggedLink.toNode=null),Ch(t,!1));var n=t.findDragOverObject(e),s=i.lastInput;s.targetObject=n,t.doUpdateCursor(n);var a=i.skipsUndoManager,l=!1;try{if(i.skipsUndoManager=!0,l=Op(t,s,n),!t.isActive&&Xo===null)return;var c=n!==null?n.part:null;if(c===null||i.handlesDragDropForTopLevelParts&&c.isTopLevel&&!(c instanceof ji)){var f=i.mouseDragOver;f!==null&&(f(s),l=!0)}if(!t.isActive&&Xo===null||(t.doDragOver(e,n),!t.isActive&&Xo===null))return}finally{i.skipsUndoManager=a,l&&i.bd()}t.Bn=n,i.isReadOnly||!i.allowMove&&!i.allowCopy||!i.allowHorizontalScroll&&!i.allowVerticalScroll||i.gs(s.viewPoint)}Pr.prototype.findDragOverObject=function(t){var e=this;return jl(this.diagram,t,null,function(i){return i===null?i=!0:(i=i.part,i=!!(i===null||i instanceof Cn||i.layer.isTemporary||e.draggedParts&&e.draggedParts.contains(i)||e.copiedParts&&e.copiedParts.contains(i))),!i})},Pr.prototype.doUpdateCursor=function(t){var e=this.diagram;(t===null||this.Bn!==t)&&(!this.diagram.currentTool.isActive||this.mayCopy()?e.currentCursor=this.copyCursor:this.mayMove()?e.currentCursor=this.moveCursor:this.mayDragOut()&&(e.currentCursor=this.nodropCursor))};function Op(t,e,i){var n=!1,s=t.Cg.length,a=0<s?t.Cg[0]:null;if(i===a)return!1;e.handled=!1;for(var l=0;l<s;l++){var c=t.Cg[l],f=c.mouseDragLeave;if(f!==null&&(f(e,c,i),n=!0,e.handled))break}if(t.Cg.length=0,!t.isActive&&Xo===null||i===null)return n;for(e.handled=!1,s=i;s!==null;)t.Cg.push(s),s=Bp(s);for(s=t.Cg.length,i=0;i<s&&(l=t.Cg[i],c=l.mouseDragEnter,c===null||(c(e,l,a),n=!0,!e.handled));i++);return n}function Bp(t){var e=t.panel;return e!==null?e:t instanceof ui&&!(t instanceof ji)&&(t=t.containingGroup,t!==null&&t.handlesDragDropForMembers)?t:null}function H0(t,e,i){var n=t.Oe;if(n===null)return null;var s=t.diagram.og(e,n.portGravity,function(m){return n.findValidLinkablePort(m,i)});t=z.alloc();var a=1/0,l=null;for(s=s.iterator;s.next();){var c=s.value;if(c.part!==null){var f=c.ga(on,t);f=e.Bf(f),f<a&&(l=c,a=f)}}return z.free(t),l}function Ch(t,e){var i=t.draggedLink;if(i!==null&&!(2>i.pointsCount)){var n=t.diagram;if(!n.isReadOnly){var s=t.Oe;if(s!==null){var a=null,l=null;i.fromNode===null&&(a=H0(t,i.i(0),!1),a!==null&&(l=a.part));var c=null,f=null;i.toNode===null&&(c=H0(t,i.i(i.pointsCount-1),!0),c!==null&&(f=c.part)),s.isValidLink(l,a,f,c)?e?(i.defaultFromPoint=i.i(0),i.defaultToPoint=i.i(i.pointsCount-1),i.suspendsRouting=!1,i.fromNode=l,a!==null&&(i.fromPortId=a.portId),i.toNode=f,c!==null&&(i.toPortId=c.portId),i.fromPort!==n.Mx&&n.R("LinkRelinked",i,n.Mx),i.toPort!==n.Nx&&n.R("LinkRelinked",i,n.Nx)):Nf(s,l,a,f,c):Nf(s,null,null,null,null)}}}}Pr.prototype.doDragOver=function(){};function Zu(t,e){var i=t.diagram;t.dragsLink&&Ch(t,!0),Hu(t);var n=t.findDragOverObject(e),s=i.lastInput;if(s.targetObject=n,n!==null){s.handled=!1;for(var a=n;a!==null;){var l=a.mouseDrop;if(l!==null&&(l(s,a),s.handled))break;dg(t,s,a),a=Bp(a)}}else a=i.mouseDrop,a!==null&&a(s);if(t.isActive||Xo!==null){for(s=(t.copiedParts||t.draggedParts).iterator;s.next();)a=s.key,a instanceof Le&&a.linksConnected.each(function(c){c.suspendsRouting=!1});if(t.doDropOnto(e,n),t.isActive||Xo!==null){for(t=It.alloc(),e=i.selection.iterator;e.next();)n=e.value,n instanceof Le&&fg(i,n,t);It.free(t)}}}function dg(t,e,i){t=t.diagram,i=i.part,!t.handlesDragDropForTopLevelParts||!i.isTopLevel||i instanceof ji||(i=t.mouseDrop,i!==null&&i(e))}function fg(t,e,i){var n=!1;if(i=e.getAvoidableRect(i),t.viewportBounds.Re(i)&&(n=!0),t=t.Nu(i,function(s){return s.part},function(s){return s instanceof ue},!0,function(s){return s instanceof ue},n),t.count!==0)for(t=t.iterator;t.next();)i=t.value,!i.Td(e)&&i.isAvoiding&&i.bb()}Pr.prototype.doDropOnto=function(){},Pr.prototype.doMouseMove=function(){if(this.isActive){var t=this.diagram,e=t.lastInput;this.simulatedMouseMove(e.event,e.documentPoint,e.targetDiagram)||this.currentPart===null||this.draggedParts===null||(this.mayCopy()?(Vu(this,!1),Rh(t,this.copiedParts),Js(this,this.copiedParts,!1),Kl(t,this.copiedParts)):this.mayMove()?(ul(this),Js(this,this.draggedParts,!0)):this.mayDragOut()?(Vu(this,!1),Js(this,this.copiedParts,!1)):ul(this),Ed(this,t.lastInput.documentPoint))}},Pr.prototype.doMouseUp=function(){if(this.isActive){var t=this.diagram,e=t.lastInput;if(!this.simulatedMouseUp(e.event,e.documentPoint,e.targetDiagram)){e=!1;var i=this.mayCopy();if(i&&this.copiedParts!==null?(ul(this),Vu(this,!0),Rh(t,this.copiedParts),Js(this,this.copiedParts,!1),Kl(t,this.copiedParts),this.copiedParts!==null&&(t.R("ChangingSelection",t.selection),t.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(s){s.isSelected=!0}))):(e=!0,ul(this),this.mayMove()&&(Js(this,this.draggedParts,!0),Ed(this,t.lastInput.documentPoint))),this.Ym=!0,Zu(this,t.lastInput.documentPoint),this.isActive){var n=i?this.copiedParts.Lf():this.draggedParts.Lf();this.copiedParts=null,e&&pg(this),t.Ya(),Kl(t,this.draggedParts),this.transactionResult=i?"Copy":"Move",t.R(i?"SelectionCopied":"SelectionMoved",n)}this.stopTool(),i&&t.R("ChangedSelection",t.selection)}}},Pr.prototype.simulatedMouseMove=function(t,e,i){if(Xo===null)return!1;var n=Xo.diagram;i instanceof wt||(i=null);var s=kh;return i!==s&&(s!==null&&s!==n&&(s.ug(),Xo.isDragOutStarted=!1,s=s.toolManager.findTool("Dragging"),s!==null&&s.doSimulatedDragLeave()),kh=i,i!==null&&i!==n&&(Ip(),s=i.toolManager.findTool("Dragging"),s!==null&&(bu.contains(s)||bu.add(s),s.doSimulatedDragEnter())),this.doUpdateCursor(null)),i===null||i===n||!i.allowDrop||i.isReadOnly||!i.allowInsert?!1:(n=i.toolManager.findTool("Dragging"),n!==null&&(t!==null&&(t.targetTouches!==void 0&&(0<t.targetTouches.length?t=t.targetTouches[0]:0<t.changedTouches.length&&(t=t.changedTouches[0])),e=i.getMouse(t)),i.lastInput.documentPoint=e,i.lastInput.viewPoint=i.op(e),i.lastInput.down=!1,i.lastInput.up=!1,n.doSimulatedDragOver()),!0)},Pr.prototype.simulatedMouseUp=function(t,e,i){if(Xo===null)return!1;var n=kh,s=Xo.diagram;if(i===null)return Xo.doCancel(),!0;if(i!==n){var a=n.toolManager.findTool("Dragging");if(n!==null&&n!==s&&a!==null)return n.ug(),Xo.isDragOutStarted=!1,a.doSimulatedDragLeave(),!1;kh=i,n=i.toolManager.findTool("Dragging"),n!==null&&(Ip(),bu.contains(n)||bu.add(n),n.doSimulatedDragEnter())}return i!==this.diagram?(t!==null?(t.targetTouches!==void 0&&(0<t.targetTouches.length?t=t.targetTouches[0]:0<t.changedTouches.length&&(t=t.changedTouches[0])),e=i.getMouse(t)):e===null&&(e=new z),i.lastInput.documentPoint=e,i.lastInput.viewPoint=i.op(e),i.lastInput.down=!1,i.lastInput.up=!0,t=i.toolManager.findTool("Dragging"),t!==null&&t.doSimulatedDrop(),t=Xo,t!==null&&(i=t.mayCopy(),t.transactionResult=i?"Copy":"Move",t.stopTool()),!0):!1};function pg(t){if(t.draggedParts!==null)for(var e=t.draggedParts.iterator;e.next();){var i=e.key;i instanceof Le&&(i=i.containingGroup,i===null||i.placeholder===null||t.draggedParts.contains(i)||i.placeholder.v())}}Pr.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowCopy||(re?!t.lastInput.alt:!t.lastInput.control))return!1;for(t=t.selection.iterator;t.next();)if(t.value.canCopy())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canCopy())},Pr.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var t=this.diagram;if(!t.allowDragOut||!t.allowCopy||t.allowMove)return!1;for(t=t.selection.iterator;t.next();)if(t.value.canCopy())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canCopy())},Pr.prototype.mayMove=function(){var t=this.diagram;if(t.isReadOnly||!t.allowMove)return!1;for(t=t.selection.iterator;t.next();)if(t.value.canMove())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canMove())},Pr.prototype.computeBorder=function(t,e,i){return this.Ym||this.draggedParts===null||this.draggedParts.contains(t)?null:i.assign(e)},Pr.prototype.Az=function(){return Xo},Pr.prototype.mayDragIn=function(){var t=this.diagram;if(!t.allowDrop||t.isReadOnly||t.isModelReadOnly||!t.allowInsert)return!1;var e=Xo;return!(e===null||e.diagram.model.dataFormat!==t.model.dataFormat)},Pr.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var t=this.diagram;t.animationManager.Cc(),Vs(t),t.animationManager.Cc(),t=Xo,t!==null&&(t.diagram.Ns=!1),this.doUpdateCursor(null)}},Pr.prototype.doSimulatedDragLeave=function(){var t=Xo;t!==null&&t.doSimulatedDragOut(),this.doCancel()},Pr.prototype.doSimulatedDragOver=function(){var t=this.diagram;t.animationManager.Dm=!0;var e=Xo;if(e!==null&&e.draggedParts!==null){if(!this.mayDragIn())return;V0(this,e.draggedParts.Lf(),!1,t.firstInput),Js(this,this.copiedParts,!1),Ed(this,t.lastInput.documentPoint)}t.animationManager.Dm=!1},Pr.prototype.doSimulatedDrop=function(){var t=this.diagram,e=Xo;if(e!==null){var i=e.diagram;if(e.Ym=!0,ul(this),!this.mayDragIn())return;t.animationManager.Dm=!0,t.R("ChangingSelection",t.selection),this.Ea("Drop"),V0(this,e.draggedParts.Lf(),!0,t.lastInput),Js(this,this.copiedParts,!1);var n=new At;this.copiedParts!==null&&(t.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(s){s.isSelected=!0,n.add(s)})),Zu(this,t.lastInput.documentPoint),t.Ya(),this.copiedParts!==null&&(this.transactionResult="ExternalCopy"),this.copiedParts=null,t.doFocus(),t.R("ExternalObjectsDropped",n,i),this.stopTransaction(),t.R("ChangedSelection",t.selection)}t.animationManager.Dm=!1};function V0(t,e,i,n){if(t.copiedParts===null){var s=t.diagram;if(!s.isReadOnly&&!s.isModelReadOnly){s.skipsUndoManager=!i,s.partManager.addsToTemporaryLayer=!i,t.startPoint=n.documentPoint,i=s.Kj(e,s,!0);var a=It.alloc();s=n=1/0;for(var l=-1/0,c=-1/0,f=e.iterator;f.next();){var m=f.value;if(m.isVisible()){var v=m.location;m=v.x,v=v.y,isNaN(m)||isNaN(v)||(m<n&&(n=m),v<s&&(s=v),m>l&&(l=m),v>c&&(c=v))}}for(n===1/0?a.h(0,0,0,0):a.h(n,s,l-n,c-s),n=a.x+a.width/2,s=a.y+a.height/2,It.free(a),a=t.Fr,l=new pe,c=z.alloc(),f=e.iterator;f.next();)m=f.value,m instanceof ue&&m.canCopy()&&(v=i.I(m),v!==null&&(v.points=m.points,kc(v,a.x-n,a.y-s),v.suspendsRouting=!0,l.add(v,t.Pd())));for(e=e.iterator;e.next();)m=e.value,m.Zc()&&m.canCopy()&&(f=i.I(m),f!==null&&(m=m.location,c.h(a.x-(n-m.x),a.y-(s-m.y)),f.location=c,f.Va(),l.add(f,t.Pd(c))));z.free(c),t.copiedParts=l,Pf(t,l.Lf()),t.draggedLink!==null&&(i=t.draggedLink,e=i.routeBounds,kc(i,t.startPoint.x-(e.x+e.width/2),t.startPoint.y-(e.y+e.height/2))),t.doUpdateCursor(null)}}}Pr.prototype.doSimulatedDragOut=function(){var t=this.diagram;t.Ns=!1,this.mayCopy()||this.mayMove()?t.currentCursor="":t.currentCursor=this.nodropCursor,this.Bn=null},Pr.prototype.computeMove=function(t,e,i,n){return i=this.diagram,i!==null?i.computeMove(t,e,this.dragOptions,n):new z},ct.Object.defineProperties(Pr.prototype,{isCopyEnabled:{get:function(){return this.ob},set:function(t){this.ob=t}},copiesEffectiveCollection:{get:function(){return this.u},set:function(t){this.u=t}},dragOptions:{get:function(){return this.ia},set:function(t){this.ia=t}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(t){this.dragOptions.isGridSnapEnabled=t}},isComplexRoutingRealtime:{get:function(){return this.hb},set:function(t){this.hb=t}},isGridSnapRealtime:{get:function(){return this.dragOptions.isGridSnapRealtime},set:function(t){this.dragOptions.isGridSnapRealtime=t}},gridSnapCellSize:{get:function(){return this.dragOptions.gridSnapCellSize},set:function(t){this.dragOptions.gridSnapCellSize.D(t)||(t=t.J(),this.dragOptions.gridSnapCellSize=t)}},gridSnapCellSpot:{get:function(){return this.dragOptions.gridSnapCellSpot},set:function(t){this.dragOptions.gridSnapCellSpot.D(t)||(t=t.J(),this.dragOptions.gridSnapCellSpot=t)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(t){this.dragOptions.gridSnapOrigin.D(t)||(t=t.J(),this.dragOptions.gridSnapOrigin=t)}},dragsLink:{get:function(){return this.dragOptions.dragsLink},set:function(t){this.dragOptions.dragsLink=t}},dragsTree:{get:function(){return this.dragOptions.dragsTree},set:function(t){this.dragOptions.dragsTree=t}},copyCursor:{get:function(){return this.F},set:function(t){this.F=t}},moveCursor:{get:function(){return this.Oc},set:function(t){this.Oc=t}},nodropCursor:{get:function(){return this.Pc},set:function(t){this.Pc=t}},currentPart:{get:function(){return this.V},set:function(t){this.V=t}},copiedParts:{get:function(){return this.o},set:function(t){this.o=t}},draggedParts:{get:function(){return this.Ha},set:function(t){this.Ha=t}},draggingParts:{get:function(){return this.copiedParts!==null?this.copiedParts.Lf():this.draggedParts!==null?this.draggedParts.Lf():this.te}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(t){this.diagram.draggedLink=t}},isDragOutStarted:{get:function(){return this.Hb},set:function(t){this.Hb=t}},startPoint:{get:function(){return this.Fr},set:function(t){this.Fr.D(t)||this.Fr.assign(t)}},delay:{get:function(){return this.Ik},set:function(t){this.Ik=t}}}),Pr.prototype.getDraggingSource=Pr.prototype.Az;var Xo=null,kh=null;Pr.className="DraggingTool",bu=new Kt,Wt("draggingTool",function(){return this.findTool("Dragging")},function(t){this.gb("Dragging",t,this.mouseMoveTools)}),Vn.prototype.doCancel=function(){Xo!==null&&Xo.doCancel(),kn.prototype.doCancel.call(this)};function yr(){kn.call(this),this.te=100,this.Ha=!1,this.u="pointer";var t=new ue,e=new Xi;e.isPanelMain=!0,e.stroke="blue",t.add(e),e=new Xi,e.toArrow="Standard",e.fill="blue",e.stroke="blue",t.add(e),t.layerName="Tool",this.Ci=t,t=new Le,e=new Xi,e.portId="",e.figure="Rectangle",e.fill=null,e.stroke="magenta",e.strokeWidth=2,e.desiredSize=wr,t.add(e),t.selectable=!1,t.layerName="Tool",this.Bi=t,this.j=e,t=new Le,e=new Xi,e.portId="",e.figure="Rectangle",e.fill=null,e.stroke="magenta",e.strokeWidth=2,e.desiredSize=wr,t.add(e),t.selectable=!1,t.layerName="Tool",this.Di=t,this.o=e,this.Pc=this.Oc=this.ob=this.hb=this.Hb=null,this.ia=!0,this.hy=new pe,this.Of=this.gj=this.Pf=null}gi(yr,kn),yr.prototype.doStop=function(){this.diagram.ug(),this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null,this.validPortsCache.clear(),this.targetPort=null},yr.prototype.copyPortProperties=function(t,e,i,n,s){if(t!==null&&e!==null&&i!==null&&n!==null){var a=e.Df(),l=ii.alloc();l.width=e.naturalBounds.width*a,l.height=e.naturalBounds.height*a,n.desiredSize=l,ii.free(l),s?(n.toSpot=e.toSpot,n.toEndSegmentLength=e.toEndSegmentLength):(n.fromSpot=e.fromSpot,n.fromEndSegmentLength=e.fromEndSegmentLength),i.locationSpot=on,a=z.alloc(),i.location=e.ga(on,a),z.free(a),n.angle=e.li(),this.portTargeted!==null&&this.portTargeted(t,e,i,n,s)}},yr.prototype.setNoTargetPortProperties=function(t,e,i){e!==null&&(e.desiredSize=wr,e.fromSpot=Nn,e.toSpot=Nn),t!==null&&(t.location=this.diagram.lastInput.documentPoint),this.portTargeted!==null&&this.portTargeted(null,null,t,e,i)},yr.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()},yr.prototype.doMouseMove=function(){if(this.isActive){var t=this.diagram;if(this.targetPort=this.findTargetPort(this.isForwards),this.targetPort!==null&&this.targetPort.part instanceof Le){var e=this.targetPort.part;this.isForwards?this.copyPortProperties(e,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(e,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(t.allowHorizontalScroll||t.allowVerticalScroll)&&t.gs(t.lastInput.viewPoint)}},yr.prototype.findValidLinkablePort=function(t,e){if(t===null)return null;var i=t.part;if(!(i instanceof Le))return null;for(;t!==null;){var n=e?t.toLinkable:t.fromLinkable;if(n===!0&&(t.portId!==null||t instanceof Le)&&(e?this.isValidTo(i,t):this.isValidFrom(i,t)))return t;if(n===!1)break;t=t.panel}return null},yr.prototype.findTargetPort=function(t){var e=this.diagram,i=e.lastInput.documentPoint,n=this.portGravity;0>=n&&(n=.1);var s=this,a=e.og(i,n,function(w){return s.findValidLinkablePort(w,t)},null,!0);for(n=1/0,e=null,a=a.iterator;a.next();){var l=a.value,c=l.part;if(c instanceof Le){var f=l.ga(on,z.alloc()),m=i.x-f.x,v=i.y-f.y;z.free(f),f=m*m+v*v,f<n&&(m=this.validPortsCache.I(l),m!==null?m&&(e=l,n=f):t&&this.isValidLink(this.originalFromNode,this.originalFromPort,c,l)||!t&&this.isValidLink(c,l,this.originalToNode,this.originalToPort)?(this.validPortsCache.add(l,!0),e=l,n=f):this.validPortsCache.add(l,!1))}}return e!==null&&(i=e.part,i instanceof Le&&(i.layer===null||i.layer.allowLink))?e:null},yr.prototype.isValidFrom=function(t,e){if(t===null||e===null)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(t.layer!==null&&!t.layer.allowLink||e.fromLinkable!==!0))return!1;var i=e.fromMaxLinks;if(1/0>i){if(this.originalLink!==null&&t===this.originalFromNode&&e===this.originalFromPort)return!0;if(e=e.portId,e===null&&(e=""),t.Mo(e).count>=i)return!1}return!0},yr.prototype.isValidTo=function(t,e){if(t===null||e===null)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(t.layer!==null&&!t.layer.allowLink||e.toLinkable!==!0))return!1;var i=e.toMaxLinks;if(1/0>i){if(this.originalLink!==null&&t===this.originalToNode&&e===this.originalToPort)return!0;if(e=e.portId,e===null&&(e=""),t.Sd(e).count>=i)return!1}return!0},yr.prototype.isInSameNode=function(t,e){return t===null||e===null?!1:t===e?!0:(t=t.part,e=e.part,t!==null&&t===e)},yr.prototype.isLinked=function(t,e){if(t===null||e===null)return!1;var i=t.part;if(!(i instanceof Le))return!1;t=t.portId,t===null&&(t="");var n=e.part;if(!(n instanceof Le))return!1;for(e=e.portId,e===null&&(e=""),e=n.Sd(e);e.next();)if(n=e.value,n.fromNode===i&&n.fromPortId===t)return!0;return!1},yr.prototype.isValidLink=function(t,e,i,n){if(!this.isValidFrom(t,e)||!this.isValidTo(i,n)||!(e===null||n===null||(e.fromLinkableSelfNode&&n.toLinkableSelfNode||!this.isInSameNode(e,n))&&(e.fromLinkableDuplicates&&n.toLinkableDuplicates||!this.isLinked(e,n)))||this.originalLink!==null&&(t!==null&&this.isLabelDependentOnLink(t,this.originalLink)||i!==null&&this.isLabelDependentOnLink(i,this.originalLink))||t!==null&&i!==null&&(t.data===null&&i.data!==null||t.data!==null&&i.data===null)||!this.isValidCycle(t,i,this.originalLink))return!1;if(t!==null){var s=t.linkValidation;if(s!==null&&!s(t,e,i,n,this.originalLink))return!1}return i!==null&&(s=i.linkValidation,s!==null&&!s(t,e,i,n,this.originalLink))?!1:(s=this.linkValidation,s!==null?s(t,e,i,n,this.originalLink):!0)},yr.prototype.isLabelDependentOnLink=function(t,e){if(t===null)return!1;var i=t.labeledLink;if(i===null)return!1;if(i===e)return!0;var n=new At;return n.add(t),ks(this,i,e,n)};function ks(t,e,i,n){if(e===i)return!0;var s=e.fromNode;return s!==null&&s.isLinkLabel&&(n.add(s),ks(t,s.labeledLink,i,n))?!0:(e=e.toNode,!!(e!==null&&e.isLinkLabel&&(n.add(e),ks(t,e.labeledLink,i,n))))}yr.prototype.isValidCycle=function(t,e,i){if(i===void 0&&(i=null),t===null||e===null)return this.isUnconnectedLinkValid;var n=this.diagram.validCycle;if(n!==Zf){if(n===um){if(n=i||this.temporaryLink,n!==null&&!n.isTreeLink)return!0;for(n=e.linksConnected;n.next();){var s=n.value;if(s!==i&&s.isTreeLink&&s.toNode===e)return!1}return!Ko(this,t,e,i,!0)}if(n===Zp){if(n=i||this.temporaryLink,n!==null&&!n.isTreeLink)return!0;for(n=t.linksConnected;n.next();)if(s=n.value,s!==i&&s.isTreeLink&&s.fromNode===t)return!1;return!Ko(this,t,e,i,!0)}if(n===Wp)return t===e?t=!0:(n=new At,n.add(e),t=$s(this,n,t,e,i)),!t;if(n===Up)return!Ko(this,t,e,i,!1);if(n===td)return t===e?t=!0:(n=new At,n.add(e),t=nc(this,n,t,e,i)),!t}return!0};function Ko(t,e,i,n,s){if(e===i)return!0;if(e===null||i===null)return!1;for(var a=e.linksConnected;a.next();){var l=a.value;if(l!==n&&(!s||l.isTreeLink)&&l.toNode===e&&(l=l.fromNode,l!==e&&Ko(t,l,i,n,s)))return!0}return!1}function $s(t,e,i,n,s){if(i===n)return!0;if(i===null||n===null||e.contains(i))return!1;e.add(i);for(var a=i.linksConnected;a.next();){var l=a.value;if(l!==s&&l.toNode===i&&(l=l.fromNode,l!==i&&$s(t,e,l,n,s)))return!0}return!1}function nc(t,e,i,n,s){if(i===n)return!0;if(i===null||n===null||e.contains(i))return!1;e.add(i);for(var a=i.linksConnected;a.next();){var l=a.value;if(l!==s){var c=l.fromNode;if(l=l.toNode,c=c===i?l:c,c!==i&&nc(t,e,c,n,s))return!0}}return!1}ct.Object.defineProperties(yr.prototype,{portGravity:{get:function(){return this.te},set:function(t){0<=t&&(this.te=t)}},isUnconnectedLinkValid:{get:function(){return this.Ha},set:function(t){this.Ha=t}},linkingCursor:{get:function(){return this.u},set:function(t){this.u=t}},temporaryLink:{get:function(){return this.Ci},set:function(t){this.Ci=t}},temporaryFromNode:{get:function(){return this.Bi},set:function(t){(this.Bi=t)&&(this.j=t.port)}},temporaryFromPort:{get:function(){return this.j},set:function(t){if(this.j!==null){var e=this.j.panel;if(e!==null){var i=e.O.indexOf(this.j);e.mb(i),e.Gb(i,t)}}this.j=t}},temporaryToNode:{get:function(){return this.Di},set:function(t){(this.Di=t)&&(this.o=t.port)}},temporaryToPort:{get:function(){return this.o},set:function(t){if(this.o!==null){var e=this.o.panel;if(e!==null){var i=e.O.indexOf(this.o);e.mb(i),e.Gb(i,t)}}this.o=t}},originalLink:{get:function(){return this.Hb},set:function(t){this.Hb=t}},originalFromNode:{get:function(){return this.hb},set:function(t){this.hb=t}},originalFromPort:{get:function(){return this.ob},set:function(t){this.ob=t}},originalToNode:{get:function(){return this.Oc},set:function(t){this.Oc=t}},originalToPort:{get:function(){return this.Pc},set:function(t){this.Pc=t}},isForwards:{get:function(){return this.ia},set:function(t){this.ia=t}},validPortsCache:{get:function(){return this.hy}},targetPort:{get:function(){return this.Pf},set:function(t){this.Pf=t}},linkValidation:{get:function(){return this.gj},set:function(t){this.gj=t}},portTargeted:{get:function(){return this.Of},set:function(t){this.Of=t}}}),yr.className="LinkingBaseTool";function Ds(){yr.call(this),this.name="Linking",this.V={},this.F=null,this.K=rc,this.Xd=null}gi(Ds,yr),Ds.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return t.isReadOnly||t.isModelReadOnly||!t.allowLink||!t.model.xs()||!t.lastInput.left||t.currentTool!==this&&!this.isBeyondDragSize()?!1:this.findLinkablePort()!==null},Ds.prototype.findLinkablePort=function(){var t=this.diagram,e=this.startObject;if(e===null&&(e=t.ic(t.firstInput.documentPoint,null,null)),e===null||(t=e.part,!(t instanceof Le)))return null;var i=this.direction;if(i===rc||i===Fp){var n=this.findValidLinkablePort(e,!1);if(n!==null||this.startObject===t&&(n=t.port,this.findValidLinkablePort(n,!1)))return this.isForwards=!0,n}return(i===rc||i===W0)&&(e=this.findValidLinkablePort(e,!0),e!==null||this.startObject===t&&(e=t.port,this.findValidLinkablePort(e,!0)))?(this.isForwards=!1,e):null},Ds.prototype.doActivate=function(){var t=this.diagram,e=this.findLinkablePort();e===null?this.stopTool():(this.Ea(this.name),t.isMouseCaptured=!0,t.currentCursor=this.linkingCursor,this.isForwards?(this.temporaryToNode!==null&&(this.temporaryToNode.location=t.lastInput.documentPoint),this.originalFromPort=e,e=this.originalFromPort.part,e instanceof Le&&(this.originalFromNode=e),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1)):(this.temporaryFromNode!==null&&(this.temporaryFromNode.location=t.lastInput.documentPoint),this.originalToPort=e,e=this.originalToPort.part,e instanceof Le&&(this.originalToNode=e),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),t.add(this.temporaryFromNode),this.temporaryFromNode&&this.temporaryFromNode.Va(),t.add(this.temporaryToNode),this.temporaryToNode&&this.temporaryToNode.Va(),this.temporaryLink!==null&&(this.temporaryFromNode!==null&&(this.temporaryLink.fromNode=this.temporaryFromNode),this.temporaryToNode!==null&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.bb(),t.add(this.temporaryLink)),this.isActive=!0)},Ds.prototype.doDeactivate=function(){this.isActive=!1;var t=this.diagram;t.remove(this.temporaryLink),t.remove(this.temporaryFromNode),t.remove(this.temporaryToNode),t.isMouseCaptured=!1,t.currentCursor="",this.stopTransaction()},Ds.prototype.doStop=function(){yr.prototype.doStop.call(this),this.startObject=null},Ds.prototype.doMouseUp=function(){if(this.isActive){var t=this.diagram,e=this.transactionResult=null,i=null,n=null,s=null,a=null;try{var l=this.targetPort=this.findTargetPort(this.isForwards);if(l!==null){var c=l.part;c instanceof Le&&(this.isForwards?(this.originalFromNode!==null&&(e=this.originalFromNode,i=this.originalFromPort),n=c,s=l):(e=c,i=l,this.originalToNode!==null&&(n=this.originalToNode,s=this.originalToPort)))}else this.isForwards?this.originalFromNode!==null&&this.isUnconnectedLinkValid&&(e=this.originalFromNode,i=this.originalFromPort):this.originalToNode!==null&&this.isUnconnectedLinkValid&&(n=this.originalToNode,s=this.originalToPort);e!==null||n!==null?(a=this.insertLink(e,i,n,s),a!==null?(l===null&&(this.isForwards?a.defaultToPoint=t.lastInput.documentPoint:a.defaultFromPoint=t.lastInput.documentPoint),t.allowSelect&&(t.R("ChangingSelection",t.selection),t.clearSelection(!0),a.isSelected=!0),this.transactionResult=this.name,t.R("LinkDrawn",a)):this.doNoLink(e,i,n,s)):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),a&&t.allowSelect&&t.R("ChangedSelection",t.selection)}}},Ds.prototype.isNewTreeLink=function(){var t=this.archetypeLinkData;if(t===null)return!0;if(t instanceof ue)return t.isTreeLink;var e=this.diagram;return e===null?!0:(t=e.partManager.getLinkCategoryForData(t),e=e.partManager.findLinkTemplateForCategory(t),e!==null?e.isTreeLink:!0)},Ds.prototype.insertLink=function(t,e,i,n){return this.diagram.partManager.insertLink(t,e,i,n)},Ds.prototype.doNoLink=function(){},ct.Object.defineProperties(Ds.prototype,{archetypeLinkData:{get:function(){return this.V},set:function(t){this.V=t}},archetypeLabelNodeData:{get:function(){return this.F},set:function(t){this.F=t}},direction:{get:function(){return this.K},set:function(t){this.K=t}},startObject:{get:function(){return this.Xd},set:function(t){this.Xd=t}}});var rc=new mt(Ds,"Either",0),Fp=new mt(Ds,"ForwardsOnly",0),W0=new mt(Ds,"BackwardsOnly",0);Ds.className="LinkingTool",Ds.Either=rc,Ds.ForwardsOnly=Fp,Ds.BackwardsOnly=W0;function Fa(){yr.call(this),this.name="Relinking";var t=new Xi;t.figure="Diamond",t.desiredSize=br,t.fill="lightblue",t.stroke="dodgerblue",t.cursor=this.linkingCursor,t.segmentIndex=0,this.V=t,t=new Xi,t.figure="Diamond",t.desiredSize=br,t.fill="lightblue",t.stroke="dodgerblue",t.cursor=this.linkingCursor,t.segmentIndex=-1,this.Xd=t,this.F=null,this.Ew=new It}gi(Fa,yr),Fa.prototype.updateAdornments=function(t){if(t!==null&&t instanceof ue){var e="RelinkFrom",i=null;if(t.isSelected&&!this.diagram.isReadOnly){var n=t.selectionObject;n!==null&&t.canRelinkFrom()&&t.actualBounds.w()&&t.isVisible()&&n.actualBounds.w()&&n.Ed()&&(i=t.Pj(e),i===null&&(i=this.makeAdornment(n,!1),t.bh(e,i)))}i===null&&t.Jf(e),e="RelinkTo",i=null,t.isSelected&&!this.diagram.isReadOnly&&(n=t.selectionObject,n!==null&&t.canRelinkTo()&&t.actualBounds.w()&&t.isVisible()&&n.actualBounds.w()&&n.Ed()&&(i=t.Pj(e),i===null?(i=this.makeAdornment(n,!0),t.bh(e,i)):i.v())),i===null&&t.Jf(e)}},Fa.prototype.makeAdornment=function(t,e){var i=new Cn;return i.type=ne.Link,e=e?this.toHandleArchetype:this.fromHandleArchetype,e!==null&&i.add(e.copy()),i.adornedObject=t,i},Fa.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowRelink||!t.model.xs()||!t.lastInput.left)return!1;var e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkFrom");return e===null&&(e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkTo")),e!==null},Fa.prototype.doActivate=function(){var t=this.diagram;if(this.originalLink===null){var e=this.handle;if(e===null&&(e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkFrom"),e===null&&(e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkTo"))),e===null)return;var i=e.part;if(!(i instanceof Cn&&i.adornedPart instanceof ue))return;this.handle=e,this.isForwards=i===null||i.category==="RelinkTo",this.originalLink=i.adornedPart}this.Ea(this.name),t.isMouseCaptured=!0,t.currentCursor=this.linkingCursor,this.originalFromPort=this.originalLink.fromPort,this.originalFromNode=this.originalLink.fromNode,this.originalToPort=this.originalLink.toPort,this.originalToNode=this.originalLink.toNode,this.Ew.set(this.originalLink.actualBounds),this.originalLink!==null&&0<this.originalLink.pointsCount&&(this.originalLink.fromNode===null&&(this.temporaryFromPort!==null&&(this.temporaryFromPort.desiredSize=xr),this.temporaryFromNode!==null&&(this.temporaryFromNode.location=this.originalLink.i(0))),this.originalLink.toNode===null&&(this.temporaryToPort!==null&&(this.temporaryToPort.desiredSize=xr),this.temporaryToNode!==null&&(this.temporaryToNode.location=this.originalLink.i(this.originalLink.pointsCount-1)))),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0),t.add(this.temporaryFromNode),t.add(this.temporaryToNode),this.temporaryLink!==null&&(this.temporaryFromNode!==null&&(this.temporaryLink.fromNode=this.temporaryFromNode),this.temporaryToNode!==null&&(this.temporaryLink.toNode=this.temporaryToNode),this.copyLinkProperties(this.originalLink,this.temporaryLink),this.temporaryLink.bb(),t.add(this.temporaryLink)),this.isActive=!0},Fa.prototype.copyLinkProperties=function(t,e){if(t!==null&&e!==null){e.adjusting=t.adjusting,e.corner=t.corner;var i=t.curve;(i===yo||i===$a)&&(i=ea),e.curve=i,e.curviness=t.curviness,e.isTreeLink=t.isTreeLink,e.points=t.points,e.routing=t.routing,e.smoothness=t.smoothness,e.fromSpot=t.fromSpot,e.fromEndSegmentLength=t.fromEndSegmentLength,e.fromShortLength=t.fromShortLength,e.toSpot=t.toSpot,e.toEndSegmentLength=t.toEndSegmentLength,e.toShortLength=t.toShortLength}},Fa.prototype.doDeactivate=function(){this.isActive=!1;var t=this.diagram;t.remove(this.temporaryLink),t.remove(this.temporaryFromNode),t.remove(this.temporaryToNode),t.isMouseCaptured=!1,t.currentCursor="",this.stopTransaction()},Fa.prototype.doStop=function(){yr.prototype.doStop.call(this),this.handle=null},Fa.prototype.doMouseUp=function(){if(this.isActive){var t=this.diagram;this.transactionResult=null;var e=this.originalFromNode,i=this.originalFromPort,n=this.originalToNode,s=this.originalToPort,a=this.originalLink;try{if(this.targetPort=this.findTargetPort(this.isForwards),this.targetPort!==null){var l=this.targetPort.part;l instanceof Le&&(this.isForwards?(n=l,s=this.targetPort):(e=l,i=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?s=n=null:i=e=null:a=null;a!==null?(this.reconnectLink(a,this.isForwards?n:e,this.isForwards?s:i,this.isForwards),this.targetPort===null&&(this.isForwards?a.defaultToPoint=t.lastInput.documentPoint:a.defaultFromPoint=t.lastInput.documentPoint,a.bb()),this.transactionResult=this.name,t.R("LinkRelinked",a,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards),this.originalLink.Xo(this.Ew)}finally{this.stopTool()}}},Fa.prototype.reconnectLink=function(t,e,i,n){return i=i!==null&&i.portId!==null?i.portId:"",n?(t.toNode=e,t.toPortId=i):(t.fromNode=e,t.fromPortId=i),!0},Fa.prototype.doNoRelink=function(){};function Nf(t,e,i,n,s){e!==null?(t.copyPortProperties(e,i,t.temporaryFromNode,t.temporaryFromPort,!1),t.diagram.add(t.temporaryFromNode)):t.diagram.remove(t.temporaryFromNode),n!==null?(t.copyPortProperties(n,s,t.temporaryToNode,t.temporaryToPort,!0),t.diagram.add(t.temporaryToNode)):t.diagram.remove(t.temporaryToNode)}ct.Object.defineProperties(Fa.prototype,{fromHandleArchetype:{get:function(){return this.V},set:function(t){this.V=t}},toHandleArchetype:{get:function(){return this.Xd},set:function(t){this.Xd=t}},handle:{get:function(){return this.F},set:function(t){if(t!==null&&!(t.part instanceof Cn))throw Error("new handle is not in an Adornment: "+t);this.F=t}}}),Fa.className="RelinkingTool",Wt("linkingTool",function(){return this.findTool("Linking")},function(t){this.gb("Linking",t,this.mouseMoveTools)}),Wt("relinkingTool",function(){return this.findTool("Relinking")},function(t){this.gb("Relinking",t,this.mouseDownTools)});function qr(){kn.call(this),this.name="LinkReshaping";var t=new Xi;t.figure="Rectangle",t.desiredSize=ko,t.fill="lightblue",t.stroke="dodgerblue",this.o=t,t=new Xi,t.figure="Diamond",t.desiredSize=br,t.fill="lightblue",t.stroke="dodgerblue",t.cursor="move",this.u=t,this.F=3,this.Ts=this.j=null,this.Fw=new z,this.Yq=new Kt}gi(qr,kn),qr.prototype.Ru=function(t){return t&&t.reshapingBehavior.value!==0?t.reshapingBehavior:Rp},qr.prototype.om=function(t,e){t.reshapingBehavior=e},qr.prototype.updateAdornments=function(t){if(t!==null&&t instanceof ue){var e=null;if(t.isSelected&&!this.diagram.isReadOnly){var i=t.path;i!==null&&t.canReshape()&&t.actualBounds.w()&&t.isVisible()&&i.actualBounds.w()&&i.Ed()&&(e=t.Pj(this.name),e===null||e.Aw!==t.pointsCount||e.Uw!==t.resegmentable)&&(e=this.makeAdornment(i),e!==null&&(e.Aw=t.pointsCount,e.Uw=t.resegmentable,t.bh(this.name,e)))}e===null&&t.Jf(this.name)}},qr.prototype.makeAdornment=function(t){var e=t.part,i=e.pointsCount,n=e.isOrthogonal,s=null;if(e.points!==null&&1<i){s=new Cn,s.type=ne.Link,i=e.firstPickIndex;var a=e.lastPickIndex,l=n?1:0;if(e.resegmentable&&e.computeCurve()!==Qa)for(var c=i+l;c<a-l;c++){var f=this.makeResegmentHandle(t,c);f!==null&&(f.segmentIndex=c,f.segmentFraction=.5,f.fromMaxLinks=999,s.add(f))}for(l=i+1;l<a;l++)if(c=this.makeHandle(t,l),c!==null){if(c.segmentIndex=l,l!==i)if(l===i+1&&n){f=e.i(i);var m=e.i(i+1);ht.B(f.x,m.x)&&ht.B(f.y,m.y)&&(m=e.i(i-1)),ht.B(f.x,m.x)?(this.om(c,_h),c.cursor="n-resize"):ht.B(f.y,m.y)&&(this.om(c,Eh),c.cursor="w-resize")}else l===a-1&&n?(f=e.i(a-1),m=e.i(a),ht.B(f.x,m.x)&&ht.B(f.y,m.y)&&(f=e.i(a+1)),ht.B(f.x,m.x)?(this.om(c,_h),c.cursor="n-resize"):ht.B(f.y,m.y)&&(this.om(c,Eh),c.cursor="w-resize")):l!==a&&(this.om(c,Af),c.cursor="move");s.add(c)}s.adornedObject=t}return s},qr.prototype.makeHandle=function(){var t=this.handleArchetype;return t===null?null:t.copy()},qr.prototype.makeResegmentHandle=function(){var t=this.midHandleArchetype;return t===null?null:t.copy()},qr.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return!t.isReadOnly&&t.allowReshape&&t.lastInput.left?this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null:!1},qr.prototype.doActivate=function(){var t=this.diagram;if(this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle!==null){var e=this.handle.part.adornedPart;if(e instanceof ue){if(this.Ts=e,t.isMouseCaptured=!0,this.Ea(this.name),e.resegmentable&&this.handle.fromMaxLinks===999){var i=e.points.copy(),n=this.getResegmentingPoint();if(i.Gb(this.handle.segmentIndex+1,n),e.isOrthogonal&&i.Gb(this.handle.segmentIndex+1,n),e.points=i,e.Wb(),e.updateAdornments(),this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name),this.handle===null){this.doDeactivate();return}}this.Fw=e.i(this.handle.segmentIndex),this.Yq=e.points.copy(),this.isActive=!0}}},qr.prototype.doDeactivate=function(){this.stopTransaction(),this.Ts=this.handle=null,this.isActive=this.diagram.isMouseCaptured=!1},qr.prototype.stopTransaction=function(){var t=this.diagram,e=kn.prototype.stopTransaction.call(this);return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.ak(),e},qr.prototype.doCancel=function(){var t=this.adornedLink;t!==null&&(t.points=this.Yq),this.stopTool()},qr.prototype.getResegmentingPoint=function(){return this.handle.ga(on)},qr.prototype.doMouseMove=function(){var t=this.diagram;this.isActive&&(t=this.computeReshape(t.lastInput.documentPoint),this.reshape(t))},qr.prototype.doMouseUp=function(){var t=this.diagram;if(this.isActive){var e=this.computeReshape(t.lastInput.documentPoint);if(this.reshape(e),e=this.adornedLink,e!==null&&e.resegmentable){var i=this.handle.segmentIndex,n=e.i(i-1),s=e.i(i),a=e.i(i+1);if(e.isOrthogonal){if(i>e.firstPickIndex+1&&i<e.lastPickIndex-1){var l=e.i(i-2);if(Math.abs(n.x-s.x)<this.resegmentingDistance&&Math.abs(n.y-s.y)<this.resegmentingDistance&&(Lh(this,l,n,s,a,!0)||Lh(this,l,n,s,a,!1))){var c=e.points.copy();Lh(this,l,n,s,a,!0)?(c.cd(i-2,new z(l.x,(a.y+l.y)/2)),c.cd(i+1,new z(a.x,(a.y+l.y)/2))):(c.cd(i-2,new z((a.x+l.x)/2,l.y)),c.cd(i+1,new z((a.x+l.x)/2,a.y))),c.mb(i),c.mb(i-1),e.points=c,e.Wb()}else l=e.i(i+2),Math.abs(s.x-a.x)<this.resegmentingDistance&&Math.abs(s.y-a.y)<this.resegmentingDistance&&(Lh(this,n,s,a,l,!0)||Lh(this,n,s,a,l,!1))&&(c=e.points.copy(),Lh(this,n,s,a,l,!0)?(c.cd(i-1,new z(n.x,(n.y+l.y)/2)),c.cd(i+2,new z(l.x,(n.y+l.y)/2))):(c.cd(i-1,new z((n.x+l.x)/2,n.y)),c.cd(i+2,new z((n.x+l.x)/2,l.y))),c.mb(i+1),c.mb(i),e.points=c,e.Wb())}}else l=z.alloc(),ht.qh(n.x,n.y,a.x,a.y,s.x,s.y,l)&&l.Bf(s)<this.resegmentingDistance*this.resegmentingDistance&&(n=e.points.copy(),n.mb(i),e.points=n,e.Wb()),z.free(l)}t.Ya(),this.transactionResult=this.name,t.R("LinkReshaped",this.adornedLink,this.Yq)}this.stopTool()};function Lh(t,e,i,n,s,a){return a?Math.abs(e.y-i.y)<t.resegmentingDistance&&Math.abs(i.y-n.y)<t.resegmentingDistance&&Math.abs(n.y-s.y)<t.resegmentingDistance:Math.abs(e.x-i.x)<t.resegmentingDistance&&Math.abs(i.x-n.x)<t.resegmentingDistance&&Math.abs(n.x-s.x)<t.resegmentingDistance}qr.prototype.reshape=function(t){var e=this.adornedLink;e.uh();var i=this.handle.segmentIndex,n=this.Ru(this.handle);if(e.isOrthogonal)if(i===e.firstPickIndex+1)i=e.firstPickIndex+1,n===_h?(e.L(i,e.i(i-1).x,t.y),e.L(i+1,e.i(i+2).x,t.y)):n===Eh&&(e.L(i,t.x,e.i(i-1).y),e.L(i+1,t.x,e.i(i+2).y));else if(i===e.lastPickIndex-1)i=e.lastPickIndex-1,n===_h?(e.L(i-1,e.i(i-2).x,t.y),e.L(i,e.i(i+1).x,t.y)):n===Eh&&(e.L(i-1,t.x,e.i(i-2).y),e.L(i,t.x,e.i(i+1).y));else{n=i;var s=e.i(n),a=e.i(n-1),l=e.i(n+1);ht.B(a.x,s.x)&&ht.B(s.y,l.y)?(ht.B(a.x,e.i(n-2).x)&&!ht.B(a.y,e.i(n-2).y)?(e.m(n,t.x,a.y),i++,n++):e.L(n-1,t.x,a.y),ht.B(l.y,e.i(n+2).y)&&!ht.B(l.x,e.i(n+2).x)?e.m(n+1,l.x,t.y):e.L(n+1,l.x,t.y)):ht.B(a.y,s.y)&&ht.B(s.x,l.x)?(ht.B(a.y,e.i(n-2).y)&&!ht.B(a.x,e.i(n-2).x)?(e.m(n,a.x,t.y),i++,n++):e.L(n-1,a.x,t.y),ht.B(l.x,e.i(n+2).x)&&!ht.B(l.y,e.i(n+2).y)?e.m(n+1,t.x,l.y):e.L(n+1,t.x,l.y)):ht.B(a.x,s.x)&&ht.B(s.x,l.x)?(ht.B(a.x,e.i(n-2).x)&&!ht.B(a.y,e.i(n-2).y)?(e.m(n,t.x,a.y),i++,n++):e.L(n-1,t.x,a.y),ht.B(l.x,e.i(n+2).x)&&!ht.B(l.y,e.i(n+2).y)?e.m(n+1,t.x,l.y):e.L(n+1,t.x,l.y)):ht.B(a.y,s.y)&&ht.B(s.y,l.y)&&(ht.B(a.y,e.i(n-2).y)&&!ht.B(a.x,e.i(n-2).x)?(e.m(n,a.x,t.y),i++,n++):e.L(n-1,a.x,t.y),ht.B(l.y,e.i(n+2).y)&&!ht.B(l.x,e.i(n+2).x)?e.m(n+1,l.x,t.y):e.L(n+1,l.x,t.y)),e.L(i,t.x,t.y)}else e.L(i,t.x,t.y),n=e.fromNode,s=e.fromPort,n!==null&&(a=n.findVisibleNode(),a!==null&&a!==n&&(n=a,s=n.port)),i===1&&e.computeSpot(!0,s).Mc()&&(a=s.ga(on,z.alloc()),n=e.getLinkPointFromPoint(n,s,a,t,!0,z.alloc()),e.L(0,n.x,n.y),z.free(a),z.free(n)),n=e.toNode,s=e.toPort,n!==null&&(a=n.findVisibleNode(),a!==null&&a!==n&&(n=a,s=n.port)),i===e.pointsCount-2&&e.computeSpot(!1,s).Mc()&&(i=s.ga(on,z.alloc()),t=e.getLinkPointFromPoint(n,s,i,t,!1,z.alloc()),e.L(e.pointsCount-1,t.x,t.y),z.free(i),z.free(t));e.zf()},qr.prototype.computeReshape=function(t){var e=this.adornedLink,i=this.handle.segmentIndex;switch(this.Ru(this.handle)){case Af:return t;case _h:return new z(e.i(i).x,t.y);case Eh:return new z(t.x,e.i(i).y);default:case Rp:return e.i(i)}},ct.Object.defineProperties(qr.prototype,{handleArchetype:{get:function(){return this.o},set:function(t){this.o=t}},midHandleArchetype:{get:function(){return this.u},set:function(t){this.u=t}},handle:{get:function(){return this.j},set:function(t){if(t!==null&&!(t.part instanceof Cn))throw Error("new handle is not in an Adornment: "+t);this.j=t}},adornedLink:{get:function(){return this.Ts}},resegmentingDistance:{get:function(){return this.F},set:function(t){this.F=t}},originalPoint:{get:function(){return this.Fw}},originalPoints:{get:function(){return this.Yq}}}),qr.prototype.setReshapingBehavior=qr.prototype.om,qr.prototype.getReshapingBehavior=qr.prototype.Ru;var Rp=new mt(qr,"None",0),Eh=new mt(qr,"Horizontal",1),_h=new mt(qr,"Vertical",2),Af=new mt(qr,"All",3);qr.className="LinkReshapingTool",qr.None=Rp,qr.Horizontal=Eh,qr.Vertical=_h,qr.All=Af,Wt("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(t){this.gb("LinkReshaping",t,this.mouseDownTools)});function rs(){kn.call(this),this.name="Resizing",this.o=new ii(1,1).freeze(),this.j=new ii(9999,9999).freeze(),this.yg=new ii(NaN,NaN).freeze(),this.V=!1,this.ia=!0,this.ue=null;var t=new Xi;t.alignmentFocus=on,t.figure="Rectangle",t.desiredSize=ko,t.fill="lightblue",t.stroke="dodgerblue",t.strokeWidth=1,t.cursor="pointer",this.F=t,this.u=null,this.Xq=new z,this.Dw=new ii,this.Tn=new z,this.rt=new ii(0,0),this.qt=new ii(1/0,1/0),this.pt=new ii(1,1)}gi(rs,kn),rs.prototype.updateAdornments=function(t){if(!(t===null||t instanceof ue)){if(t.isSelected&&!this.diagram.isReadOnly){var e=t.resizeObject,i=t.Pj(this.name);if(e!==null&&t.canResize()&&t.actualBounds.w()&&t.isVisible()&&e.actualBounds.w()&&e.Ed()&&((i===null||i.adornedObject!==e)&&(i=this.makeAdornment(e)),i!==null)){e=e.li(),ad(t)&&this.updateResizeHandles(i,e),t.bh(this.name,i);return}}t.Jf(this.name)}},rs.prototype.makeAdornment=function(t){var e=t.part.resizeAdornmentTemplate;if(e===null){e=new Cn,e.type=ne.Spot,e.locationSpot=on;var i=new Zs;i.isPanelMain=!0,e.add(i),e.add(this.makeHandle(t,An)),e.add(this.makeHandle(t,Io)),e.add(this.makeHandle(t,Go)),e.add(this.makeHandle(t,Ys)),e.add(this.makeHandle(t,oo)),e.add(this.makeHandle(t,so)),e.add(this.makeHandle(t,ao)),e.add(this.makeHandle(t,co))}else if(_a(e),e=e.copy(),e===null)return null;return e.adornedObject=t,e},rs.prototype.makeHandle=function(t,e){return t=this.handleArchetype,t===null?null:(t=t.copy(),t.alignment=e,t)},rs.prototype.updateResizeHandles=function(t,e){if(t!==null){if(!t.alignment.Xb()&&(t.cursor==="pointer"||0<t.cursor.indexOf("resize")))t:{var i=t.alignment;if(i.Mc()&&(i=on),0>=i.x)e=0>=i.y?e+225:1<=i.y?e+135:e+180;else if(1<=i.x)0>=i.y?e+=315:1<=i.y&&(e+=45);else if(0>=i.y)e+=270;else if(1<=i.y)e+=90;else break t;0>e?e+=360:360<=e&&(e-=360),t.cursor=22.5>e?"e-resize":67.5>e?"se-resize":112.5>e?"s-resize":157.5>e?"sw-resize":202.5>e?"w-resize":247.5>e?"nw-resize":292.5>e?"n-resize":337.5>e?"ne-resize":"e-resize"}else if(t instanceof ne)for(t=t.elements;t.next();)this.updateResizeHandles(t.value,e)}},rs.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return!t.isReadOnly&&t.allowResize&&t.lastInput.left?this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null:!1},rs.prototype.doActivate=function(){var t=this.diagram;this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle!==null&&(this.adornedObject=this.handle.part.adornedObject,this.adornedObject!==null&&(t.isMouseCaptured=!0,t.animationManager.Cc(),this.Ea(this.name),this.Xq.set(this.adornedObject.ga(this.handle.alignment.gv())),this.Tn.set(this.adornedObject.part.location),this.Dw.set(this.adornedObject.desiredSize),this.pt=this.computeCellSize(),this.rt=this.computeMinSize(),this.qt=this.computeMaxSize(),this.isActive=!0))},rs.prototype.doDeactivate=function(){var t=this.diagram;this.stopTransaction(),this.ue=this.handle=null,this.isActive=t.isMouseCaptured=!1},rs.prototype.stopTransaction=function(){var t=this.diagram,e=kn.prototype.stopTransaction.call(this);return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.ak(),e},rs.prototype.doCancel=function(){this.adornedObject!==null&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation),this.stopTool()},rs.prototype.doMouseMove=function(){var t=this.diagram;if(this.isActive){var e=this.rt,i=this.qt,n=this.pt,s=this.adornedObject.qs(t.lastInput.documentPoint,z.alloc()),a=this.computeReshape();e=this.computeResize(s,this.handle.alignment,e,i,n,a),this.resize(e),t.bd(),z.free(s)}},rs.prototype.doMouseUp=function(){var t=this.diagram;if(this.isActive){var e=this.rt,i=this.qt,n=this.pt,s=this.adornedObject.qs(t.lastInput.documentPoint,z.alloc()),a=this.computeReshape();e=this.computeResize(s,this.handle.alignment,e,i,n,a),this.resize(e),z.free(s),t.Ya(),this.transactionResult=this.name,t.R("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()},rs.prototype.resize=function(t){var e=this.diagram,i=this.adornedObject;if(i!==null){if(i.desiredSize=t.size,t=i.part,t.Va(),i=i.ga(this.handle.alignment.gv()),t instanceof ji){var n=new Kt;if(n.add(t),!this.dragsMembers&&t.placeholder===null){var s=new p;s.dragsMembers=!1}e.moveParts(n,this.oppositePoint.copy().re(i),!0,s)}else t.location=t.location.copy().re(i).add(this.oppositePoint);e.bd()}},rs.prototype.computeResize=function(t,e,i,n,s,a){e.Mc()&&(e=on);var l=this.adornedObject.naturalBounds,c=l.x,f=l.y,m=l.x+l.width,v=l.y+l.height,w=1;if(!a){w=l.width;var C=l.height;0>=w&&(w=1),0>=C&&(C=1),w=C/w}return C=z.alloc(),ht.No(t.x,t.y,c,f,s.width,s.height,C),t=l.copy(),0>=e.x?0>=e.y?(t.x=Math.max(C.x,m-n.width),t.x=Math.min(t.x,m-i.width),t.width=Math.max(m-t.x,i.width),t.y=Math.max(C.y,v-n.height),t.y=Math.min(t.y,v-i.height),t.height=Math.max(v-t.y,i.height),a||(1<=t.height/t.width?(t.height=Math.max(Math.min(w*t.width,n.height),i.height),t.width=t.height/w):(t.width=Math.max(Math.min(t.height/w,n.width),i.width),t.height=w*t.width),t.x=m-t.width,t.y=v-t.height)):1<=e.y?(t.x=Math.max(C.x,m-n.width),t.x=Math.min(t.x,m-i.width),t.width=Math.max(m-t.x,i.width),t.height=Math.max(Math.min(C.y-f,n.height),i.height),a||(1<=t.height/t.width?(t.height=Math.max(Math.min(w*t.width,n.height),i.height),t.width=t.height/w):(t.width=Math.max(Math.min(t.height/w,n.width),i.width),t.height=w*t.width),t.x=m-t.width)):(t.x=Math.max(C.x,m-n.width),t.x=Math.min(t.x,m-i.width),t.width=m-t.x,a||(t.height=Math.max(Math.min(w*t.width,n.height),i.height),t.width=t.height/w,t.y=f+.5*(v-f-t.height))):1<=e.x?0>=e.y?(t.width=Math.max(Math.min(C.x-c,n.width),i.width),t.y=Math.max(C.y,v-n.height),t.y=Math.min(t.y,v-i.height),t.height=Math.max(v-t.y,i.height),a||(1<=t.height/t.width?(t.height=Math.max(Math.min(w*t.width,n.height),i.height),t.width=t.height/w):(t.width=Math.max(Math.min(t.height/w,n.width),i.width),t.height=w*t.width),t.y=v-t.height)):1<=e.y?(t.width=Math.max(Math.min(C.x-c,n.width),i.width),t.height=Math.max(Math.min(C.y-f,n.height),i.height),a||(1<=t.height/t.width?(t.height=Math.max(Math.min(w*t.width,n.height),i.height),t.width=t.height/w):(t.width=Math.max(Math.min(t.height/w,n.width),i.width),t.height=w*t.width))):(t.width=Math.max(Math.min(C.x-c,n.width),i.width),a||(t.height=Math.max(Math.min(w*t.width,n.height),i.height),t.width=t.height/w,t.y=f+.5*(v-f-t.height))):0>=e.y?(t.y=Math.max(C.y,v-n.height),t.y=Math.min(t.y,v-i.height),t.height=v-t.y,a||(t.width=Math.max(Math.min(t.height/w,n.width),i.width),t.height=w*t.width,t.x=c+.5*(m-c-t.width))):1<=e.y&&(t.height=Math.max(Math.min(C.y-f,n.height),i.height),a||(t.width=Math.max(Math.min(t.height/w,n.width),i.width),t.height=w*t.width,t.x=c+.5*(m-c-t.width))),z.free(C),t},rs.prototype.computeReshape=function(){var t=Yt;return this.adornedObject instanceof Xi&&(t=o0(this.adornedObject)),!(t===Ge||this.diagram.lastInput.shift)},rs.prototype.computeMinSize=function(){var t=this.adornedObject.minSize.copy(),e=this.minSize;return!isNaN(e.width)&&e.width>t.width&&(t.width=e.width),!isNaN(e.height)&&e.height>t.height&&(t.height=e.height),t},rs.prototype.computeMaxSize=function(){var t=this.adornedObject.maxSize.copy(),e=this.maxSize;return!isNaN(e.width)&&e.width<t.width&&(t.width=e.width),!isNaN(e.height)&&e.height<t.height&&(t.height=e.height),t},rs.prototype.computeCellSize=function(){var t=new ii(NaN,NaN),e=this.adornedObject.part;return e!==null&&(e=e.resizeCellSize,!isNaN(e.width)&&0<e.width&&(t.width=e.width),!isNaN(e.height)&&0<e.height&&(t.height=e.height)),e=this.cellSize,isNaN(t.width)&&!isNaN(e.width)&&0<e.width&&(t.width=e.width),isNaN(t.height)&&!isNaN(e.height)&&0<e.height&&(t.height=e.height),e=this.diagram,(isNaN(t.width)||isNaN(t.height))&&e&&(e=e.grid,e!==null&&e.visible&&this.isGridSnapEnabled&&(e=e.gridCellSize,isNaN(t.width)&&!isNaN(e.width)&&0<e.width&&(t.width=e.width),isNaN(t.height)&&!isNaN(e.height)&&0<e.height&&(t.height=e.height))),(isNaN(t.width)||t.width===0||t.width===1/0)&&(t.width=1),(isNaN(t.height)||t.height===0||t.height===1/0)&&(t.height=1),t},ct.Object.defineProperties(rs.prototype,{handleArchetype:{get:function(){return this.F},set:function(t){this.F=t}},handle:{get:function(){return this.u},set:function(t){if(t!==null&&!(t.part instanceof Cn))throw Error("new handle is not in an Adornment: "+t);this.u=t}},adornedObject:{get:function(){return this.ue},set:function(t){if(t!==null&&t.part instanceof Cn)throw Error("new handle must not be in an Adornment: "+t);this.ue=t}},minSize:{get:function(){return this.o},set:function(t){if(!this.o.D(t)){var e=t.width;isNaN(e)&&(e=0),t=t.height,isNaN(t)&&(t=0),this.o.h(e,t)}}},maxSize:{get:function(){return this.j},set:function(t){if(!this.j.D(t)){var e=t.width;isNaN(e)&&(e=1/0),t=t.height,isNaN(t)&&(t=1/0),this.j.h(e,t)}}},cellSize:{get:function(){return this.yg},set:function(t){this.yg.D(t)||this.yg.assign(t)}},isGridSnapEnabled:{get:function(){return this.V},set:function(t){this.V=t}},dragsMembers:{get:function(){return this.ia},set:function(t){this.ia=t}},oppositePoint:{get:function(){return this.Xq},set:function(t){this.Xq.D(t)||this.Xq.assign(t)}},originalDesiredSize:{get:function(){return this.Dw}},originalLocation:{get:function(){return this.Tn}}}),rs.className="ResizingTool",Wt("resizingTool",function(){return this.findTool("Resizing")},function(t){this.gb("Resizing",t,this.mouseDownTools)});function Ks(){kn.call(this),this.name="Rotating",this.ia=45,this.V=2,this.Tn=new z,this.ue=null;var t=new Xi;t.figure="Ellipse",t.desiredSize=br,t.fill="lightblue",t.stroke="dodgerblue",t.strokeWidth=1,t.cursor="pointer",this.o=t,this.j=null,this.Cw=0,this.kr=new z(NaN,NaN),this.u=0,this.F=50}gi(Ks,kn),Ks.prototype.updateAdornments=function(t){if(t!==null){if(t.ph()){var e=t.rotateObject;if(e===t||e===t.path||e.isPanelMain)return}if(t.isSelected&&!this.diagram.isReadOnly&&(e=t.rotateObject,e!==null&&t.canRotate()&&t.actualBounds.w()&&t.isVisible()&&e.actualBounds.w()&&e.Ed())){var i=t.Pj(this.name);if((i===null||i.adornedObject!==e)&&(i=this.makeAdornment(e)),i!==null){i.angle=e.li(),i.placeholder===null&&(i.location=this.computeAdornmentLocation(e)),t.bh(this.name,i);return}}t.Jf(this.name)}},Ks.prototype.makeAdornment=function(t){var e=t.part.rotateAdornmentTemplate;if(e===null){e=new Cn,e.type=ne.Position,e.locationSpot=on;var i=this.handleArchetype;i!==null&&e.add(i.copy())}else if(_a(e),e=e.copy(),e===null)return null;return e.adornedObject=t,e},Ks.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return!t.isReadOnly&&t.allowRotate&&t.lastInput.left?this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null:!1},Ks.prototype.doActivate=function(){var t=this.diagram;if(this.adornedObject===null){if(this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle===null)return;this.adornedObject=this.handle.part.adornedObject}this.adornedObject!==null&&(t.isMouseCaptured=!0,t.delaysLayout=!0,this.Ea(this.name),this.Cw=this.adornedObject.angle,this.kr=this.computeRotationPoint(this.adornedObject),this.Tn=this.adornedObject.part.location.copy(),this.isActive=!0)},Ks.prototype.computeRotationPoint=function(t){var e=t.part,i=e.locationObject;return e.rotationSpot.sb()?t.ga(e.rotationSpot):t===e||t===i?i.ga(e.locationSpot):t.ga(on)},Ks.prototype.computeAdornmentLocation=function(t){var e=this.rotationPoint;e.w()||(e=this.computeRotationPoint(t)),e=t.qs(e);var i=this.handleAngle;0>i?i+=360:360<=i&&(i-=360),i=Math.round(45*Math.round(i/45));var n=this.handleDistance;return i===0?e.x=t.naturalBounds.width+n:i===45?(e.x=t.naturalBounds.width+n,e.y=t.naturalBounds.height+n):i===90?e.y=t.naturalBounds.height+n:i===135?(e.x=-n,e.y=t.naturalBounds.height+n):i===180?e.x=-n:i===225?(e.x=-n,e.y=-n):i===270?e.y=-n:i===315&&(e.x=t.naturalBounds.width+n,e.y=-n),t.ga(e)},Ks.prototype.doDeactivate=function(){var t=this.diagram;this.stopTransaction(),this.ue=this.handle=null,this.kr=new z(NaN,NaN),this.isActive=t.isMouseCaptured=!1},Ks.prototype.stopTransaction=function(){var t=this.diagram,e=kn.prototype.stopTransaction.call(this);return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.ak(),e},Ks.prototype.doCancel=function(){this.diagram.delaysLayout=!1,this.rotate(this.originalAngle),this.stopTool()},Ks.prototype.doMouseMove=function(){var t=this.diagram;this.isActive&&(t=this.computeRotate(t.lastInput.documentPoint),this.rotate(t))},Ks.prototype.doMouseUp=function(){var t=this.diagram;if(this.isActive){t.delaysLayout=!1;var e=this.computeRotate(t.lastInput.documentPoint);this.rotate(e),t.Ya(),this.transactionResult=this.name,t.R("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()},Ks.prototype.rotate=function(t){var e=this.adornedObject;if(e!==null){e.angle=t,e=e.part,e.Va();var i=e.locationObject,n=e.rotateObject;(i===n||i.rg(n))&&(i=this.Tn.copy(),e.location=i.re(this.rotationPoint).rotate(t-this.originalAngle).add(this.rotationPoint)),this.diagram.bd()}},Ks.prototype.computeRotate=function(t){t=this.rotationPoint.ab(t)-this.handleAngle;var e=this.adornedObject.panel;e!==null&&(t-=e.li()),360<=t?t-=360:0>t&&(t+=360),e=Math.min(Math.abs(this.snapAngleMultiple),180);var i=Math.min(Math.abs(this.snapAngleEpsilon),e/2);return!this.diagram.lastInput.shift&&0<e&&0<i&&(t%e<i?t=Math.floor(t/e)*e:t%e>e-i&&(t=(Math.floor(t/e)+1)*e)),360<=t?t-=360:0>t&&(t+=360),t},ct.Object.defineProperties(Ks.prototype,{handleArchetype:{get:function(){return this.o},set:function(t){this.o=t}},handle:{get:function(){return this.j},set:function(t){if(t!==null&&!(t.part instanceof Cn))throw Error("new handle is not in an Adornment: "+t);this.j=t}},adornedObject:{get:function(){return this.ue},set:function(t){if(t!==null&&t.part instanceof Cn)throw Error("new handle must not be in an Adornment: "+t);this.ue=t}},snapAngleMultiple:{get:function(){return this.ia},set:function(t){this.ia=t}},snapAngleEpsilon:{get:function(){return this.V},set:function(t){this.V=t}},originalAngle:{get:function(){return this.Cw}},rotationPoint:{get:function(){return this.kr},set:function(t){this.kr=t.copy()}},handleAngle:{get:function(){return this.u},set:function(t){this.u=t}},handleDistance:{get:function(){return this.F},set:function(t){this.F=t}}}),Ks.className="RotatingTool",Wt("rotatingTool",function(){return this.findTool("Rotating")},function(t){this.gb("Rotating",t,this.mouseDownTools)});function oc(){kn.call(this),this.name="ClickSelecting"}gi(oc,kn),oc.prototype.canStart=function(){return!(!this.isEnabled||this.isBeyondDragSize())},oc.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip()),this.stopTool()},oc.className="ClickSelectingTool";function hl(){kn.call(this),this.name="Action",this.pk=null}gi(hl,kn),hl.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram,e=t.lastInput,i=t.ic(e.documentPoint,function(n){for(;n.panel!==null&&!n.isActionable;)n=n.panel;return n});return i!==null&&i.isActionable?(this.pk=i,t.Ck=t.ic(e.documentPoint,null,null),!0):!1},hl.prototype.doMouseDown=function(){if(this.isActive){var t=this.diagram.lastInput,e=this.pk;e!==null&&(t.targetObject=e,e.actionDown!==null&&e.actionDown(t,e))}else this.canStart()&&this.doActivate()},hl.prototype.doMouseMove=function(){if(this.isActive){var t=this.diagram.lastInput,e=this.pk;e!==null&&(t.targetObject=e,e.actionMove!==null&&e.actionMove(t,e))}},hl.prototype.doMouseUp=function(){if(this.isActive){var t=this.diagram.lastInput,e=this.pk;if(e===null)return;t.targetObject=e,e.actionUp!==null&&e.actionUp(t,e),this.standardMouseClick(function(i){for(;i.panel!==null&&(!i.isActionable||i!==e);)i=i.panel;return i},function(i){return i===e})}this.stopTool()},hl.prototype.doCancel=function(){var t=this.diagram.lastInput,e=this.pk;e!==null&&(t.targetObject=e,e.actionCancel!==null&&e.actionCancel(t,e),this.stopTool())},hl.prototype.doStop=function(){this.pk=null},hl.className="ActionTool";function Th(){kn.call(this),this.name="ClickCreating",this.Ri=null,this.o=!0,this.j=!1,this.mw=new z(0,0)}gi(Th,kn),Th.prototype.canStart=function(){if(!this.isEnabled||this.archetypeNodeData===null)return!1;var t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(t.lastInput.clickCount===1&&(this.mw=t.lastInput.viewPoint.copy()),t.lastInput.clickCount!==2||this.isBeyondDragSize(this.mw))return!1}else if(t.lastInput.clickCount!==1)return!1;return!(t.currentTool!==this&&t.Ol(t.lastInput.documentPoint,!0)!==null)},Th.prototype.doMouseUp=function(){var t=this.diagram;this.isActive&&this.insertPart(t.lastInput.documentPoint),this.stopTool()},Th.prototype.insertPart=function(t){var e=this.diagram,i=this.archetypeNodeData;if(i===null)return null;var n=null;try{if(e.R("ChangingSelection",e.selection),this.Ea(this.name),i instanceof ui)i.Zc()&&(_a(i),n=i.copy(),n!==null&&e.add(n));else if(i!==null){var s=e.model.copyNodeData(i);Tt(s)&&(e.model.xf(s),n=e.Lc(s))}if(n!==null){var a=z.allocAt(t.x,t.y);this.isGridSnapEnabled&&Dr(this.diagram,n,t,a),n.location=a,e.allowSelect&&(e.clearSelection(!0),n.isSelected=!0),z.free(a)}e.Ya(),this.transactionResult=this.name,e.R("PartCreated",n)}finally{this.stopTransaction(),e.R("ChangedSelection",e.selection)}return n},ct.Object.defineProperties(Th.prototype,{archetypeNodeData:{get:function(){return this.Ri},set:function(t){this.Ri=t}},isDoubleClick:{get:function(){return this.o},set:function(t){this.o=t}},isGridSnapEnabled:{get:function(){return this.j},set:function(t){this.j=t}}}),Th.className="ClickCreatingTool";function Wa(){kn.call(this),this.name="DragSelecting",this.Ik=175,this.o=!1;var t=new ui;t.layerName="Tool",t.selectable=!1;var e=new Xi;e.name="SHAPE",e.figure="Rectangle",e.fill=null,e.stroke="magenta",t.add(e),this.j=t}gi(Wa,kn),Wa.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;if(!t.allowSelect)return!1;var e=t.lastInput;return!(!e.left||t.currentTool!==this&&(!this.isBeyondDragSize()||e.timestamp-t.firstInput.timestamp<this.delay||t.Ol(e.documentPoint,!0)!==null))},Wa.prototype.doActivate=function(){var t=this.diagram;this.isActive=!0,t.isMouseCaptured=!0,t.skipsUndoManager=!0,t.add(this.box),this.doMouseMove()},Wa.prototype.doDeactivate=function(){var t=this.diagram;t.ug(),t.remove(this.box),t.skipsUndoManager=!1,this.isActive=t.isMouseCaptured=!1},Wa.prototype.doMouseMove=function(){var t=this.diagram;if(this.isActive&&this.box!==null){var e=this.computeBoxBounds(),i=this.box.fb("SHAPE");i===null&&(i=this.box.Pb());var n=ii.alloc().h(e.width,e.height);i.desiredSize=n,this.box.mm(e.x,e.y,!1),ii.free(n),(t.allowHorizontalScroll||t.allowVerticalScroll)&&t.gs(t.lastInput.viewPoint)}},Wa.prototype.doMouseUp=function(){if(this.isActive){var t=this.diagram;t.remove(this.box);try{t.currentCursor="wait",t.R("ChangingSelection",t.selection),this.selectInRect(this.computeBoxBounds()),t.R("ChangedSelection",t.selection)}finally{t.currentCursor=""}}this.stopTool()},Wa.prototype.computeBoxBounds=function(){var t=this.diagram;return new It(t.firstInput.documentPoint,t.lastInput.documentPoint)},Wa.prototype.selectInRect=function(t){var e=this.diagram,i=e.lastInput;if(t=e.ux(t,this.isPartialInclusion),re?i.meta:i.control)if(i.shift)for(t=t.iterator;t.next();)e=t.value,e.isSelected&&(e.isSelected=!1);else for(t=t.iterator;t.next();)e=t.value,e.isSelected=!e.isSelected;else if(i.shift)for(t=t.iterator;t.next();)e=t.value,e.isSelected||(e.isSelected=!0);else{for(i=new Kt,e=e.selection.iterator;e.next();){var n=e.value;t.contains(n)||i.add(n)}for(e=i.iterator;e.next();)e.value.isSelected=!1;for(t=t.iterator;t.next();)e=t.value,e.isSelected||(e.isSelected=!0)}},ct.Object.defineProperties(Wa.prototype,{delay:{get:function(){return this.Ik},set:function(t){this.Ik=t}},isPartialInclusion:{get:function(){return this.o},set:function(t){this.o=t}},box:{get:function(){return this.j},set:function(t){this.j=t}}}),Wa.className="DragSelectingTool";function Fo(){kn.call(this),this.name="Panning",this.Xt=new z,this.xy=new z,this.xg=!1;var t=this;this.Kw=function(){var e=t.diagram;e!==null&&e.removeEventListener(Z.document,"scroll",t.Kw,!1),t.stopTool()}}gi(Fo,kn),Fo.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return!(!t.allowHorizontalScroll&&!t.allowVerticalScroll||!t.lastInput.left||t.currentTool!==this&&!this.isBeyondDragSize())},Fo.prototype.doActivate=function(){var t=this.diagram;this.xg?(t.lastInput.bubbles=!0,t.addEventListener(Z.document,"scroll",this.Kw,!1)):(t.currentCursor="move",t.isMouseCaptured=!0,this.Xt.assign(t.position)),this.isActive=!0},Fo.prototype.doDeactivate=function(){var t=this.diagram;t.currentCursor="",this.isActive=t.isMouseCaptured=!1},Fo.prototype.doCancel=function(){var t=this.diagram;t.position=this.Xt,t.isMouseCaptured=!1,this.stopTool()},Fo.prototype.doMouseMove=function(){this.move()},Fo.prototype.doMouseUp=function(){this.move(),this.stopTool()},Fo.prototype.move=function(){var t=this.diagram;if(this.isActive&&t)if(this.xg)t.lastInput.bubbles=!0;else{var e=t.position,i=t.firstInput.documentPoint,n=t.lastInput.documentPoint,s=e.x+i.x-n.x;i=e.y+i.y-n.y,t.allowHorizontalScroll||(s=e.x),t.allowVerticalScroll||(i=e.y),t.position=this.xy.h(s,i)}},ct.Object.defineProperties(Fo.prototype,{bubbles:{get:function(){return this.xg},set:function(t){this.xg=t}},originalPosition:{get:function(){return this.Xt}}}),Fo.className="PanningTool",Wt("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(t){this.gb("ClickCreating",t,this.mouseUpTools)}),Wt("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(t){this.gb("ClickSelecting",t,this.mouseUpTools)}),Wt("panningTool",function(){return this.findTool("Panning")},function(t){this.gb("Panning",t,this.mouseMoveTools)}),Wt("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(t){this.gb("DragSelecting",t,this.mouseMoveTools)}),Wt("actionTool",function(){return this.findTool("Action")},function(t){this.gb("Action",t,this.mouseDownTools)});function Ua(){this.F=this.u=this.j=this.o=null}ct.Object.defineProperties(Ua.prototype,{mainElement:{get:function(){return this.u},set:function(t){this.u=t}},show:{get:function(){return this.o},set:function(t){this.o!==t&&(this.o=t)}},hide:{get:function(){return this.j},set:function(t){this.j!==t&&(this.j=t)}},valueFunction:{get:function(){return this.F},set:function(t){this.F=t}}}),Ua.className="HTMLInfo";function Za(t,e,i){this.text=t,this.hx=e,this.visible=i}Za.className="ContextMenuButtonInfo";function Hs(){kn.call(this),this.name="ContextMenu",this.o=this.ht=this.j=null,this.yw=new z,this.jt=null,this.Et=!1;var t=this;this.tu=function(){t.stopTool()}}gi(Hs,kn);function El(t){var e=new Ua;e.show=function(s,a,l){l.showDefaultContextMenu()},e.hide=function(s,a){a.hideDefaultContextMenu()},sc=e,t.tu=function(){t.stopTool()},e=te("div");var i=te("div");e.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px",i.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";var n=te("style");Z.document.getElementsByTagName("head")[0].appendChild(n),n.sheet.insertRule(".goCXul { list-style: none; }",0),n.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0),n.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0),n=t.diagram,n!==null&&(n.addEventListener(e,"contextmenu",Qr,!1),n.addEventListener(e,"selectstart",Qr,!1),n.addEventListener(i,"contextmenu",Qr,!1)),e.className="goCXforeground",i.className="goCXbackground",Z.document.body&&(Z.document.body.appendChild(e),Z.document.body.appendChild(i)),ac=e,Su=i,_d=!0}function Qr(t){return t.preventDefault(),!1}Hs.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;return this.isBeyondDragSize()||!t.lastInput.right||1<t.lastInput.clickCount?!1:!!(t.lastInput.isTouchEvent&&this.defaultTouchContextMenu!==null||this.findObjectWithContextMenu()!==null)},Hs.prototype.doStart=function(){this.yw.set(this.diagram.firstInput.documentPoint)},Hs.prototype.doStop=function(){this.hideContextMenu(),this.currentObject=null},Hs.prototype.findObjectWithContextMenu=function(t){t===void 0&&(t=null);var e=this.diagram,i=e.lastInput,n=null;if(t instanceof wt||(t instanceof at?n=t:n=e.ic(i.documentPoint,null,function(s){return!s.layer.isTemporary})),n!==null){for(t=n;t!==null;){if(t.contextMenu!==null)return t;t=t.panel}if(e.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return n.part}else if(e.contextMenu!==null)return e;return null},Hs.prototype.doActivate=function(){},Hs.prototype.doMouseDown=function(){if(kn.prototype.doMouseDown.call(this),this.isActive&&this.currentContextMenu instanceof Cn){var t=this.diagram.toolManager.findTool("Action");t!==null&&t.canStart()&&(t.doActivate(),t.doMouseDown(),t.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Rl(this)},Hs.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Cn){var t=this.diagram.toolManager.findTool("Action");t!==null&&t.canStart()&&(t.doActivate(),t.doCancel(),t.doDeactivate())}Rl(this)};function Rl(t){var e=t.diagram;if(t.isActive){var i=t.currentContextMenu;if(i!==null){var n=null;i instanceof Ua||(n=e.ic(e.lastInput.documentPoint,null,null),n!==null&&n.rg(i)&&t.standardMouseClick(null,null)),t.maybeStopTool(n)}}else t.canStart()&&(nu(t,!0),t.isActive||t.stopTool())}Hs.prototype.maybeStopTool=function(){this.stopTool(),this.canStart()&&(this.diagram.currentTool=this,this.doMouseUp())};function nu(t,e,i){if(i===void 0&&(i=null),!t.Et&&(t.Et=!0,e&&t.standardMouseSelect(),e=t.standardMouseClick(),t.Et=!1,!e)){if(t.isActive=!0,e=sc,i===null&&(i=t.findObjectWithContextMenu()),i!==null){var n=i.contextMenu;n!==null?(t.currentObject=i instanceof at?i:null,t.showContextMenu(n,t.currentObject)):e!==null&&t.showContextMenu(e,t.currentObject)}else e!==null&&t.showContextMenu(e,null);t.currentContextMenu instanceof Cn&&!t.currentContextMenu.visible&&t.stopTool()}}Hs.prototype.doMouseMove=function(){var t=this.diagram.toolManager.findTool("Action");t!==null&&t.doMouseMove(),this.isActive&&this.diagram.toolManager.doMouseMove()},Hs.prototype.showContextMenu=function(t,e){var i=this.diagram;if(t!==this.currentContextMenu&&this.hideContextMenu(),t instanceof Cn){t.layerName="Tool",t.selectable=!1,t.scale=1/i.scale,t.category=this.name,t.placeholder!==null&&(t.placeholder.scale=i.scale);var n=t.diagram;n!==null&&n!==i&&n.remove(t),i.add(t),e!==null?t.adornedObject=e:t.data=i.model,t.Va(),this.positionContextMenu(t,e)}else t instanceof Ua&&t.show(e,i,this);this.currentContextMenu=t},Hs.prototype.positionContextMenu=function(t){if(t.placeholder===null){var e=this.diagram,i=e.lastInput.documentPoint.copy(),n=t.measuredBounds,s=e.viewportBounds;e.lastInput.isTouchEvent&&(i.x-=n.width),i.x+n.width>s.right&&(i.x-=n.width+5/e.scale),i.x<s.x&&(i.x=s.x),i.y+n.height>s.bottom&&(i.y-=n.height+5/e.scale),i.y<s.y&&(i.y=s.y),t.position=i}},Hs.prototype.hideContextMenu=function(){var t=this.diagram,e=this.currentContextMenu;e!==null&&(e instanceof Cn?(t.remove(e),this.ht!==null&&this.ht.Jf(e.category),e.data=null,e.adornedObject=null):e instanceof Ua&&(e.hide!==null?e.hide(t,this):e.mainElement!==null&&(e.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};function Ph(t){var e=new Kt;return e.add(new Za("Copy",function(i){i.commandHandler.copySelection()},function(i){return i.commandHandler.canCopySelection()})),e.add(new Za("Cut",function(i){i.commandHandler.cutSelection()},function(i){return i.commandHandler.canCutSelection()})),e.add(new Za("Delete",function(i){i.commandHandler.deleteSelection()},function(i){return i.commandHandler.canDeleteSelection()})),e.add(new Za("Paste",function(i){i.commandHandler.pasteSelection(t.mouseDownPoint)},function(i){return i.commandHandler.canPasteSelection(t.mouseDownPoint)})),e.add(new Za("Select All",function(i){i.commandHandler.selectAll()},function(i){return i.commandHandler.canSelectAll()})),e.add(new Za("Undo",function(i){i.commandHandler.undo()},function(i){return i.commandHandler.canUndo()})),e.add(new Za("Redo",function(i){i.commandHandler.redo()},function(i){return i.commandHandler.canRedo()})),e.add(new Za("Scroll To Part",function(i){i.commandHandler.scrollToPart()},function(i){return i.commandHandler.canScrollToPart()})),e.add(new Za("Zoom To Fit",function(i){i.commandHandler.zoomToFit()},function(i){return i.commandHandler.canZoomToFit()})),e.add(new Za("Reset Zoom",function(i){i.commandHandler.resetZoom()},function(i){return i.commandHandler.canResetZoom()})),e.add(new Za("Group Selection",function(i){i.commandHandler.groupSelection()},function(i){return i.commandHandler.canGroupSelection()})),e.add(new Za("Ungroup Selection",function(i){i.commandHandler.ungroupSelection()},function(i){return i.commandHandler.canUngroupSelection()})),e.add(new Za("Edit Text",function(i){i.commandHandler.editTextBlock()},function(i){return i.commandHandler.canEditTextBlock()})),e}Hs.prototype.showDefaultContextMenu=function(){var t=this.diagram;this.jt===null&&(this.jt=Ph(this)),ac.innerHTML="",Su.addEventListener("pointerdown",this.tu,!1);var e=this,i=te("ul");i.className="goCXul",ac.appendChild(i),i.innerHTML="";for(var n=this.jt.iterator;n.next();){var s=n.value,a=s.visible;if(typeof s.hx=="function"&&(typeof a!="function"||a(t))){a=te("li"),a.className="goCXli";var l=te("a");l.className="goCXa",l.href="#",l.ky=s.hx,l.addEventListener("pointerdown",function(c){return this.ky(t),e.stopTool(),c.preventDefault(),!1},!1),l.textContent=s.text,a.appendChild(l),i.appendChild(a)}}ac.style.display="block",Su.style.display="block"},Hs.prototype.hideDefaultContextMenu=function(){if(this.currentContextMenu!==null&&this.currentContextMenu===sc){ac.style.display="none",Su.style.display="none";var t=this.diagram;t!==null&&t.removeEventListener(Su,"pointerdown",this.tu,!1),this.currentContextMenu=null}},ct.Object.defineProperties(Hs.prototype,{currentContextMenu:{get:function(){return this.j},set:function(t){this.j=t,this.ht=t instanceof Cn?t.adornedPart:null}},defaultTouchContextMenu:{get:function(){return _d===!1&&sc===null&&Bn&&El(this),sc},set:function(t){t===null&&(_d=!0),sc=t}},currentObject:{get:function(){return this.o},set:function(t){this.o=t}},mouseDownPoint:{get:function(){return this.yw}}});var sc=null,_d=!1,Su=null,ac=null;Hs.className="ContextMenuTool",Wt("contextMenuTool",function(){return this.findTool("ContextMenu")},function(t){this.gb("ContextMenu",t,this.mouseUpTools)});function ar(){kn.call(this),this.name="TextEditing",this.Zh=new Wn,this.ia=null,this.V=$c,this.vj=null,this.qa=Kc,this.u=1,this.F=!0,this.o=null,this.j=new Ua,this.kt=null,zc(this,this.j)}gi(ar,kn);function zc(t,e){if(Bn){var i=te("textarea");t.kt=i,i.addEventListener("input",function(){if(t.textBlock!==null){var n=t.Lx(this.value);this.style.width=20+n.measuredBounds.width*this.wA+"px",this.rows=n.lineCount}},!1),i.addEventListener("keydown",function(n){if(!n.isComposing&&t.textBlock!==null){var s=n.key;s==="Enter"?(t.textBlock.isMultiline===!1&&n.preventDefault(),t.acceptText(lc)):s==="Tab"?(t.acceptText(jc),n.preventDefault()):s==="Escape"&&(t.doCancel(),t.diagram!==null&&t.diagram.doFocus())}},!1),i.addEventListener("focus",function(){if(t.currentTextEditor!==null&&t.state!==Kc){var n=t.kt;t.qa===uc&&(t.qa=hc),typeof n.select=="function"&&t.selectsTextOnActivate&&(n.select(),n.setSelectionRange(0,9999))}},!1),i.addEventListener("blur",function(){if(t.currentTextEditor!==null&&t.state!==Kc){var n=t.kt;typeof n.focus=="function"&&n.focus(),typeof n.select=="function"&&t.selectsTextOnActivate&&(n.select(),n.setSelectionRange(0,9999))}},!1),e.valueFunction=function(){return i.value},e.mainElement=i,e.show=function(n,s,a){if(n instanceof Wn&&a instanceof ar)if(a.state===cc)i.style.border="3px solid red",i.focus();else{var l=n.ga(on),c=s.position,f=s.scale,m=n.Df()*f;m<a.minimumEditorScale&&(m=a.minimumEditorScale);var v=n.naturalBounds.width*m+6,w=n.naturalBounds.height*m+2,C=(l.x-c.x)*f;l=(l.y-c.y)*f,c=n.verticalAlignment,f=(n.lineHeight+n.spacingAbove+n.spacingBelow)*n.lineCount*m,w=c.y*w-c.y*f+c.offsetY-(.5*w-.5*f)-f/2,i.value=n.text,s.div.style.font=n.font,i.style.position="absolute",i.style.zIndex="100",i.style.font="inherit",i.style.fontSize=100*m+"%",i.style.lineHeight="normal",i.style.width=v+"px",i.style.left=(C-v/2|0)-1+"px",i.style.top=(l+w|0)-1+"px",i.style.textAlign=n.textAlign,i.style.margin="0",i.style.padding="1px",i.style.border="0",i.style.outline="none",i.style.whiteSpace="pre-wrap",i.style.overflow="hidden",i.rows=n.lineCount,i.wA=m,i.className="goTXarea",s.div.appendChild(i),i.focus(),a.selectsTextOnActivate&&(i.select(),i.setSelectionRange(0,9999))}},e.hide=function(n){n.div.removeChild(i)}}}ar.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;if(t===null||t.isReadOnly||Gu&&Gu!==this&&(Gu.acceptText(ru),Gu&&Gu!==this)||!t.lastInput.left||this.isBeyondDragSize())return!1;var e=t.ic(t.lastInput.documentPoint);return e!==null&&e instanceof Wn&&e.editable&&e.part.canEdit()?(e=e.part,!(e===null||this.starting===$c&&!e.isSelected||this.starting===If&&2>t.lastInput.clickCount)):!1},ar.prototype.doStart=function(){Gu=this,this.textBlock!==null&&this.doActivate()},ar.prototype.doActivate=function(){if(!this.isActive){var t=this.diagram;if(t!==null){var e=this.textBlock;if(e===null&&(e=t.ic(t.lastInput.documentPoint)),e!==null&&e instanceof Wn&&(this.textBlock=e,e.part!==null)){t.animationManager.Cc(),this.isActive=!0,this.qa=uc;var i=this.defaultTextEditor;e.textEditor!==null&&(i=e.textEditor),this.Zh=this.textBlock.copy();var n=new It(this.textBlock.ga(An),this.textBlock.ga(Go));t.tv(n),i.show(e,t,this),this.currentTextEditor=i}}}},ar.prototype.doCancel=function(){this.stopTool()},ar.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()},ar.prototype.doMouseDown=function(){this.isActive&&this.acceptText(ru)},ar.prototype.acceptText=function(t){switch(t){case ru:this.qa===Hc?this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus():(this.qa===uc||this.qa===cc||this.qa===hc)&&(this.qa=Td,zp(this));break;case Df:case lc:case jc:(lc!==t||this.textBlock.isMultiline!==!0)&&(this.qa===uc||this.qa===cc||this.qa===hc)&&(this.qa=Td,zp(this))}};function zp(t){var e=t.textBlock,i=t.diagram,n=t.currentTextEditor;if(e!==null&&n!==null){var s=e.text,a="";n.valueFunction!==null&&(a=n.valueFunction()),t.isValidText(e,s,a)?(t.Ea(t.name),t.qa=Hc,t.transactionResult=t.name,e.text=a,t.doSuccess(s,a),i!==null&&i.R("TextEdited",e,s),t.stopTransaction(),t.stopTool(),i!==null&&i.doFocus()):(t.qa=cc,t.doError(s,a))}}ar.prototype.doError=function(t,e){var i=this.textBlock;i.errorFunction!==null&&i.errorFunction(this,t,e),(t=this.currentTextEditor)&&t.show(i,this.diagram,this)},ar.prototype.doSuccess=function(t,e){var i=this.textBlock;i.textEdited!==null&&i.textEdited(i,t,e)},ar.prototype.doDeactivate=function(){var t=this.diagram;t!==null&&(this.qa=Kc,this.currentTextEditor!==null&&this.currentTextEditor.hide(t,this),this.textBlock=null,this.isActive=!1)},ar.prototype.doStop=function(){Gu=null},ar.prototype.isValidText=function(t,e,i){var n=this.textValidation;return n!==null&&!n(t,e,i)?!1:(n=t.textValidation,!!(n===null||n(t,e,i)))},ar.prototype.Lx=function(t){var e=this.Zh;return e.text=t,e.measure(this.textBlock.Ih,1/0),e},ct.Object.defineProperties(ar.prototype,{textBlock:{get:function(){return this.ia},set:function(t){this.ia=t}},currentTextEditor:{get:function(){return this.o},set:function(t){this.o=t}},defaultTextEditor:{get:function(){return this.j},set:function(t){this.j=t}},starting:{get:function(){return this.V},set:function(t){this.V=t}},textValidation:{get:function(){return this.vj},set:function(t){this.vj=t}},minimumEditorScale:{get:function(){return this.u},set:function(t){this.u=t}},selectsTextOnActivate:{get:function(){return this.F},set:function(t){this.F=t}},state:{get:function(){return this.qa},set:function(t){this.qa!==t&&(this.qa=t)}}}),ar.prototype.measureTemporaryTextBlock=ar.prototype.Lx;var Df=new mt(ar,"LostFocus",0),ru=new mt(ar,"MouseDown",1),jc=new mt(ar,"Tab",2),lc=new mt(ar,"Enter",3),jp=new mt(ar,"SingleClick",0),$c=new mt(ar,"SingleClickSelected",1),If=new mt(ar,"DoubleClick",2),Kc=new mt(ar,"StateNone",0),uc=new mt(ar,"StateActive",1),hc=new mt(ar,"StateEditing",2),Td=new mt(ar,"StateValidating",3),cc=new mt(ar,"StateInvalid",4),Hc=new mt(ar,"StateValidated",5),Gu=null;ar.className="TextEditingTool",ar.LostFocus=Df,ar.MouseDown=ru,ar.Tab=jc,ar.Enter=lc,ar.SingleClick=jp,ar.SingleClickSelected=$c,ar.DoubleClick=If,ar.StateNone=Kc,ar.StateActive=uc,ar.StateEditing=hc,ar.StateValidating=Td,ar.StateInvalid=cc,ar.StateValidated=Hc,Wt("textEditingTool",function(){return this.findTool("TextEditing")},function(t){this.gb("TextEditing",t,this.mouseUpTools)});function qs(t){Yu||(Z0(),Yu=!0),this.H=fr,this.Ok=this.zb=this.vq=this.bc=!1,this.Qw=!0,this.Pk=la,this.Dm=!1,this.Gh=this.Jd=!0,this.Dg=600,this.cw=this.Ow=!1,this.Zd=new At,this.ce=new ms,this.ce.Yd=this,this.Ei=new At,this.pu=new At,this.Sr=new At,this.pr=new At,t&&Object.assign(this,t)}qs.prototype.Xe=function(t){this.H=t},qs.prototype.canStart=function(){return!0};function Mu(t,e){t.Jd&&t.canStart(e)&&(t.Zd.add(e),t.defaultAnimation.isAnimating&&t.Cc(),bo(t.H),t.zb=!0)}function Of(t){if(t.Jd&&t.zb){var e=t.ce,i=t.H,n=t.Zd.contains("Model");n&&(t.Ok=!0,t.Pk===la?(e.isViewportUnconstrained=!0,e.vc.clear(),e.add(i,"position",i.position.copy().offset(0,-200),i.position),e.add(i,"opacity",0,1)):t.Pk===Ju&&e.vc.clear(),t.Qw=!!(t.Pk===Rf&&i.du.D(i.pa)),i.R("InitialAnimationStarting",t)),n&&!t.Gh||e.vc.count===0?(t.Zd.clear(),t.zb=!1,e.vc.clear(),Wc(e,i),t.Ok=!1,i.N()):(t.Zd.clear(),i.kg=!1,n=e.vc.get(i),i.autoScale!==Jo&&n!==null&&(delete n.start.scale,delete n.end.scale),Z.requestAnimationFrame(function(){t.zb===!1||e.bc||(i.Gf("temporaryPixelRatio")&&os(i),Y0(i),t.zb=!1,e.start(),e.bc&&(ba(t),i.Ya(),zf(e,0),Vs(i,!0),dc(t),i.R("AnimationStarting",t)))}))}}function Xu(t){return t.Zd.contains("Trigger")&&t.Zd.count===1}function Bf(t,e,i,n){t.isTicking||Xu(t)||e instanceof ue&&(e.fromNode!==null||e.toNode!==null)||t.ce.add(e,"position",i,n,!1)}T=qs.prototype,T.fv=function(t){return this.ce.fv(t)},T.Xu=function(t){return this.ce.Xu(t)};function Vc(t,e){function i(){if(0<s.Sr.count&&(n.addAll(s.Sr),s.Sr.clear(),s.bc=!0),s.bc!==!1&&n.count!==0){s.pu.addAll(n);for(var a=s.pu.iterator;a.next();){var l=a.value;if(l.bc!==!1){t:if(0<l.yl.count)var c=!0;else{for(c=l.vc.iterator;c.next();){var f=c.key;if(f instanceof at&&f.diagram!==null||f instanceof wt){c=!0;break t}}c=!1}c?Qu(l,!1):l.Xk=!0}}s.pu.clear(),s.bc!==!1&&(ba(s),Vs(s.H),dc(s)),Z.requestAnimationFrame(i)}}var n=t.Ei,s=t;t.bc?t.Sr.add(e):(t.bc=!0,n.add(e),Z.requestAnimationFrame(function(){i()}))}function wn(t){for(t=t.Ei.iterator;t.next();)t.value.Xk=!1}function ba(t){if(!t.vq){var e=t.H;t.Ow=e.skipsUndoManager,t.cw=e.skipsModelSourceBindings,e.skipsUndoManager=!0,e.skipsModelSourceBindings=!0,t.vq=!0}}function dc(t){var e=t.H;e.skipsUndoManager=t.Ow,e.skipsModelSourceBindings=t.cw,t.vq=!1}T.Cc=function(t){var e=this.ce;if(this.zb===!0&&(this.Ok=this.zb=!1,this.Zd.clear(),0<e.vc.count&&this.H.$b()),this.bc){if(e.Ml(!0),e.vc.clear(),Wc(e,null),t===!0)for(t=this.Ei.Fa(),e=0;e<t.length;e++)t[e].Ml(!0)}else e.vc.clear(),Wc(e,this.H)},T.Ml=function(t){t===this.defaultAnimation&&this.defaultAnimation.vc.clear(),this.Ei.remove(t),this.Ei.count===0&&(this.bc=!1,this.H.$b()),t===this.defaultAnimation&&(this.defaultAnimation.vc.clear(),this.H.R("AnimationFinished",this))},T.Cj=function(t,e){this.zb&&(this.Zd.contains("Expand Tree")||this.Zd.contains("Expand SubGraph"))&&(this.ce.Cj(t,e),Is(this,t))},T.Aj=function(t,e){this.zb&&(this.Zd.contains("Collapse Tree")||this.Zd.contains("Collapse SubGraph"))&&(this.ce.Aj(t,e),qu(this.ce,e,"position",e.position,e.position),Is(this,t))};function U0(t,e,i){!t.zb||e.D(i)||Xu(t)||(t.H.pi||(e=i.copy()),qu(t.ce,t.H,"position",e,i))}function Sa(t,e,i){e.fd&&(e.Tg=i,t.pr.add(e))}function Is(t,e){for(e=e.findLinksConnected();e.next();){var i=e.value;i.fd&&(i.Tg=i.points.copy(),t.pr.add(i))}}function fc(t,e,i,n,s){t===null&&(t=[0,0,0,0]),e===null&&(e=[0,0,0,0]);var a=t[0],l=t[1],c=t[2];t=t[3];var f=e[0],m=e[1],v=e[2];return e=e[3],c===0||c===100?(a=f,l=m):(v===0||v===100)&&(f=a,m=l),180<Math.abs(f-a)&&(f>a?a+=360:f+=360),a=s(i,a,f-a,n)%360,l=s(i,l,m-l,n),c=s(i,c,v-c,n),i=s(i,t,e-t,n),"hsla("+a+", "+l+"%, "+c+"%, "+i+")"}function Z0(){function t(i,n,s,a,l,c){i.position=new z(a(l,n.x,s.x-n.x,c),a(l,n.y,s.y-n.y,c))}var e=new pe;e.add("position:diagram",t),e.add("position",t),e.add("position:part",function(i,n,s,a,l,c){l<c?i.mm(a(l,n.x,s.x-n.x,c),a(l,n.y,s.y-n.y,c),!1):i.position=new z(a(l,n.x,s.x-n.x,c),a(l,n.y,s.y-n.y,c))}),e.add("location",function(i,n,s,a,l,c){l<c?i.mm(a(l,n.x,s.x-n.x,c),a(l,n.y,s.y-n.y,c),!0):i.location=new z(a(l,n.x,s.x-n.x,c),a(l,n.y,s.y-n.y,c))}),e.add("position:placeholder",function(i,n,s,a,l,c){l<c?i.mm(a(l,n.x,s.x-n.x,c),a(l,n.y,s.y-n.y,c),!1):i.position=new z(a(l,n.x,s.x-n.x,c),a(l,n.y,s.y-n.y,c))}),e.add("position:nodeCollapse",function(i,n,s,a,l,c){var f=i.actualBounds,m=s.actualBounds;s=m.x+m.width/2-f.width/2,f=m.y+m.height/2-f.height/2,l<c?i.mm(a(l,n.x,s-n.x,c),a(l,n.y,f-n.y,c),!1):i.position=new z(a(l,n.x,s-n.x,c),a(l,n.y,f-n.y,c))}),e.add("desiredSize",function(i,n,s,a,l,c){i.desiredSize=new It(a(l,n.width,s.width-n.width,c),a(l,n.height,s.height-n.height,c))}),e.add("width",function(i,n,s,a,l,c){i.width=a(l,n,s-n,c)}),e.add("height",function(i,n,s,a,l,c){i.height=a(l,n,s-n,c)}),e.add("fill",function(i,n,s,a,l,c){i.fill=fc(n,s,l,c,a)}),e.add("stroke",function(i,n,s,a,l,c){i.stroke=fc(n,s,l,c,a)}),e.add("strokeWidth",function(i,n,s,a,l,c){i.strokeWidth=a(l,n,s-n,c)}),e.add("strokeDashOffset",function(i,n,s,a,l,c){i.strokeDashOffset=a(l,n,s-n,c)}),e.add("background",function(i,n,s,a,l,c){i.background=fc(n,s,l,c,a)}),e.add("areaBackground",function(i,n,s,a,l,c){i.areaBackground=fc(n,s,l,c,a)}),e.add("opacity",function(i,n,s,a,l,c){i.opacity=a(l,n,s-n,c)}),e.add("scale",function(i,n,s,a,l,c){i.scale=a(l,n,s-n,c)}),e.add("angle",function(i,n,s,a,l,c){i.angle=a(l,n,s-n,c)}),Ff=e}ct.Object.defineProperties(qs.prototype,{animationReasons:{get:function(){return this.Zd}},isEnabled:{get:function(){return this.Jd},set:function(t){(this.Jd=t)&&this.Ei.each(function(e){e.isAnimating||e.runCount!==1/0||e.start()})}},duration:{get:function(){return this.Dg},set:function(t){1>t&&me(t,">= 1",qs,"duration"),this.Dg=t}},isAnimating:{get:function(){return this.bc}},isTicking:{get:function(){return this.vq}},isInitial:{get:function(){return this.Gh},set:function(t){this.Gh=t}},defaultAnimation:{get:function(){return this.ce}},activeAnimations:{get:function(){return this.Ei}},initialAnimationStyle:{get:function(){return this.Pk},set:function(t){this.Pk=t}}}),qs.prototype.stopAnimation=qs.prototype.Cc;var Ff=null,Yu=!1,la=new mt(qs,"Default",1),Rf=new mt(qs,"AnimateLocations",2),Ju=new mt(qs,"None",3);qs.className="AnimationManager",qs.defineAnimationEffect=function(t,e){Yu||(Z0(),Yu=!0),Ff.add(t,e)},qs.Default=la,qs.AnimateLocations=Rf,qs.None=Ju;function ms(t){this.vu=this.Nw=this.Yd=this.H=null,this.Xk=this.bc=this.j=!1,this.cn=this.Qd=0,this.Lp=this.ot=mc,this.Wk=this.ho=!1,this.cu=1,this.au=0,this.Gd=this.Dg=NaN,this.gw=0,this.dn=null,this.o=fn,this.vc=new pe,this.Tt=new pe,this.yl=new At,this.Ut=new At,this.dw=ah,t&&Object.assign(this,t)}ms.prototype.suspend=function(){this.Xk=!0},ms.prototype.advanceTo=function(t,e){e&&(this.Xk=!1),this.ho&&t>=this.Gd&&(this.Wk=!0,t-=this.Gd),this.gw=t,Qu(this,!0),ba(this.Yd),Vs(this.H),dc(this.Yd),this.H.redraw()};function Wc(t,e){if(t.Tt.clear(),t.Wk=!1,t.au=0,t.Gd=NaN,0<t.yl.count&&t.yl.clear(),0<t.Ut.count&&t.Ut.clear(),e!==null)for(t=e.links;t.next();)t.value.Tg=null}T=ms.prototype,T.start=function(){if(this.vc.count===0||this.bc)return this;for(var t=this.H,e=this.vc.iterator;e.next();){var i=e.key;t===null&&(i instanceof wt?t=i:i instanceof at&&(t=i.diagram))}if(t!==null)this.H=t,this.Yd=t.animationManager;else return this;return e=this.Yd,e.isEnabled===!1?this:(this.Gd=isNaN(this.Dg)?e.duration:this.Dg,this.Lp=this.ot,e.Ok&&e.Pk===la&&this===e.defaultAnimation&&(this.Lp=G0,this.Gd=isNaN(this.Dg)?e.duration===600?900:e.duration:this.Dg),this.dw=t.scrollMode,this.isViewportUnconstrained&&(t.sj=Rd),ba(e),this.yl.each(function(n){n.data=null,t.add(n)}),dc(e),this.bc=!0,this.Qd=+new Date,this.cn=this.Qd+this.Gd,Vc(e,this),this)},T.Iy=function(t,e){return t.Zc()?(this.yl.add(t),this.H=e,this):this},T.add=function(t,e,i,n,s){if(e==="position"&&i.Xa(n))return this;if(this.H===null&&(t instanceof wt?this.H=t:t instanceof at&&t.diagram!==null&&(this.H=t.diagram)),t instanceof ui){if(!t.isAnimated)return this;e==="position"&&(e="position:part")}return qu(this,t,e,i,n,s),this};function qu(t,e,i,n,s,a){var l=t.vc;if(e instanceof wt&&i==="position"&&(i="position:diagram"),(i==="fill"||i==="stroke"||i==="background"||i==="areaBackground")&&(jh(n),jv(),n=[qa.j,qa.u,qa.o,qa.F],jh(s),jv(),s=[qa.j,qa.u,qa.o,qa.F]),l.contains(e)){var c=l.I(e),f=c.start,m=c.end;f[i]===void 0&&(f[i]=pc(n)),m[i]=pc(s)}else f={},m={},f[i]=pc(n),m[i]=pc(s),c=f.position,e instanceof at&&c instanceof z&&!c.w()&&e.diagram.animationManager.Zd.contains("Expand SubGraph")&&c.assign(m.position),c=new Uc(f,m,a),l.add(e,c);l=f[i],l instanceof z&&!l.w()&&l.assign(t.o),a&&i.indexOf("position:")===0&&e instanceof ui?c.Ku.location=pc(e.location):a&&(c.Ku[i]=pc(n))}function pc(t){return t instanceof z||t instanceof ii?t.copy():t}T.fv=function(t){return this.bc?(t=this.vc.I(t),t!==null&&t.nv):!1},T.Xu=function(t){return this.bc?(t=this.vc.I(t),t!==null&&(t.start.position||t.start.location)):!1};function Qu(t,e){if(!t.Xk||e){var i=t.Yd;if(t.bc!==!1){var n=+new Date,s=n>t.cn?t.Gd:n-t.Qd;e&&(s=t.gw,s<t.Gd?(t.Qd=+new Date-s,t.cn=t.Qd+t.Gd):s=t.Gd),ba(i),zf(t,s),Vs(t.H,!0),dc(i),n>t.cn&&(t.ho&&!t.Wk?(t.Qd=+new Date,t.cn=t.Qd+t.Gd,t.Wk=!0):t.Ml(!1))}}}function zf(t,e){for(var i=t.Gd,n=t.vc.iterator,s=t.Wk;n.next();){var a=n.key;if(!(a instanceof at&&a.diagram===null)){var l=n.value,c=s?l.end:l.start;l=s?l.start:l.end;var f=Ff,m;for(m in l)m==="position"&&(l["position:placeholder"]||l["position:nodeCollapse"])||f.get(m)===null||f.get(m)(a,c[m],l[m],t.Lp,e,i,t)}}}T.stop=function(){return this.bc?(this.Ml(!0),this):this},T.Ml=function(t){if(this.vu!==null&&this.vu.jo.remove(this.Nw),this.bc){var e=this.H,i=this.Yd;this.Xk=this.bc=i.Ok=!1,ba(i);for(var n=this.vc,s=this.yl.iterator;s.next();)e.remove(s.value);for(s=this.Ut.iterator;s.next();)s.value.v();s=this.ho,n=n.iterator;for(var a=Ff;n.next();){var l=n.key,c=n.value,f=s?c.end:c.start,m=s?c.start:c.end,v=c.Ku,w;for(w in m)if(a.get(w)!==null){var C=w;!c.Hu||C!=="position:nodeCollapse"&&C!=="position:placeholder"||(C="position"),a.get(C)(l,f[w],v[w]!==void 0?v[w]:c.Hu?f[w]:m[w],this.Lp,this.Gd,this.Gd,this)}c.Hu&&v.location!==void 0&&l instanceof ui&&(l.location=v.location),c.nv&&l instanceof ui&&l.Zb(!1)}if(e.As.clear(),Nd(e,!1),e.Ya(),e.N(),Vs(e,!0),i.defaultAnimation===this){for(w=i.pr.iterator;w.next();)s=w.value,s.Tg!==null&&(s.points=s.Tg,s.Tg=null);i.pr.clear()}Vs(e,!0),this.isViewportUnconstrained&&(e.scrollMode=this.dw),dc(i),this.au++,!t&&this.cu>this.au?(this.Wk=!1,this.start()):(this.dn&&this.dn(this),Wc(this,null),i.Ml(this),e.$b())}},T.Cj=function(t,e){var i=e.actualBounds,n=null;if(e instanceof ji&&(n=e.placeholder),n!==null?(i=n.ga(An),n=n.padding,i.x+=n.left,i.y+=n.top,this.add(t,"position",i,t.position,!1)):this.add(t,"position",new z(i.x+i.width/2,i.y+i.height/2),t.position,!1),this.add(t,"scale",.01,t.scale,!1),t instanceof ji)for(t=t.memberParts;t.next();)n=t.value,n instanceof Le&&this.Cj(n,e)},T.Aj=function(t,e){if(t.isVisible()){var i=null;if(e instanceof ji&&(i=e.placeholder),i!==null){var n=i.ga(An);i=i.padding,n.x+=i.left,n.y+=i.top,this.add(t,"position:placeholder",t.position,n,!0)}else this.add(t,"position:nodeCollapse",t.position,e,!0);if(this.add(t,"scale",t.scale,.01,!0),n=this.vc,n.contains(t)&&(n.I(t).nv=!0),t instanceof ji)for(t=t.memberParts;t.next();)n=t.value,n instanceof Le&&this.Aj(n,e)}},T.Ez=function(t){var e=this.Tt.get(t);return e===null&&(e={},this.Tt.add(t,e)),e},ct.Object.defineProperties(ms.prototype,{duration:{get:function(){return this.Dg},set:function(t){1>t&&me(t,">= 1",ms,"duration"),this.Dg=t}},reversible:{get:function(){return this.ho},set:function(t){this.ho=t}},runCount:{get:function(){return this.cu},set:function(t){0<t?this.cu=t:lt("Animation.runCount value must be a positive integer.")}},finished:{get:function(){return this.dn},set:function(t){this.dn!==t&&(this.dn=t)}},easing:{get:function(){return this.ot},set:function(t){this.ot=t}},isViewportUnconstrained:{get:function(){return this.j},set:function(t){this.j=t}},isAnimating:{get:function(){return this.bc}}}),ms.prototype.getTemporaryState=ms.prototype.Ez,ms.prototype.stop=ms.prototype.stop,ms.prototype.add=ms.prototype.add,ms.prototype.addTemporaryPart=ms.prototype.Iy;function mc(t,e,i,n){return t/=n/2,1>t?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e}function G0(t,e,i,n){return t===n?e+i:i*(-Math.pow(2,-10*t/n)+1)+e}ms.className="Animation",ms.EaseLinear=function(t,e,i,n){return i*t/n+e},ms.EaseInOutQuad=mc,ms.EaseInQuad=function(t,e,i,n){return i*(t/=n)*t+e},ms.EaseOutQuad=function(t,e,i,n){return-i*(t/=n)*(t-2)+e},ms.EaseInExpo=function(t,e,i,n){return t===0?e:i*Math.pow(2,10*(t/n-1))+e},ms.EaseOutExpo=G0;function Uc(t,e,i){this.start=t,this.end=e,this.Ku={},this.Hu=i,this.nv=!1}Uc.className="AnimationState";function zl(t,e,i){this.xd=null,this.rf=t,this.so=i||Pd,this.uk=null,e!==void 0&&(this.uk=e,i===void 0&&(this.so=Zc))}zl.prototype.copy=function(){var t=new zl(this.rf);t.so=this.so;var e=this.uk;if(e!==null){var i={};e.duration!==void 0&&(i.duration=e.duration),e.finished!==void 0&&(i.finished=e.finished),e.easing!==void 0&&(i.easing=e.easing),t.uk=i}return t};function mg(t,e){t=t.uk,t!==null&&(t.duration&&(e.duration=t.duration),t.finished&&(e.finished=t.finished),t.easing&&(e.easing=t.easing))}ct.Object.defineProperties(zl.prototype,{propertyName:{get:function(){return this.rf},set:function(t){this.rf=t}},animationSettings:{get:function(){return this.uk},set:function(t){this.uk=t}},startCondition:{get:function(){return this.so},set:function(t){this.so=t}}});var Pd=new mt(zl,"Default",1),Zc=new mt(zl,"Immediate",2),Nh=new mt(zl,"Bundled",3);zl.className="AnimationTrigger",zl.Default=Pd,zl.Immediate=Zc,zl.Bundled=Nh;function Ho(t){vi(this),this.H=null,this.Pa=new Kt,this.xa="",this.pb=1,this.o=!1,this.j=this.Uh=this.u=this.Oi=this.Ni=this.Mi=this.Li=this.Ji=this.Ki=this.Ii=this.Qi=this.Hi=this.Pi=this.Gi=this.Fi=!0,this.Zq=[],t&&Object.assign(this,t)}T=Ho.prototype,T.clear=function(){for(var t=this.Pa,e=0;e<t.length;e++){var i=t.s[e];i.Ig=null,gs(i)}t.clear(),this.Zq.length=0},T.Xe=function(t){this.H=t},T.toString=function(t){t===void 0&&(t=0);var e='Layer "'+this.name+'"';if(0>=t)return e;for(var i=0,n=0,s=0,a=0,l=0,c=this.Pa.iterator;c.next();){var f=c.value;f instanceof ji?s++:f instanceof Le?n++:f instanceof ue?a++:f instanceof Cn?l++:i++}if(c="",0<i&&(c+=i+" Parts "),0<n&&(c+=n+" Nodes "),0<s&&(c+=s+" Groups "),0<a&&(c+=a+" Links "),0<l&&(c+=l+" Adornments "),1<t)for(t=this.Pa.iterator;t.next();)i=t.value,c+=`
`+i.toString(),n=i.data,n!==null&&Ti(n)&&(c+=" #"+Ti(n)),i instanceof Le?c+=" "+ni(n):i instanceof ue&&(c+=" "+ni(i.fromNode)+" "+ni(i.toNode));return e+" "+this.Pa.count+": "+c},T.ic=function(t,e,i){if(e===void 0&&(e=null),i===void 0&&(i=null),this.Uh===!1)return null;var n=!1;this.diagram!==null&&this.diagram.viewportBounds.ca(t)&&(n=!0);for(var s=z.alloc(),a=this.Pa.s,l=a.length;l--;){var c=a[l];if((n!==!0||ad(c)!==!1)&&c.isVisible()&&(s.assign(t),Ji(s,c.oe),c=c.ic(s,e,i),c!==null&&(e!==null&&(c=e(c)),c!==null&&(i===null||i(c)))))return z.free(s),c}return z.free(s),null},T.ji=function(t,e,i,n){if(e===void 0&&(e=null),i===void 0&&(i=null),n instanceof Kt||n instanceof At||(n=new At),this.Uh===!1)return n;var s=!1;this.diagram!==null&&this.diagram.viewportBounds.ca(t)&&(s=!0);for(var a=z.alloc(),l=this.Pa.s,c=l.length;c--;){var f=l[c];if((s!==!0||ad(f)!==!1)&&f.isVisible()){a.assign(t),Ji(a,f.oe);var m=f;f.ji(a,e,i,n)&&(e!==null&&(m=e(m)),m===null||i!==null&&!i(m)||n.add(m))}}return z.free(a),n},T.Cf=function(t,e,i,n,s){if(e===void 0&&(e=null),i===void 0&&(i=null),n===void 0&&(n=!1),s instanceof Kt||s instanceof At||(s=new At),this.Uh===!1)return s;var a=!1;this.diagram!==null&&this.diagram.viewportBounds.Re(t)&&(a=!0);for(var l=this.Pa.s,c=l.length;c--;){var f=l[c];if((a!==!0||ad(f)!==!1)&&f.isVisible()){var m=f;f.Cf(t,e,i,n,s)&&(e!==null&&(m=e(m)),m===null||i!==null&&!i(m)||s.add(m))}}return s},T.Nu=function(t,e,i,n,s,a,l){if(this.Uh===!1)return s;for(var c=this.Pa.s,f=c.length;f--;){var m=c[f];if((l!==!0||ad(m)!==!1)&&a(m)&&m.isVisible()){var v=m;m.Cf(t,e,i,n,s)&&(e!==null&&(v=e(v)),v===null||i!==null&&!i(v)||s.add(v))}}return s},T.og=function(t,e,i,n,s,a){if(i===void 0&&(i=null),n===void 0&&(n=null),s===void 0&&(s=!0),s!==!1&&s!==!0&&((s instanceof Kt||s instanceof At)&&(a=s),s=!0),a instanceof Kt||a instanceof At||(a=new At),this.Uh===!1)return a;var l=!1;this.diagram!==null&&this.diagram.viewportBounds.ca(t)&&(l=!0);for(var c=z.alloc(),f=z.alloc(),m=this.Pa.s,v=m.length;v--;){var w=m[v];if((l!==!0||ad(w)!==!1)&&w.isVisible()){c.assign(t),Ji(c,w.oe),f.h(t.x+e,t.y),Ji(f,w.oe);var C=w;w.og(c,f,i,n,s,a)&&(i!==null&&(C=i(C)),C===null||n!==null&&!n(C)||a.add(C))}}return z.free(c),z.free(f),a},T.Fd=function(t,e){if(this.visible){var i=this.Pa.s,n=i.length;if(n!==0){t=Pe();for(var s=Pe(),a=0;a<n;a++){var l=i[a];if(l.vw=a,l instanceof ue){if(l.fd===!1)continue}else if(l instanceof Cn&&l.adornedPart!==null)continue;var c=l.actualBounds;l.isVisible()&&oa(c,e)?(l.Fd(!0),t.push(l)):(l.Fd(!1),l.adornments!==null&&0<l.adornments.count&&s.push(l))}for(e=0;e<t.length;e++)for(i=t[e],_m(i),i=i.adornments;i.next();)n=i.value,n.measure(1/0,1/0),n.arrange(),n.Fd(!0);for(e=0;e<s.length;e++)_m(s[e]);qe(t),qe(s)}}};function th(t,e){var i=1;return t.pb!==1&&(i=e.globalAlpha,e.globalAlpha=i*t.pb),i}T.gc=function(t,e,i){if(this.visible&&this.pb!==0&&(i===void 0&&(i=!0),i||!this.isTemporary)){i=this.Pa.s;var n=i.length;if(n!==0){if(t.isTemporary)for(var s=0;s<n;s++)i[s].Gj();s=th(this,t);var a=this.Zq;a.length=0;for(var l=e.scale,c=It.alloc(),f=0;f<n;f++)this.Oj(t,i[f],e,a,l,c,!0);if(It.free(c),t.isTemporary)for(e=0;e<n;e++)i[e].Gj();t.globalAlpha=s}}};function gg(t,e,i,n,s){if(t.visible&&t.pb!==0&&(s||!t.isTemporary)){s=t.Pa.s;var a=s.length;if(a!==0){var l=th(t,e),c=t.Zq;c.length=0;for(var f=i.scale,m=It.alloc(),v=0;v<a;v++){var w=s[v];n.contains(w)&&t.Oj(e,w,i,c,f,m,!1)}It.free(m),e.globalAlpha=l}}}T.Oj=function(t,e,i,n,s,a,l){if(l&&!ad(e))t.Hs(e);else{if(n!==null&&e instanceof ue&&(e.isOrthogonal&&n.push(e),e.fd===!1)){t.Hs(e);return}for(l=!1,n=e.containingGroup;n!==null;)l?n.tb!==null&&a.Ex(n.tb):n.tb!==null&&(l=!0,a.assign(n.tb)),n=n.containingGroup;var c=e.actualBounds;if(n=!1,l&&e.isVisible()){if(!a.Yc(c)){t.Hs(e);return}n=!a.Re(c)}n&&(t.save(),t instanceof Bs?t.bk=a.copy():(t.beginPath(),t.rect(a.x,a.y,a.width,a.height),t.clip())),c.width*s>i.Oq||c.height*s>i.Oq?e.gc(t,i):(s=e.actualBounds,a=e.naturalBounds,s.width===0||s.height===0||isNaN(s.x)||isNaN(s.y)||!e.isVisible()||(i=e.transform,e.areaBackground!==null&&(Br(e,t,e.areaBackground,!0,!0,a,s),t.fillRect(s.x,s.y,s.width,s.height)),e.areaBackground===null&&e.background===null&&(Br(e,t,"rgba(0,0,0,0.3)",!0,!1,a,s),t.fillRect(s.x,s.y,s.width,s.height)),e.background!==null&&(t.transform(i.m11,i.m12,i.m21,i.m22,i.dx,i.dy),Br(e,t,e.background,!0,!1,a,s),t.fillRect(0,0,a.width/2,a.height/2),i.ws()||(e=1/(i.m11*i.m22-i.m12*i.m21),t.transform(i.m22*e,-i.m12*e,-i.m21*e,i.m11*e,e*(i.m21*i.dy-i.m22*i.dx),e*(i.m12*i.dx-i.m11*i.dy)))))),n&&(t.restore(),t.Vc(!0))}},T.g=function(t,e,i,n,s){var a=this.diagram;a!==null&&a.cb(Sr,t,this,e,i,n,s)},T.oi=function(t,e,i){var n=this.Pa;if(e.Ig=this,this===null&&gs(e),t>=n.count)t=n.count;else if(n.M(t)===e)return-1;return n.Gb(t,e),e.Vo(i),n=this.diagram,n!==null&&(i?n.N():n.oi(e)),jf(this,t,e),t},T.pc=function(t,e,i){if(!i&&e.layer!==this&&e.layer!==null)return e.layer.pc(t,e,i);var n=this.Pa;if(0>t||t>=n.length){if(t=n.indexOf(e),0>t)return-1}else if(n.M(t)!==e&&(t=n.indexOf(e),0>t))return-1;return e.Wo(i),n.mb(t),n=this.diagram,n!==null&&(i?n.N():n.pc(e)),e.Ig=null,gs(e),t};function jf(t,e,i){if(e=vg(t,e,i),i instanceof ji&&i!==null&&isNaN(i.zOrder)){if(i.memberParts.count!==0){for(var n=-1,s=t.Pa.s,a=s.length,l=0;l<a;l++){var c=s[l];if(c===i&&(e=l,0<=n)||0>n&&c.containingGroup===i&&(n=l,0<=e))break}!(0>n)&&n<e&&(s=t.Pa,s.mb(e),s.Gb(n,i))}e=i.containingGroup,e!==null&&jf(t,-1,e)}i.svg!==null&&i.svg.remove()}function vg(t,e,i){var n=i.zOrder;if(isNaN(n))return e;t=t.Pa;var s=t.count;if(1>=s)return e;if(0>e&&(e=t.indexOf(i)),0>e)return-1;for(var a=e-1,l=NaN;0<=a&&(l=t.M(a).zOrder,!!isNaN(l));)a--;for(var c=e+1,f=NaN;c<s&&(f=t.M(c).zOrder,!!isNaN(f));)c++;if(!isNaN(l)&&l>n)for(;;){if(a===-1||l<=n){if(a++,a===e)break;return t.mb(e),t.Gb(a,i),a}for(l=NaN;0<=--a&&(l=t.M(a).zOrder,isNaN(l)););}else if(!isNaN(f)&&f<n)for(;;){if(c===s||f>=n){if(c--,c===e)break;return t.mb(e),t.Gb(c,i),c}for(f=NaN;++c<s&&(f=t.M(c).zOrder,isNaN(f)););}return e}ct.Object.defineProperties(Ho.prototype,{parts:{get:function(){return this.Pa.iterator}},partsBackwards:{get:function(){return this.Pa.iteratorBackwards}},diagram:{get:function(){return this.H}},name:{get:function(){return this.xa},set:function(t){var e=this.xa;if(e!==t){var i=this.diagram;if(i!==null)for(e===""&&lt("Cannot rename default Layer to: "+t),i=i.layers;i.next();)i.value.name===t&&lt("Layer.name is already present in this diagram: "+t);for(this.xa=t,this.g("name",e,t),t=this.Pa.iterator;t.next();)t.value.layerName=this.xa}}},opacity:{get:function(){return this.pb},set:function(t){var e=this.pb;e!==t&&((0>t||1<t)&&me(t,"0 <= value <= 1",Ho,"opacity"),this.pb=t,this.g("opacity",e,t),t=this.diagram,t!==null&&t.N())}},isTemporary:{get:function(){return this.o},set:function(t){var e=this.o;e!==t&&((this.o=t)&&(this.isInDocumentBounds=!1),this.g("isTemporary",e,t))}},visible:{get:function(){return this.u},set:function(t){var e=this.u;if(e!==t){for(this.u=t,this.g("visible",e,t),e=this.Pa.iterator;e.next();)e.value.Zb(t);t=this.diagram,t!==null&&t.N()}}},pickable:{get:function(){return this.Uh},set:function(t){var e=this.Uh;e!==t&&(this.Uh=t,this.g("pickable",e,t))}},isInDocumentBounds:{get:function(){return this.j},set:function(t){this.j!==t&&(this.j=t,this.diagram!==null&&this.diagram.Ya())}},allowCopy:{get:function(){return this.Fi},set:function(t){var e=this.Fi;e!==t&&(this.Fi=t,this.g("allowCopy",e,t))}},allowDelete:{get:function(){return this.Gi},set:function(t){var e=this.Gi;e!==t&&(this.Gi=t,this.g("allowDelete",e,t))}},allowTextEdit:{get:function(){return this.Pi},set:function(t){var e=this.Pi;e!==t&&(this.Pi=t,this.g("allowTextEdit",e,t))}},allowGroup:{get:function(){return this.Hi},set:function(t){var e=this.Hi;e!==t&&(this.Hi=t,this.g("allowGroup",e,t))}},allowUngroup:{get:function(){return this.Qi},set:function(t){var e=this.Qi;e!==t&&(this.Qi=t,this.g("allowUngroup",e,t))}},allowLink:{get:function(){return this.Ii},set:function(t){var e=this.Ii;e!==t&&(this.Ii=t,this.g("allowLink",e,t))}},allowRelink:{get:function(){return this.Ki},set:function(t){var e=this.Ki;e!==t&&(this.Ki=t,this.g("allowRelink",e,t))}},allowMove:{get:function(){return this.Ji},set:function(t){var e=this.Ji;e!==t&&(this.Ji=t,this.g("allowMove",e,t))}},allowReshape:{get:function(){return this.Li},set:function(t){var e=this.Li;e!==t&&(this.Li=t,this.g("allowReshape",e,t))}},allowResize:{get:function(){return this.Mi},set:function(t){var e=this.Mi;e!==t&&(this.Mi=t,this.g("allowResize",e,t))}},allowRotate:{get:function(){return this.Ni},set:function(t){var e=this.Ni;e!==t&&(this.Ni=t,this.g("allowRotate",e,t))}},allowSelect:{get:function(){return this.Oi},set:function(t){var e=this.Oi;e!==t&&(this.Oi=t,this.g("allowSelect",e,t))}}}),Ho.prototype.findObjectsNear=Ho.prototype.og,Ho.prototype.findObjectsIn=Ho.prototype.Cf,Ho.prototype.findObjectsAt=Ho.prototype.ji,Ho.prototype.findObjectAt=Ho.prototype.ic,Ho.className="Layer";function wt(t,e){if(bg||(Ro(),bg=!0),vi(this),fr=this,this.vb=!0,this.Ka=null,this.ya=this.Aa=0,this.ta=null,Bn){var i=this,n=function(){i.removeEventListener(Z.document,"DOMContentLoaded",n,!1),i.setRTL()};Z.document.body!==null?this.setRTL():i.addEventListener(Z.document,"DOMContentLoaded",n,!1)}this.ol=null,Vp.add("Model",_n);var s=this;return this.Hb=function(a){var l=s.partManager;if(a.model===l.diagram.model&&l.diagram.aa){l.diagram.aa=!1;try{var c=a.change;a.modelChange===""&&c===Sr&&l.updateDataBindings(a.object,a.propertyName)}finally{l.diagram.aa=!0}}},this.Oc=function(a){s.partManager.doModelChanged(a)},this.hu=this.ku=null,Vo(this),this.model=Wm(),this.Wg=!0,xg(this),this.layout=new pr,this.Wg=!1,this.ck=this.ek=this.fk=this.dk=this.ui=this.aA=this.$j=this.Ov=null,this.hk=function(){},this.preventDefault=null,this.rn=!1,this.Yf=new xc,t!==void 0&&(typeof t=="string"||Z.Element&&t instanceof Element?cl(this,t):e=t),this.vb=!1,e&&this.nm(e),this}var eh,fr;function Vo(t){t.Yd=new qs,t.Yd.Xe(t),t.Db=17,t.Gw=!1,t.tn=!1,t.bu="default",t.Wa=new Kt,t.pj=new pe,t.nl="default",t.Tx(),t.Sx(),t.pb=1,t.pa=new z(NaN,NaN).freeze(),t.du=new z(NaN,NaN),t.Ca=1,t.Pp=1,t.zt=new z(NaN,NaN).freeze(),t.At=NaN,t.Ot=1e-4,t.Mt=100,t.Ab=new nn,t.zu=new z(NaN,NaN).freeze(),t.ut=new It(NaN,NaN,NaN,NaN).freeze(),t.rj=new ai(0,0,0,0).freeze(),t.sj=ah,t.nu=!1,t.Zt=null,t.fu=null,t.yh=Jo,t.zk=zn,t.Fg=Jo,t.pq=zn,t.yt=An,t.Bt=An,t.Fc=!0,t.pn=!1,t.De=new At,t.Eh=new pe,t.Xm=!0,t.vp=250,t.vk=-1,t.xp=new ai(16,16,16,16).freeze(),t.kg=!1,t.Jk=!1,t.fn=!0,t.bq=new As,t.bq.diagram=t,t.Qg=new As,t.Qg.diagram=t,t.cj=new As,t.cj.diagram=t,t.zg=null,t.pf=null,t.qu=!1,rm(t),t.ai=new At,t.Ht=!0,t.uu=yc,t.pw=!1,t.wu=Zf,t.it="auto",t.Op="auto",t.zh=null,t.Fh=null,t.Bh=null,t.Qh=null,t.Oh=null,t.Nh=null,t.Qt=null,t.Lh=null,t.xt=!1,t.Mh=null,t.Ph=null,t.$h=null,t.Ch=null,t.Rt=!1,t.Yt={},t.oj=[null,null],t.Wg=!1,t.Iw=!1,t.ou=!1,t.lt=!1,t.rw=!0,t.ld=!1,t.$i=!1,t.Tw=!0,t.Ce=-2,t.Og=new pe,t.Xn=new Kt,t.Gg=!1,t.Jd=!0,t.Us=!0,t.Fi=!0,t.Gi=!0,t.Vs=!1,t.Ws=!0,t.Pi=!0,t.Hi=!0,t.Qi=!0,t.Ys=!0,t.Ii=!0,t.Ki=!0,t.Ji=!0,t.Li=!0,t.Mi=!0,t.Ni=!0,t.Oi=!0,t.Zs=!0,t.at=!0,t.qw=!1,t.Vk=!1,t.mn=!0,t.nn=!0,t.Xs=!0,t.$s=!0,t.iu=16,t.mu=16,t.qr=!1,t.gu=!1,t.lu=0,t.ju=0,t.yb=new ai(5).freeze(),t.Hw=new At().freeze(),t.Nt=999999999,t.nw=new At().freeze(),t.Zi=!0,t.Ee=!0,t.vd=!0,t.Be=!1,t.gf=!1,t.xh=!0,t.hf=!1,t.sy=new At,t.ow=new At,t.Xh=null,t.aw=new ii(8,8),t.bw=999,t.Bw=1,t.Jw=0,t.fc={scale:1,position:new z,bounds:new It,Py:new ii,bA:new ii,Oz:!1},t.fc.canvasSize=t.fc.Py,t.fc.newCanvasSize=t.fc.bA,t.fc.isScroll=!1,t.Rw=new It(NaN,NaN,NaN,NaN).freeze(),t.wo=new ii(NaN,NaN).freeze(),t.Sp=new It(NaN,NaN,NaN,NaN).freeze(),t.It=!1,t.Lg=new pe;var e=new Le,i=new Wn;i.bind(new Un("text","",ni)),e.add(i),t.ny=e,t.Lg.add("",e),e=new Le,i=new Wn,i.stroke="brown",i.bind(new Un("text","",ni)),e.add(i),t.Lg.add("Comment",e),e=new Le,e.selectable=!1,e.avoidable=!1,i=new Xi,i.figure="Ellipse",i.fill="black",i.stroke=null,i.desiredSize=new ii(3,3).ja(),e.add(i),t.Lg.add("LinkLabel",e),t.Yi=new pe,e=new ji,e.selectionObjectName="GROUPPANEL",e.type=ne.Vertical,i=new Wn,i.font="bold 12pt sans-serif",i.bind(new Un("text","",ni)),e.add(i),i=new ne(ne.Auto),i.name="GROUPPANEL";var n=new Xi;n.figure="Rectangle",n.fill="rgba(128,128,128,0.2)",n.stroke="black",i.add(n),n=new Zs,n.padding=new ai(5,5,5,5).ja(),i.add(n),e.add(i),t.ly=e,t.Yi.add("",e),t.Kh=new pe,e=new ue,i=new Xi,i.isPanelMain=!0,e.add(i),i=new Xi,i.toArrow="Standard",i.fill="black",i.stroke=null,i.strokeWidth=0,e.add(i),t.my=e,t.Kh.add("",e),e=new ue,i=new Xi,i.isPanelMain=!0,i.stroke="brown",e.add(i),t.Kh.add("Comment",e),e=new Cn,e.type=ne.Auto,i=new Xi,i.fill=null,i.stroke="dodgerblue",i.strokeWidth=3,e.add(i),i=new Zs,i.margin=new ai(1.5,1.5,1.5,1.5).ja(),e.add(i),t.St=e,t.wt=e,e=new Cn,e.type=ne.Link,i=new Xi,i.isPanelMain=!0,i.fill=null,i.stroke="dodgerblue",i.strokeWidth=3,e.add(i),t.Kt=e,t.fe=null,t.mq=!1,t.Ck=null,t.partManager=new _n,t.toolManager=new Vn,t.toolManager.initializeStandardTools(),t.defaultTool=t.toolManager,t.currentTool=t.defaultTool,t.nt=null,t.Wm=new p,t.Vt=null,t.Wt=null,t.Mr=!1,t.commandHandler=X0(),t.eq=null,t.fq=Ar,t.Pw=!1,t.Mb=1,t.Yh=null,t.Oq=1,t.Sq=0,t.zw=[0,0,0,0,0],t.Tq=0,t.yq=1,t.tw=0,t.uw=new z,t.zy=500,t.wp=new z,t.wq=!1}wt.prototype.clear=function(){this.animationManager.Cc(),this.model.clear(),Fd=null,Qc="",Ah(this,!1),this.Xn.clear(),d0(),this.Og.clear(),this.Xh=null,this.Ya(),this.Va(),this.N()};function Ah(t,e){t.animationManager.Cc(!0),t.Hw=new At().freeze(),t.nw=new At().freeze();var i=t.skipsUndoManager,n=t.cc!==null&&t.cc!==void 0;n&&(t.skipsUndoManager=!0);var s=null;t.fe!==null&&(s=t.fe.part,s!==null&&t.remove(s));var a=[],l=t.Wa.length;if(e){for(e=0;e<l;e++)for(var c=t.Wa.s[e].parts;c.next();){var f=c.value;f!==s&&f.data===null&&a.push(f)}for(e=0;e<a.length;e++)t.remove(a[e])}for(e=0;e<l;e++)t.Wa.s[e].clear();return t.partManager.clear(),t.De.clear(),t.Eh.clear(),t.ai.clear(),t.Ck=null,t.Xn.clear(),d0(),t.Og.clear(),Ie=[],s!==null&&(t.add(s),t.partManager.parts.remove(s)),n&&(t.skipsUndoManager=i),a}function X0(){return null}wt.prototype.reset=function(){this.clear(),this.vb=!0,Vo(this),Yo(this),this.Wg=!0,xg(this),this.layout=new pr,this.Wg=!1,this.model=Wm(),this.model.undoManager=new Tr,this.vb=this.rn=!1,this.N()},wt.prototype.setRTL=function(t){t=t===void 0?this.div:t,t===null&&(t=Z.document.body);var e=te("div");e.dir="rtl",e.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;",e.textContent="A",t.appendChild(e);var i="reverse";0<e.scrollLeft?i="default":(e.scrollLeft=1,e.scrollLeft===0&&(i="negative")),t.removeChild(e),this.bu=i},wt.prototype.setScrollWidth=function(t){t=t===void 0?this.div:t,t===null&&(t=Z.document.body);var e=0;if(Bn){var i=lm;e=eh,i===null&&(i=lm=te("p"),i.style.width="100%",i.style.height="200px",i.style.boxSizing="content-box",e=eh=te("div"),e.style.position="absolute",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.boxSizing="content-box",e.appendChild(i)),e.style.overflow="hidden",t.appendChild(e);var n=i.offsetWidth;e.style.overflow="scroll",i=i.offsetWidth,n===i&&(i=e.clientWidth),t.removeChild(e),e=n-i,e!==0||re||(e=11)}this.Db=e,this.Gw=!0},wt.prototype.qb=function(t){t.classType===wt&&(this.autoScale=t)},wt.prototype.toString=function(t){t===void 0&&(t=0);var e="";if(this.div&&this.div.id&&(e=this.div.id),e='Diagram "'+e+'"',0>=t)return e;for(var i=this.Wa.iterator;i.next();)e+=`
`+i.value.toString(t-1);return e};function cl(t,e){if(Bn){if(e!=null||lt("Diagram setup requires an argument DIV."),t.Ka!==null&&lt("Diagram has already completed setup."),typeof e=="string"?t.Ka=Z.document.getElementById(e):e instanceof HTMLDivElement?t.Ka=e:lt("No DIV or DIV id supplied: "+e),t.Ka===null&&lt("Invalid DIV id; could not get element with id: "+e),t.Ka.H!==void 0&&lt("Invalid div id; div already has a Diagram associated with it."),!t.ol&&Z.ResizeObserver){var i=Ot(function(){t.$b()},250);t.ol=new Z.ResizeObserver(function(){i()}),t.ol.observe(t.Ka)}Z.getComputedStyle(t.Ka,null).position==="static"&&(t.Ka.style.position="relative"),e=5;var n="rgba(2"+e+"5, 255, 255, 0)";e--,t.Ka.style["-webkit-tap-highlight-color"]=n,t.Ka.innerHTML="",t.Ka.H=t,t.Ka.goDiagram=t,t.Ka.go=Z.go;var s=new Tl(t);if(s.style!==void 0&&(s.style.position="absolute",s.style.top="0px",s.style.left="0px",Z.getComputedStyle(t.Ka,null).getPropertyValue("direction")==="rtl"&&(t.tn=!0),s.style.zIndex="2",s.style.userSelect="none",s.style.MozUserSelect="none",s.style.touchAction="none",s.style.letterSpacing="normal !important",s.style.wordSpacing="normal !important"),t.ta=s,t.ib=s.context,n=t.ib,t.Mb=t.computePixelRatio(),t.viewSize.w()||(t.Aa=t.Ka.clientWidth||1,t.ya=t.Ka.clientHeight||1),q0(t,t.Aa,t.ya),t.Ka.insertBefore(s.Oa,t.Ka.firstChild),s=new Tl(null),s.width=1,s.height=1,t.jw=s,t.oy=s.context,Bn){s=te("div");var a=te("div");s.style.position="absolute",s.style.overflow="auto",s.style.width=t.Aa+"px",s.style.height=t.ya+"px",s.style.zIndex="1",a.style.position="absolute",a.style.width="1px",a.style.height="1px",t.Ka.appendChild(s),s.appendChild(a),s.onscroll=Ad,s.addEventListener("pointerdown",Dd),s.H=t,s.uy=!0,s.vy=!0,t.ku=s,t.hu=a}t.hk=Ot(function(){t.Yh=null,t.N()},300),t.Ov=Ot(function(){Y0(t)},250),t.preventDefault=function(l){return l.preventDefault(),!1},t.$j=function(l){if(t.isEnabled){var c=to(t,l,!0);c.bubbles=!0;var f=0,m=0;c.delta=0,l.deltaX!==void 0?(l.deltaX!==0&&(f=0<l.deltaX?1:-1),l.deltaY!==0&&(m=0<l.deltaY?1:-1),c.delta=Math.abs(l.deltaX)>Math.abs(l.deltaY)?-f:-m):l.wheelDeltaX!==void 0?(l.wheelDeltaX!==0&&(f=0<l.wheelDeltaX?-1:1),l.wheelDeltaY!==0&&(m=0<l.wheelDeltaY?-1:1),c.delta=Math.abs(l.wheelDeltaX)>Math.abs(l.wheelDeltaY)?-f:-m):l.wheelDelta!==void 0&&l.wheelDelta!==0&&(c.delta=0<l.wheelDelta?1:-1),t.doMouseWheel(),Xa(c,l)}},t.aA=function(l){t.isEnabled&&(t.Vk=!1,to(t,l,!0),l=t.currentTool,l.cancelWaitAfter(),l.standardMouseOver())},t.ui=function(l){if(t.isEnabled){t.Vk=!0;var c=t.Yt;c[l.pointerId]===void 0&&(c[l.pointerId]=l),c=t.oj;var f=!1;if(c[0]===null||c[0].pointerId!==l.pointerId&&c[0].pointerType===l.pointerType)if(c[1]!==null&&c[1].pointerId===l.pointerId)c[1]=l,f=!0;else if(c[0]===null)c[0]=l;else if(c[1]===null)c[1]=l,f=!0;else{l.preventDefault();return}else c[0]=l;(c=l.pointerType==="touch"||l.pointerType==="pen")&&(t.qu=!1,t.wq=!0);var m=f;f=Hf(t,l,!0,!1,!0,m),Ih(t,l,f),f.targetDiagram=J0(l,l.target),f.targetObject=null,m||f.clone(t.bq),m=t.uw,c=c?25:10,l.timeStamp-t.tw<t.zy&&!(Math.abs(m.x-l.screenX)>c||Math.abs(m.y-l.screenY)>c)?t.yq++:t.yq=1,f.clickCount=t.yq,t.tw=l.timeStamp,t.uw.sg(l.screenX,l.screenY),t.doMouseDown(),l.button===1?l.preventDefault():Xa(f,l)}},t.dk=function(l){if(t.isEnabled){t.Vk=!0;var c=t.oj;if(c[0]===null||c[0].pointerId!==l.pointerId&&c[0].pointerType===l.pointerType){if(c[1]!==null&&c[1].pointerId===l.pointerId){c[1]=l;return}if(c[0]===null)c[0]=l;else return}else c[0]=l;if(c[0].pointerId===l.pointerId){c=Hf(t,l,!1,!1,!1,c[1]!==null);var f=Z.document.elementFromPoint(l.clientX,l.clientY)||null;f!==null&&f.shadowRoot!==void 0&&f.shadowRoot!==null&&(f=f.shadowRoot.elementFromPoint(l.clientX,l.clientY));var m=t,v=l;f&&f.H&&(v=l,m=f.H),c.targetDiagram=m,Ih(t,v,c),c.targetObject=null,t.doMouseMove(),Xa(c,l)}}},t.fk=function(l){if(t.isEnabled){t.Vk=!0;var c=l.pointerType==="touch"||l.pointerType==="pen",f=t.Yt;if(c&&t.qu)delete f[l.pointerId],l.preventDefault();else if(f=t.oj,f[0]===null||f[0].pointerId!==l.pointerId&&f[0].pointerType===l.pointerType)f[1]!==null&&f[1].pointerId===l.pointerId&&(f[1]=null);else{f[0]=null,f=Hf(t,l,!1,!0,!0,!1);var m=Z.document.elementFromPoint(l.clientX,l.clientY)||null;m!==null&&m.shadowRoot!==void 0&&m.shadowRoot!==null&&(m=m.shadowRoot.elementFromPoint(l.clientX,l.clientY)),m!==null&&m.H instanceof wt&&m.H!==t&&Ih(m.H,l,f),m===null&&(m=l.target),Ih(t,l,f),f.clickCount=t.yq,f.targetDiagram=J0(l,m),f.targetObject=null,t.doMouseUp(),Xa(f,l),c&&(t.wq=!1)}}},t.ek=function(l){if(t.isEnabled){t.Vk=!1;var c=t.Yt;c[l.pointerId]&&delete c[l.pointerId],c=t.oj,c[0]!==null&&c[0].pointerId===l.pointerId&&(c[0]=null),c[1]!==null&&c[1].pointerId===l.pointerId&&(c[1]=null),l.pointerType!=="touch"&&l.pointerType!=="pen"&&(l=t.currentTool,l.cancelWaitAfter(),l.standardMouseOver())}},t.ck=function(l){var c=t.oj;c[0]!==null&&c[0].pointerId===l.pointerId?(c[0]=null,t.wq=!1):c[1]!==null&&c[1].pointerId===l.pointerId&&(c[1]=null)},t.Vp=n.Z["d"+Hl[1]+Hl[2]+"wI"+jd.slice(1,5)]["b"+xx.slice(1,e)](n.Z,Gf,e,e),n.Vc(!0),yg(t),t.nl==="svg"&&(e=t.pj.get("svg"),t.Ka.appendChild(e.Oa),t.ib=e.context)}}wt.prototype.addEventListener=function(t,e,i,n){t.addEventListener(e,i,{capture:n,passive:!1})},wt.prototype.removeEventListener=function(t,e,i,n){t.removeEventListener(e,i,{capture:n})};function yg(t){var e=t.ta.Oa;e instanceof HTMLCanvasElement||(e=t.div),t.addEventListener(e,"pointerdown",t.ui,!1),t.addEventListener(e,"pointermove",t.dk,!1),t.addEventListener(e,"pointerup",t.fk,!1),t.addEventListener(e,"pointerout",t.ek,!1),t.addEventListener(e,"pointercancel",t.ck,!1),t.addEventListener(e,"pointerenter",t.bz,!1),t.addEventListener(e,"pointerleave",t.cz,!1),t.addEventListener(e,"wheel",t.$j,!1),t.addEventListener(e,"keydown",t.Qz,!1),t.addEventListener(e,"keyup",t.Rz,!1),t.addEventListener(e,"blur",t.Ny,!1),t.addEventListener(e,"focus",t.Oy,!1),t.addEventListener(e,"selectstart",function(i){return i.preventDefault(),!1},!1),t.addEventListener(e,"contextmenu",function(i){return i.preventDefault(),!1},!1),t.addEventListener(Z,"resize",t.Ov,!1)}function os(t){30<t.Sq&&(t.Yh=1)}function Nd(t,e){t.Yh!==null&&(t.Yh=null,e&&t.hk(),Ui&&Ui.nx||(t.Sq=0,t.zw=[0,0,0,0,0],t.Tq=0))}wt.prototype.computePixelRatio=function(){return this.Yh!==null?this.Yh:Z.devicePixelRatio||1},wt.prototype.doMouseMove=function(){this.currentTool.doMouseMove()},wt.prototype.doMouseDown=function(){this.currentTool.doMouseDown()},wt.prototype.doMouseUp=function(){this.currentTool.doMouseUp()},wt.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()},wt.prototype.doKeyDown=function(){this.currentTool.doKeyDown()},wt.prototype.doKeyUp=function(){this.currentTool.doKeyUp()},wt.prototype.doFocus=function(){this.focus()},wt.prototype.focus=function(){if(this.ta)if(this.scrollsPageOnFocus)this.ta.focus();else{var t=Z.scrollX||Z.pageXOffset,e=Z.scrollY||Z.pageYOffset;this.ta.focus(),Z.scrollTo(t,e)}},wt.prototype.Oy=function(){this.H.R("GainedFocus")},wt.prototype.Ny=function(){this.H.R("LostFocus")};function Y0(t){if(t.ta!==null){var e=t.Ka;if(e!==null&&e.clientWidth!==0&&e.clientHeight!==0){t.Gw||t.setScrollWidth();var i=t.gf?t.Db:0,n=t.Be?t.Db:0,s=t.Mb;t.Mb=t.computePixelRatio(),t.Mb!==s&&(t.pn=!0,t.$b()),(e.clientWidth!==t.Aa+i||e.clientHeight!==t.ya+n)&&(t.Ee=!0,t.Fc=!0,e=t.layout,e!==null&&e.isViewportSized&&t.autoScale===Jo&&(t.Jk=!0,e.C()),t.ld||t.$b())}}}function xg(t){var e=new Ho;e.name="Background",t.Al(e),e=new Ho,e.name="",t.Al(e),e=new Ho,e.name="Foreground",t.Al(e),e=new Ho,e.name="Adornment",e.isTemporary=!0,e.isInDocumentBounds=!1,t.Al(e),e=new Ho,e.name="Tool",e.isTemporary=!0,e.isInDocumentBounds=!0,t.Al(e),e=new Ho,e.name="Grid",e.allowSelect=!1,e.pickable=!1,e.isTemporary=!0,e.isInDocumentBounds=!1,t.Ww(e,t.Qj("Background"))}function $p(t){var e=new ne(ne.Grid);e.name="GRID";var i=new Xi;return i.figure="LineH",i.stroke="lightgray",i.strokeWidth=.5,i.interval=1,e.add(i),i=new Xi,i.figure="LineH",i.stroke="gray",i.strokeWidth=.5,i.interval=5,e.add(i),i=new Xi,i.figure="LineH",i.stroke="gray",i.strokeWidth=1,i.interval=10,e.add(i),i=new Xi,i.figure="LineV",i.stroke="lightgray",i.strokeWidth=.5,i.interval=1,e.add(i),i=new Xi,i.figure="LineV",i.stroke="gray",i.strokeWidth=.5,i.interval=5,e.add(i),i=new Xi,i.figure="LineV",i.stroke="gray",i.strokeWidth=1,i.interval=10,e.add(i),i=new ui,i.add(e),i.layerName="Grid",i.zOrder=0,i.isInDocumentBounds=!1,i.isAnimated=!1,i.pickable=!1,i.locationObjectName="GRID",t.add(i),t.partManager.parts.remove(i),e.visible=!1,e}function Ad(){this.H.gu?this.H.gu=!1:this.H.isEnabled?this.H.kx(this):Ls(this.H)}function Dd(t){this.H.isEnabled?(this.H.lu=t.target.scrollTop,this.H.ju=t.target.scrollLeft):Ls(this.H)}wt.prototype.kx=function(t){if(this.ta!==null){var e=this.ku,i=this.hu;this.qr=!0;var n=this.documentBounds,s=this.viewportBounds,a=this.rj,l=n.x-a.left,c=n.y-a.top,f=n.width+a.left+a.right,m=n.height+a.top+a.bottom,v=n.right+a.right;a=n.bottom+a.bottom;var w=s.x;n=s.y;var C=s.width,k=s.height,L=s.right,A=s.bottom;s=this.scale;var H=t.scrollLeft;if(this.tn)switch(this.bu){case"negative":H=H+t.scrollWidth-t.clientWidth;break;case"reverse":H=t.scrollWidth-H-t.clientWidth}var R=H;C<f||k<m?(H=z.allocAt(this.position.x,this.position.y),this.allowHorizontalScroll&&this.ju!==R&&(H.x=R/s+l,this.ju=R),this.allowVerticalScroll&&this.lu!==t.scrollTop&&(H.y=t.scrollTop/s+c,this.lu=t.scrollTop),this.position=H,z.free(H),this.Ee=this.qr=!1):(H=z.alloc(),t.uy&&this.allowHorizontalScroll&&(l<w&&(this.position=H.h(R+l,this.position.y)),v>L&&(this.position=H.h(-(e.scrollWidth-this.Aa)+R-this.Aa/s+v,this.position.y))),t.vy&&this.allowVerticalScroll&&(c<n&&(this.position=H.h(this.position.x,t.scrollTop+c)),a>A&&(this.position=H.h(this.position.x,-(e.scrollHeight-this.ya)+t.scrollTop-this.ya/s+a))),z.free(H),this.vd=!0,this.Ee=this.qr=!1,n=this.documentBounds,s=this.viewportBounds,v=n.right,L=s.right,a=n.bottom,A=s.bottom,l=n.x,w=s.x,c=n.y,n=s.y,C>=f&&l>=w&&v<=L&&(i.style.width="1px"),k>=m&&c>=n&&a<=A&&(i.style.height="1px"))}},wt.prototype.computeBounds=function(t){return t===void 0&&(t=new It),bo(this),zi(this,t)};function zi(t,e){if(t.fixedBounds.w())return e.assign(t.fixedBounds),e.Co(t.yb),e;for(var i=!0,n=t.Wa.s,s=n.length,a=0;a<s;a++){var l=n[a];if(l.visible&&l.isInDocumentBounds){l=l.Pa.s;for(var c=l.length,f=0;f<c;f++){var m=l[f];m.isInDocumentBounds&&m.isVisible()&&(m=m.actualBounds,m.w()&&(i?(i=!1,e.assign(m)):e.ed(m)))}}}return i&&e.h(0,0,0,0),e.Co(t.yb),e}wt.prototype.computePartsBounds=function(t,e){e===void 0&&(e=!1);var i=null;if(ce(t))for(var n=0;n<t.length;n++){var s=t[n];!e&&s instanceof ue||(s.Va(),i===null?i=s.actualBounds.copy():i.ed(s.actualBounds))}else for(t=t.iterator;t.next();)n=t.value,!e&&n instanceof ue||(n.Va(),i===null?i=n.actualBounds.copy():i.ed(n.actualBounds));return i===null?new It(NaN,NaN,0,0):i};function Ga(t,e){if((e||t.hf)&&!t.vb&&t.ta!==null&&t.documentBounds.w()){if(t.vb=!0,e){var i=t.initialPosition;if(i.w()){t.vb=!1,t.position=i;return}i=z.alloc(),i.xi(t.documentBounds,t.initialDocumentSpot);var n=t.viewportBounds;n=It.allocAt(0,0,n.width,n.height);var s=z.alloc();s.xi(n,t.initialViewportSpot),s.h(i.x-s.x,i.y-s.y),t.position=s,It.free(n),z.free(s),z.free(i)}i=t.yh,e&&t.Fg!==Jo&&(i=t.Fg);var a=i!==Jo?Dh(t,i):t.scale;i=t.pa.x,n=t.pa.y,s=t.Aa/a;var l=t.ya/a,c=t.zk,f=t.pq;e&&!c.sb()&&(f.sb()||f.Xb())&&(c=f.Xb()?on:f),Id(t,t.documentBounds,s,l,c,e),e=t.scale,t.scale=a,t.vb=!1,a=t.viewportBounds,ht.B(a.x,i)&&ht.B(a.y,n)&&ht.B(a.width,s)&&ht.B(a.height,l)||t.onViewportBoundsChanged(new It(i,n,s,l),a,e,!1)}}function Dh(t,e){var i=t.Pp;if(t.ta===null)return i;t.Va();var n=t.documentBounds;if(!n.w())return i;var s=n.width;n=n.height;var a=t.Aa+(t.gf?t.Db:0),l=t.ya+(t.Be?t.Db:0),c=a/s,f=l/n;return e===Ya?(e=Math.min(f,c),e>i&&(e=i),e<t.minScale&&(e=t.minScale),e>t.maxScale&&(e=t.maxScale),e):e===ku?(e=f>c?(l-t.Db)/n:(a-t.Db)/s,e>i&&(e=i),e<t.minScale&&(e=t.minScale),e>t.maxScale&&(e=t.maxScale),e):t.scale}wt.prototype.zoomToFit=function(){var t=this.sj;this.sj=ah,this.scale=Dh(this,Ya),t!==ah&&(Ga(this,!1),Id(this,this.documentBounds,this.Aa/this.Ca,this.ya/this.Ca,this.zk,!1)),this.sj=t},T=wt.prototype,T.BA=function(t,e){e===void 0&&(e=Ya);var i=t.width,n=t.height;if(!(i===0||n===0||isNaN(i)&&isNaN(n))){var s=1;if(e===Ya||e===ku)if(isNaN(i))s=this.viewportBounds.height*this.scale/n;else if(isNaN(n))s=this.viewportBounds.width*this.scale/i;else{s=this.Aa;var a=this.ya;s=e===ku?a/n>s/i?(a-(this.Be?this.Db:0))/n:(s-(this.gf?this.Db:0))/i:Math.min(a/n,s/i)}this.scale=s,this.position=new z(t.x,t.y)}},T.Jy=function(t,e){this.Va();var i=this.documentBounds,n=this.viewportBounds;this.position=new z(i.x+(t.x*i.width+t.offsetX)-(e.x*n.width-e.offsetX),i.y+(t.y*i.height+t.offsetY)-(e.y*n.height-e.offsetY))},T.zz=function(t){if(t instanceof at){this.eq=t;var e=z.alloc();this.fq=this.op(t.ga(An,e)),z.free(e)}else this.eq=null,this.fq=Ar};function Id(t,e,i,n,s,a){var l=z.allocAt(t.pa.x,t.pa.y),c=l.x,f=l.y;if(t.eq!==null){var m=z.alloc();m=t.eq.ga(An,m),c=m.x-t.fq.x/t.scale,f=m.y-t.fq.y/t.scale,s=Nn,z.free(m)}(a||t.scrollMode===ah)&&(s.sb()&&(i>e.width&&(c=e.x+(s.x*e.width+s.offsetX)-(s.x*i-s.offsetX)),n>e.height&&(f=e.y+(s.y*e.height+s.offsetY)-(s.y*n-s.offsetY))),s=t.rj,a=i-e.width,i<e.width+s.left+s.right?(c=Math.min(c+i/2,e.right+Math.max(a,s.right)-i/2),c=Math.max(c,e.left-Math.max(a,s.left)+i/2),c-=i/2):c>e.left?c=e.left:c<e.right-i&&(c=e.right-i),i=n-e.height,n<e.height+s.top+s.bottom?(f=Math.min(f+n/2,e.bottom+Math.max(i,s.bottom)-n/2),f=Math.max(f,e.top-Math.max(i,s.top)+n/2),f-=n/2):f>e.top?f=e.top:f<e.bottom-n&&(f=e.bottom-n)),l.x=isFinite(c)?c:-t.yb.left,l.y=isFinite(f)?f:-t.yb.top,t.positionComputation!==null&&(e=t.positionComputation(t,l),l.x=e.x,l.y=e.y),U0(t.Yd,t.pa,l),t.pa.h(l.x,l.y),Yo(t),z.free(l)}T.Ol=function(t,e){if(e===void 0&&(e=!0),e){if(t=jl(this,t,function(i){return i.part},function(i){return i.canSelect()}),t instanceof ui)return t}else if(t=jl(this,t,function(i){return i.part}),t instanceof ui)return t;return null},T.ic=function(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null),bo(this);for(var n=this.Wa.iteratorBackwards;n.next();){var s=n.value;if(s.visible&&(s=s.ic(t,e,i),s!==null))return s}return null};function jl(t,e,i,n){for(i===void 0&&(i=null),n===void 0&&(n=null),bo(t),t=t.Wa.iteratorBackwards;t.next();){var s=t.value;if(s.visible&&!s.isTemporary&&(s=s.ic(e,i,n),s!==null))return s}return null}T.lz=function(t,e,i){return e===void 0&&(e=!0),$f(this,t,function(n){return n.part},e?function(n){return n instanceof ui&&n.canSelect()}:null,i)};function $f(t,e,i,n,s){for(i===void 0&&(i=null),n===void 0&&(n=null),s instanceof Kt||s instanceof At||(s=new At),bo(t),t=t.Wa.iteratorBackwards;t.next();){var a=t.value;a.visible&&!a.isTemporary&&a.ji(e,i,n,s)}return s}T.ji=function(t,e,i,n){e===void 0&&(e=null),i===void 0&&(i=null),n instanceof Kt||n instanceof At||(n=new At),bo(this);for(var s=this.Wa.iteratorBackwards;s.next();){var a=s.value;a.visible&&a.ji(t,e,i,n)}return n},T.ux=function(t,e,i,n){return e===void 0&&(e=!1),i===void 0&&(i=!0),Kp(this,t,function(s){return s instanceof ui&&(!i||s.canSelect())},e,n)},T.Cf=function(t,e,i,n,s){e===void 0&&(e=null),i===void 0&&(i=null),n===void 0&&(n=!1),s instanceof Kt||s instanceof At||(s=new At),bo(this);for(var a=this.Wa.iteratorBackwards;a.next();){var l=a.value;l.visible&&l.Cf(t,e,i,n,s)}return s},T.Nu=function(t,e,i,n,s,a){var l=new At;bo(this);for(var c=this.Wa.iteratorBackwards;c.next();){var f=c.value;f.visible&&f.Nu(t,e,i,n,l,s,a)}return l};function Kp(t,e,i,n,s){var a=null;for(a===void 0&&(a=null),i===void 0&&(i=null),n===void 0&&(n=!1),s instanceof Kt||s instanceof At||(s=new At),bo(t),t=t.Wa.iteratorBackwards;t.next();){var l=t.value;l.visible&&!l.isTemporary&&l.Cf(e,a,i,n,s)}return s}T.mz=function(t,e,i,n,s){return i===void 0&&(i=!0),n===void 0&&(n=!0),Kf(this,t,e,function(a){return a instanceof ui&&(!n||a.canSelect())},i,s)},T.og=function(t,e,i,n,s,a){i===void 0&&(i=null),n===void 0&&(n=null),s===void 0&&(s=!0),s!==!1&&s!==!0&&((s instanceof Kt||s instanceof At)&&(a=s),s=!0),a instanceof Kt||a instanceof At||(a=new At),bo(this);for(var l=this.Wa.iteratorBackwards;l.next();){var c=l.value;c.visible&&c.og(t,e,i,n,s,a)}return a};function Kf(t,e,i,n,s,a){var l=null;for(l===void 0&&(l=null),n===void 0&&(n=null),s===void 0&&(s=!0),s!==!1&&s!==!0&&((s instanceof Kt||s instanceof At)&&(a=s),s=!0),a instanceof Kt||a instanceof At||(a=new At),bo(t),t=t.Wa.iteratorBackwards;t.next();){var c=t.value;c.visible&&!c.isTemporary&&c.og(e,i,l,n,s,a)}return a}wt.prototype.acceptEvent=function(t){return to(this,t,t instanceof MouseEvent)};function to(t,e,i){var n=t.Qg;return t.Qg=t.cj,t.cj=n,n.diagram=t,n.event=e,i?Ih(t,e,n):(n.viewPoint=t.Qg.viewPoint,n.documentPoint=t.Qg.documentPoint),t=0,e.ctrlKey&&(t+=1),e.altKey&&(t+=2),e.shiftKey&&(t+=4),e.metaKey&&(t+=8),n.modifiers=t,n.button=e.button,e.buttons!==void 0&&(n.buttons=e.buttons),re&&e.button===0&&e.ctrlKey&&(n.button=2),n.down=!1,n.up=!1,n.clickCount=1,n.delta=0,n.handled=!1,n.bubbles=!1,n.timestamp=e.timeStamp,n.isMultiTouch=!1,n.targetDiagram=J0(e,e.target),n.targetObject=null,n}function J0(t,e){return e===null?null:(e=e.H)?e:((e=t.path)||typeof t.composedPath!="function"||(e=t.composedPath()),e&&e[0]&&e[0].H?e[0].H:null)}function Hf(t,e,i,n,s,a){var l=t.Qg;return t.Qg=t.cj,t.cj=l,l.diagram=t,l.clickCount=1,t=l.delta=0,e.ctrlKey&&(t+=1),e.altKey&&(t+=2),e.shiftKey&&(t+=4),e.metaKey&&(t+=8),l.modifiers=t,l.event=e,l.timestamp=e.timeStamp,l.button=e.button,l.buttons=e.buttons,re&&e.button===0&&e.ctrlKey&&(l.button=2),l.down=i,l.up=n,l.handled=!1,l.bubbles=s,l.isMultiTouch=a,l}function Xa(t,e){return t.bubbles?!0:(e.stopPropagation!==void 0&&e.stopPropagation(),e.cancelable!==!1&&e.preventDefault(),e.cancelBubble=!0,!1)}wt.prototype.Qz=function(t){var e=this.H;if(!this.H.isEnabled)return!1;var i=to(e,t,!1);switch(i.key=String.fromCharCode(t.which),i.down=!0,t.which){case 8:i.key="Backspace";break;case 33:i.key="PageUp";break;case 34:i.key="PageDown";break;case 35:i.key="End";break;case 36:i.key="Home";break;case 37:i.key="Left";break;case 38:i.key="Up";break;case 39:i.key="Right";break;case 40:i.key="Down";break;case 45:i.key="Insert";break;case 46:i.key="Del";break;case 48:i.key="0";break;case 187:case 61:case 107:i.key="Add";break;case 189:case 173:case 109:i.key="Subtract";break;case 27:i.key="Esc"}return e.doKeyDown(),Xa(i,t)},wt.prototype.Rz=function(t){var e=this.H;if(!e.isEnabled)return!1;var i=to(e,t,!1);switch(i.key=String.fromCharCode(t.which),i.up=!0,t.which){case 8:i.key="Backspace";break;case 33:i.key="PageUp";break;case 34:i.key="PageDown";break;case 35:i.key="End";break;case 36:i.key="Home";break;case 37:i.key="Left";break;case 38:i.key="Up";break;case 39:i.key="Right";break;case 40:i.key="Down";break;case 45:i.key="Insert";break;case 46:i.key="Del"}return e.doKeyUp(),Xa(i,t)},wt.prototype.bz=function(t){var e=this.H;if(!e.isEnabled)return!1;var i=to(e,t,!0);return e.mouseEnter!==null&&e.mouseEnter(i),e.currentTool.standardMouseOver(),Xa(i,t)},wt.prototype.cz=function(t){var e=this.H;if(!e.isEnabled)return!1;var i=to(e,t,!0);return e.mouseLeave!==null&&e.mouseLeave(i),Xa(i,t)},wt.prototype.getMouse=function(t){var e=this.ta;if(e===null)return new z(0,0);var i=e.getBoundingClientRect();return e=t.clientX-this.Aa/i.width*i.left,t=t.clientY-this.ya/i.height*i.top,this.Ab!==null?Ji(new z(e,t),this.Ab):new z(e,t)};function Ih(t,e,i){var n=t.ta,s=t.Aa,a=t.ya,l=0,c=0;n!==null&&(n=n.getBoundingClientRect(),l=e.clientX-s/n.width*n.left,c=e.clientY-a/n.height*n.top),i.viewPoint.h(l,c),t.Ab!==null?(e=z.allocAt(l,c),t.Ab.Cd(e),i.documentPoint.assign(e),z.free(e)):i.documentPoint.h(l,c)}function Oh(t,e,i){if(t.oj[0]!==null){e=t.oj[e];var n=t.ta;n!==null&&(n=n.getBoundingClientRect(),i.h(e.clientX-t.Aa/n.width*n.left,e.clientY-t.ya/n.height*n.top))}}wt.prototype.Ya=function(){this.Zi||(this.Zi=!0,this.$b(!1))};function Gc(t){t.ld||bo(t),t.Va()}wt.prototype.redraw=function(){this.vb||this.ld||(this.N(),this.bd())},T=wt.prototype,T.Pz=function(){return this.kg},T.Xy=function(t){t===void 0&&(t=null);var e=this.animationManager,i=e.isEnabled;e.Cc(),e.isEnabled=!1,Vs(this),this.hf=!1,this.du=new z(NaN,NaN),e.isEnabled=i,this.ld=!0;var n=this;t!==null&&ge(function(){n.ld=!1,Mu(e,"Model"),t(n)},1)},T.$b=function(t){if(t===void 0&&(t=!1),this.kg!==!0&&!(this.vb||t===!1&&this.ld)){this.kg=!0;var e=this;Z.requestAnimationFrame(function(){e.kg&&e.bd()})}},T.bd=function(){(!this.fn||this.kg)&&(this.fn&&(this.fn=!1),Vs(this))};function ua(t,e,i){!t.Ee||t.vb||t.animationManager.defaultAnimation.isAnimating||Ls(t)||(e&&bo(t),i&&Ga(t,!1))}function Vs(t,e){if(!t.ld&&(t.kg=!1,t.Ka!==null||t.wo.w())){t.ld=!0;var i=t.animationManager,n=t.Xn;if(!i.isAnimating&&n.length!==0){for(var s=n.s,a=s.length,l=0;l<a;l++){var c=s[l];Hr(c,!1),c.v()}n.clear()}n=t.ow,0<n.count&&(n.each(function(f){f.Nv()}),n.clear()),s=n=!1,i.defaultAnimation.isAnimating&&(s=!0,n=t.skipsUndoManager,t.skipsUndoManager=!0),i.zb||Y0(t),ua(t,!1,!0),t.fe!==null&&(t.fe.visible&&!t.mq&&(Cu(t),t.mq=!0),!t.fe.visible&&t.mq&&(t.mq=!1)),bo(t),a=!1,(!t.hf||t.xh)&&(t.hf?im(t,!t.Jk):(t.Ea("Initial Layout"),i.isEnabled===!1&&i.Cc(),im(t,!1)),a=!0),t.Jk=!1,bo(t),t.ou||Gc(t),ua(t,!0,!1),l=!1,a?(i=It.alloc(),i.assign(t.viewportBounds),t.hf||(l=t.hf=!0,t.skipsUndoManager||(t.undoManager.isPendingClear=!0),t.undoManager.isPendingUnmodified=!0,Ma(t)),t.R("LayoutCompleted"),ua(t,!0,!1),It.free(i)):i.Ok&&i.Qw&&(t.Fg!==Jo?t.scale=Dh(t,t.Fg):t.yh!==Jo?t.scale=Dh(t,t.yh):(i=t.initialScale,isFinite(i)&&0<i&&(t.scale=i)),Ga(t,!0)),a&&l&&t.eb("Initial Layout"),bo(t),e||t.gc(t.ib),s&&(t.skipsUndoManager=n),t.ld=!1}}function Ma(t){if(t.Fg!==Jo)t.scale=Dh(t,t.Fg);else if(t.yh!==Jo)t.scale=Dh(t,t.yh);else{var e=t.initialScale;isFinite(e)&&0<e&&(t.scale=e)}Ga(t,!0),e=t.Wa.s,t.Fd(e,e.length,t,t.viewportBounds),t.R("InitialLayoutCompleted"),t.du.assign(t.pa),Cu(t)}function bo(t){if(t.De.count!==0&&(t.ld||!t.animationManager.isTicking)){for(var e=0;23>e;e++){var i=t.De.iterator;if(i===null||t.De.count===0)break;t.De=new At,t.Nv(i,t.De)}t.nodes.each(function(n){n instanceof ji&&n.U&65536&&(n.U=n.U^65536)})}}T.Nv=function(t,e){for(t.reset();t.next();){var i=t.value;!i.Zc()||i instanceof ji||(i.si()?(i.measure(1/0,1/0),i.arrange()):e.add(i))}for(t.reset();t.next();)i=t.value,i instanceof ji&&i.isVisible()&&Bh(this,i);for(t.reset();t.next();)i=t.value,i instanceof ue&&i.isVisible()&&(i.si()?(i.measure(1/0,1/0),i.arrange()):e.add(i));for(t.reset();t.next();)i=t.value,i instanceof Cn&&i.isVisible()&&(i.si()?(i.measure(1/0,1/0),i.arrange()):e.add(i))};function Bh(t,e){for(var i=Pe(),n=Pe(),s=e.memberParts;s.next();){var a=s.value;a.isVisible()&&(a instanceof ji?(ha(a)||Us(a)||Mc(a))&&Bh(t,a):a instanceof ue?a.fromNode===e||a.toNode===e?n.push(a):i.push(a):(a.measure(1/0,1/0),a.arrange()))}for(t=i.length,s=0;s<t;s++)a=i[s],a.measure(1/0,1/0),a.arrange();for(qe(i),e.measure(1/0,1/0),e.arrange(),t=n.length,e=0;e<t;e++)i=n[e],i.measure(1/0,1/0),i.arrange();qe(n)}T.Fd=function(t,e,i,n){if(this.vd||this.animationManager.isAnimating)for(var s=0;s<e;s++)t[s].Fd(i,n)},T.gc=function(t){if(this.Ka!==null){if(this.ta===null&&lt("No canvas specified"),this.nl==="svg"){if(this.Ka!==null){var e=this.animationManager;if(!e.zb&&(!e.isAnimating||e.isTicking)){gc(this);var i=this.Aa,n=this.ya;if(t.Gv.resize(i,n,i,n),i=this.Wa.s,n=i.length,this.Fd(i,n,this,this.viewportBounds),this.Fc||e.isAnimating){e=this.pa;var s=this.Ca,a=Math.round(e.x*s)/s,l=Math.round(e.y*s)/s,c=this.Ab;for(c.reset(),s!==1&&c.scale(s),e.x===0&&e.y===0||c.translate(-a,-l),t.ti=null,Ea(t,c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),this.pb!==1&&(t.globalAlpha=this.pb),Fh(this,t),e=this.Mb,this.ta.context.setTransform(e,0,0,e,0,0),this.ta.context.clearRect(0,0,this.Aa,this.ya),e=0;e<n;e++)i[e].gc(t,this);t=!1,this.Yf?Lu(this.Yf,this)&&(t=this.Vp()):t=!0,t&&(nn.prototype.Cd=nn.prototype.Eu),this.Fc=this.vd=!1}}}}else t:if(a=this.animationManager,!a.zb&&(!a.isAnimating||a.isTicking)&&(i=new Date,gc(this),this.Ka.style.opacity!=="0")){if(n=t!==this.ib,e=this.Wa.s,s=e.length,this.Fd(e,s,this,this.viewportBounds),n)t.Vc(!0),this.vd=!0;else if(!this.Fc&&!a.isAnimating)break t;a=this.Ab,a.reset(),l=this.Mb,c=this.pa;var f=this.Ca,m=Math.round(c.x*f)/f,v=Math.round(c.y*f)/f;for(f!==1&&a.scale(f),c.x===0&&c.y===0||a.translate(-m,-v),t.setTransform(l,0,0,l,0,0),t.clearRect(0,0,this.Aa,this.ya),this.pb!==1&&(t.globalAlpha=this.pb),Fh(this,t),c=0;c<s;c++)t.setTransform(l,0,0,l,0,0),t.transform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),t.yc(),e[c].gc(t,this);if(e=!1,this.Yf?Lu(this.Yf,this)&&(e=this.Vp()):e=!0,e&&(nn.prototype.Cd=nn.prototype.Eu),n?(this.ib.Vc(!0),this.vd=!0):this.Fc=this.vd=!1,e=+new Date-+i,n=Ui&&Ui.nx,i=this.zw,n||this.Yh===null){for(i[this.Tq]=e,this.Tq=(this.Tq+1)%i.length,s=e=0;s<i.length;s++)e+=i[s];this.Sq=e/i.length}if(this.pb!==1&&(t.globalAlpha=1),n)for(t.setTransform(1,0,0,1,0,0),n=0;n<i.length;n++)t.fillText(i[n].toString(),20,150+ +(20*n))}}};function $l(t,e,i,n,s,a,l,c,f,m){if(t.Ka!==null){t.ta===null&&lt("No canvas specified"),l===void 0&&(l=null),c===void 0&&(c=null),f===void 0&&(f=!1),m===void 0&&(m=!1),gc(t),t.ib.Vc(!0),t.vd=!0,t.$i=!0;var v=t.Ca;t.Ca=s;var w=t.Wa.s,C=w.length;try{var k=new It(a.x,a.y,n.width/s,n.height/s),L=k.copy();L.Co(i),Cu(t,L),bo(t),t.Fd(w,C,t,k),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,n.width,n.height),c!==null&&c!==""&&(e.fillStyle=c,e.ox(0,0,n.width,n.height));var A=t.Mb;e.scale(A,A);var H=nn.alloc();H.reset(),H.translate(i.left,i.top),H.scale(s),a.x===0&&a.y===0||H.translate(-a.x,-a.y),e.setTransform(H.m11,H.m12,H.m21,H.m22,H.dx,H.dy),e.yc(),e instanceof Bs&&Ea(e,H.m11,H.m12,H.m21,H.m22,H.dx,H.dy),nn.free(H),Fh(t,e),e.globalAlpha=t.pb;var R=t.Qj("Grid");if(l){var X=new At,Y=l.iterator;for(Y.reset();Y.next();){var tt=Y.value;tt instanceof ui&&(m||tt.layer!==R)&&(tt.Gj(),X.add(tt))}for(m=0;m<C;m++)gg(w[m],e,t,X,f);X.each(function(bt){return bt.Gj()})}else for(X=0;X<C;X++){var st=w[X];st===R?m&&st.gc(e,t,!0):st.gc(e,t,f)}t.$i=!1,t.Yf&&Lu(t.Yf,t)&&t.Vp()}finally{t.Ca=v,t.ib.Vc(!0),t.vd=!0,t.Fd(w,C,t,t.viewportBounds),Cu(t),t.ib instanceof Bs&&(t.ib.Nj.PA(),t.redraw())}}}T.Gf=function(t){return this.Rg[t]},T.Xx=function(t,e){t==="minDrawingLength"&&(this.Oq=e),this.Rg[t]=e,this.redraw()},T.Tx=function(){this.Rg=new ci,this.Rg.drawShadows=!0,this.Rg.textGreeking=!0,this.Rg.viewportOptimizations=!(re||ke),this.Rg.temporaryPixelRatio=!0,this.Rg.pictureRatioOptimization=!0,this.Oq=this.Rg.minDrawingLength=1};function Fh(t,e){t=t.Rg,t!==null&&(t.imageSmoothingEnabled!==void 0&&e.Wx(!!t.imageSmoothingEnabled),t=t.defaultFont,t!=null&&(e.font=t))}T.Ql=function(t){return this.on[t]},T.sA=function(t,e){this.on[t]=e},T.Sx=function(){this.on=new ci,this.on.extraTouchArea=10,this.on.extraTouchThreshold=10,this.on.hasGestureZoom=!0},T.set=function(t){return Object.assign(this,t),this},T.Du=function(t){return this.nm(t)},T.nm=function(t){return Xc(this,t),this};function Xc(t,e){var i=t instanceof ne,n=t instanceof wt,s;for(s in e){s===""&&lt("Setting properties requires non-empty property names");var a=t,l=s;if(i||n){var c=s.indexOf(".");if(0<c){var f=s.substring(0,c);i?a=t.fb(f):(a=t[f],a==null&&(a=t.toolManager[f])),Tt(a)?l=s.substr(c+1):lt("Unable to find object named: "+f+" in "+t.toString()+" when trying to set property: "+s)}}if(l[0]!=="_"&&!Ut(a,l))if(n&&l==="ModelChanged"){t.Yw(e[l]);continue}else if(n&&l==="Changed"){t.Pe(e[l]);continue}else if(n&&Ut(t.toolManager,l))a=t.toolManager;else if(n&&om(t,l)){t.Bj(l,e[l]);continue}else if(t instanceof Ve&&l==="Changed"){t.Pe(e[l]);continue}else lt('Trying to set undefined property "'+l+'" on object: '+a.toString());a[l]=e[s],l[0]==="_"&&a instanceof at&&a.Vw(l)}}T.bx=function(){if(this.Eh.count!==0&&!(1<this.undoManager.transactionLevel)){for(;0<this.Eh.count;){var t=this.Eh;for(this.Eh=new pe,t=t.iterator;t.next();){var e=t.key;e.Xo(t.value),e.qc()}}this.N()}},T.N=function(t){if(t===void 0)this.Fc=!0,this.$b();else{var e=this.viewportBounds;t.w()&&e.Yc(t)&&(this.Fc=!0,this.$b())}this.R("InvalidateDraw")},wt.prototype.invalidateViewport=function(t,e){if(this.Fc!==!0)if(this.Fc=!0,this.nl==="svg")this.bd();else{var i=this.Gf("temporaryPixelRatio")===!0;if(this.Gf("viewportOptimizations")===!0&&this.scrollMode!==Rd&&this.rj.hi(0,0,0,0)&&e.width===t.width&&e.height===t.height){var n=this.scale,s=Math.max(t.y,e.y),a=Math.min(t.y+t.height,e.y+e.height);if(0<Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*n&&0<Math.max(0,a-s)*n){if(!(this.ld||(this.kg=!1,this.Ka===null||(this.ld=!0,this.documentBounds.w()||(n=It.alloc(),rh(this,this.computeBounds(n)),It.free(n)),n=this.ta,n===null||n instanceof su)))){var l=this.Mb;s=this.Aa*l;var c=this.ya*l,f=this.scale*l;a=Math.round(Math.round(e.x*f)-Math.round(t.x*f)),e=Math.round(Math.round(e.y*f)-Math.round(t.y*f)),f=this.jw,t=this.oy,f.width!==s&&(f.width=s),f.height!==c&&(f.height=c),t.clearRect(0,0,s,c),f=190*l;var m=70*l,v=Math.max(a,0),w=Math.max(e,0),C=Math.floor(s-v),k=Math.floor(c-w);t.drawImage(n.Oa,v,w,C,k,0,0,C,k),Lu(this.Yf,this)&&t.clearRect(0,0,f,m),n=Pe(),t=Pe(),k=Math.abs(a),C=Math.abs(e);var L=v===0?0:s-k;v=z.allocAt(L,0),k=z.allocAt(k+L,c),t.push(new It(Math.min(v.x,k.x),Math.min(v.y,k.y),Math.abs(v.x-k.x),Math.abs(v.y-k.y)));var A=this.Ab;if(A.reset(),A.scale(l,l),this.Ca!==1&&A.scale(this.Ca),l=this.pa,(l.x!==0||l.y!==0)&&isFinite(l.x)&&isFinite(l.y)&&A.translate(-l.x,-l.y),Ji(v,A),Ji(k,A),n.push(new It(Math.min(v.x,k.x),Math.min(v.y,k.y),Math.abs(v.x-k.x),Math.abs(v.y-k.y))),L=w===0?0:c-C,v.h(0,L),k.h(s,C+L),t.push(new It(Math.min(v.x,k.x),Math.min(v.y,k.y),Math.abs(v.x-k.x),Math.abs(v.y-k.y))),Ji(v,A),Ji(k,A),n.push(new It(Math.min(v.x,k.x),Math.min(v.y,k.y),Math.abs(v.x-k.x),Math.abs(v.y-k.y))),Lu(this.Yf,this)&&(s=0<a?0:-a,c=0<e?0:-e,v.h(s,c),k.h(f+s,m+c),t.push(new It(Math.min(v.x,k.x),Math.min(v.y,k.y),Math.abs(v.x-k.x),Math.abs(v.y-k.y))),Ji(v,A),Ji(k,A),n.push(new It(Math.min(v.x,k.x),Math.min(v.y,k.y),Math.abs(v.x-k.x),Math.abs(v.y-k.y)))),z.free(v),z.free(k),ua(this,!1,!0),this.Ka===null&&lt("No div specified"),this.ta===null&&lt("No canvas specified"),!this.animationManager.zb&&(s=this.ib,this.Fc)){for(gc(this),c=this.Mb,s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,this.Aa*c,this.ya*c),s.drawImage(this.jw.Oa,0<a?0:Math.round(-a),0<e?0:Math.round(-e)),a=this.pa,l=this.Ca,f=Math.round(a.x*l)/l,m=Math.round(a.y*l)/l,e=this.Ab,e.reset(),l!==1&&e.scale(l),a.x===0&&a.y===0||e.translate(-f,-m),s.save(),s.beginPath(),a=t.length,l=0;l<a;l++)f=t[l],f.width!==0&&f.height!==0&&s.rect(Math.floor(f.x),Math.floor(f.y),Math.ceil(f.width),Math.ceil(f.height));for(s.clip(),s.setTransform(c,0,0,c,0,0),s.transform(e.m11,e.m12,e.m21,e.m22,e.dx,e.dy),s.yc(),e=this.Wa.s,a=e.length,this.Fd(e,a,this,this.viewportBounds),Fh(this,s),s.globalAlpha=this.pb,c=0;c<a;c++)if(l=e[c],f=n,l.visible&&l.pb!==0){m=th(l,s),w=l.Zq,w.length=0,v=this.scale,C=It.alloc(),k=l.Pa.s,A=k.length,L=f.length;for(var H=0;H<A;H++){var R=k[H],X=hu(R,R.actualBounds);t:{for(var Y=2/v,tt=4/v,st=0;st<L;st++){var bt=f[st];if(bt.width!==0&&bt.height!==0&&X.Vu(bt.x-Y,bt.y-Y,bt.width+tt,bt.height+tt)){X=!0;break t}}X=!1}X&&l.Oj(s,R,this,w,v,C,!0)}It.free(C),s.globalAlpha=m}s.restore(),s.Vc(!0),this.Yf&&Lu(this.Yf,this)&&this.Vp(),this.Fc=this.vd=!1,this.hk()}qe(n),qe(t),this.ld=!1}}else this.bd();i&&(os(this),this.bd(),Nd(this,!0))}else i?(os(this),this.bd(),Nd(this,!0)):this.bd()}};function gc(t){t.pn!==!1&&(t.pn=!1,q0(t,t.Aa,t.ya))}function q0(t,e,i){Yo(t);var n=t.Mb;t.ta.resize(e*n,i*n,e,i)&&(t.Fc=!0,t.ib.Vc(!0))}function Ls(t){var e=t.ta;if(e===null||t.wo.w())return!0;var i=t.Aa,n=t.ya,s=t.Ka,a=!1,l=t.gf?t.Db:0,c=t.Be?t.Db:0,f=s.clientWidth||i+l,m=s.clientHeight||n+c,v=t.viewportBounds;s=v.x;var w=v.y,C=v.width,k=v.height;if((f!==i+l||m!==n+c)&&(t.gf=!1,t.Be=!1,c=l=0,t.Aa=f,t.ya=m,a=t.pn=!0,Yo(t)),!t.hf||!t.viewportBounds.w())return!0;var L=t.ku,A=t.hu;if(t.Ee=!1,!(a||t.gf||t.Be||t.mn||t.nn))return!0;var H=t.documentBounds,R=0,X=0,Y=0,tt=0,st=v.width,bt=v.height,Te=t.rj;t.contentAlignment.sb()?(H.width>st&&(R=Te.left,X=Te.right),H.height>bt&&(Y=Te.top,tt=Te.bottom)):(R=Te.left,X=Te.right,Y=Te.top,tt=Te.bottom);var Ke=H.width+R+X,Oe=H.height+Y+tt;Te=t.scale;var he=Ke>f/Te,Gt=Oe>m/Te;if(!(a||t.gf||t.Be||he||Gt))return!0;R=H.x-R,f=v.x,X=H.right+X,m=v.right+l,Y=H.y-Y;var Wi=v.y;H=H.bottom+tt,v=v.bottom+c;var Di="1px";if(tt="1px",t.scrollMode===ah&&(he||Gt)&&(he&&t.hasHorizontalScrollbar&&t.allowHorizontalScroll&&(he=1,R+1<f&&(he=Math.max((f-R)*Te+t.Aa,he)),X>m+1&&(he=Math.max((X-m)*Te+t.Aa,he)),st+l+1<Ke&&(he=Math.max((Ke-st)*Te+t.Aa,he)),Di=he.toString()+"px"),Gt&&t.hasVerticalScrollbar&&t.allowVerticalScroll&&(he=1,Y+1<Wi&&(he=Math.max((Wi-Y)*Te+t.ya,he)),H>v+1&&(he=Math.max((H-v)*Te+t.ya,he)),bt+c+1<Oe&&(he=Math.max((Oe-bt)*Te+t.ya,he)),tt=he.toString()+"px")),he=Di!=="1px",Gt=tt!=="1px",he&&Gt||!he&&!Gt||(Gt&&(m-=t.Db),he&&(v-=t.Db),Ke<st+l||!t.hasHorizontalScrollbar||!t.allowHorizontalScroll||(l=1,R+1<f&&(l=Math.max((f-R)*Te+t.Aa,l)),X>m+1&&(l=Math.max((X-m)*Te+t.Aa,l)),st+1<Ke&&(l=Math.max((Ke-st)*Te+t.Aa,l)),Di=l.toString()+"px"),he=Di!=="1px",l=t.ya,he!==t.Be&&(l=he?t.ya-t.Db:t.ya+t.Db),Oe<bt+c||!t.hasVerticalScrollbar||!t.allowVerticalScroll||(c=1,Y+1<Wi&&(c=Math.max((Wi-Y)*Te+l,c)),H>v+1&&(c=Math.max((H-v)*Te+l,c)),bt+1<Oe&&(c=Math.max((Oe-bt)*Te+l,c)),tt=c.toString()+"px"),Gt=tt!=="1px"),t.qr&&he===t.Be&&Gt===t.gf)return i===t.Aa&&n===t.ya||t.bd(),!1;if(he!==t.Be&&(Di==="1px"?t.ya=t.ya+t.Db:t.ya=Math.max(t.ya-t.Db,1),a=!0),t.Be=he,A.style.width=Di,Gt!==t.gf&&(tt==="1px"?t.Aa=t.Aa+t.Db:t.Aa=Math.max(t.Aa-t.Db,1),a=!0,t.tn&&(c=z.alloc(),Gt?(e.style.left=t.Db+"px",t.position=c.h(t.pa.x+t.Db/t.scale,t.pa.y)):(e.style.left="0px",t.position=c.h(t.pa.x-t.Db/t.scale,t.pa.y)),z.free(c))),a&&Yo(t),t.gf=Gt,A.style.height=tt,t.gu=!0,a&&(t.pn=!0),e=L.scrollLeft,t.hasHorizontalScrollbar&&t.allowHorizontalScroll&&(st+1<Ke?e=(t.position.x-R)*Te:R+1<f?e=L.scrollWidth-L.clientWidth:X>m+1&&(e=t.position.x*Te)),t.tn)switch(t.bu){case"negative":e=-(L.scrollWidth-e-L.clientWidth);break;case"reverse":e=L.scrollWidth-e-L.clientWidth}return L.scrollLeft=e,t.hasVerticalScrollbar&&t.allowVerticalScroll&&(bt+1<Oe?L.scrollTop=(t.position.y-Y)*Te:Y+1<Wi?L.scrollTop=L.scrollHeight-L.clientHeight:H>v+1&&(L.scrollTop=t.position.y*Te)),f=t.Aa,m=t.ya,L.style.width=f+(t.gf?t.Db:0)+"px",L.style.height=m+(t.Be?t.Db:0)+"px",i!==f||n!==m||t.animationManager.zb?(i=It.allocAt(s,w,C,k),t.onViewportBoundsChanged(i,t.viewportBounds,Te,a),It.free(i),!1):!0}T=wt.prototype,T.add=function(t){var e=t.diagram;if(e!==this&&(e!==null&&lt("Cannot add part "+t.toString()+" to "+this.toString()+". It is already a part of "+e.toString()),e=this.Qj(t.layerName),e===null&&(e=this.Qj("")),e===null&&lt('Cannot add a Part when unable find a Layer named "'+t.layerName+'" and there is no default Layer'),t.layer!==e)){var i=e.oi(99999999,t,t.diagram===this);0<=i&&this.cb(Yr,"parts",e,null,t,null,i),e.isTemporary||this.Ya(),t.C(1),i=t.layerChanged,i!==null&&i(t,null,e)}},T.oi=function(t){this.partManager.oi(t);var e=this;Hh(t,function(i){nh(e,i)}),(t instanceof Cn||t instanceof ji&&t.placeholder!==null)&&t.v(),t.data!==null&&Hh(t,function(i){Gr(e.partManager,i)}),Us(t)!==!0&&Mc(t)!==!0||this.De.add(t),Tm(t,!0,this),Nm(t)?(t.actualBounds.w()&&this.N(hu(t,t.actualBounds)),this.Ya()):t.isVisible()&&t.actualBounds.w()&&this.N(hu(t,t.actualBounds)),this.$b()},T.pc=function(t){t.Ej(),this.partManager.pc(t);var e=this;t.data!==null&&Hh(t,function(i){dd(e.partManager,i,e)}),this.De.remove(t),Nm(t)?(t.actualBounds.w()&&this.N(hu(t,t.actualBounds)),this.Ya()):t.isVisible()&&t.actualBounds.w()&&this.N(hu(t,t.actualBounds)),this.$b()},T.remove=function(t){ou(this,t,!0)};function ou(t,e,i){var n=e.layer;n!==null&&n.diagram===t&&(e.isSelected=!1,e.isHighlighted=!1,e.C(2),i&&e.Lj(),i=n.pc(-1,e,!1),0<=i&&t.cb(Jr,"parts",n,e,null,i,null),t=e.layerChanged,t!==null&&t(e,n,null))}T.Is=function(t,e){if(e===void 0&&(e=!1),ce(t))for(var i=t.length,n=0;n<i;n++){var s=t[n];e&&!s.canDelete()||this.remove(s)}else for(i=new At,i.addAll(t),t=i.iterator;t.next();)i=t.value,e&&!i.canDelete()||this.remove(i)},T.Kj=function(t,e,i){return i===void 0&&(i=!1),this.partManager.Kj(t,e,i)},wt.prototype.moveParts=function(t,e,i,n){if(i===void 0&&(i=!1),n===void 0&&(n=Od(this)),this.toolManager!==null){var s=new pe;if(t!==null)if(ce(t))for(var a=0;a<t.length;a++)ih(this,s,t[a],i,n);else for(t=t.iterator;t.next();)ih(this,s,t.value,i,n);else{for(t=this.parts;t.next();)ih(this,s,t.value,i,n);for(t=this.nodes;t.next();)ih(this,s,t.value,i,n);for(t=this.links;t.next();)ih(this,s,t.value,i,n)}vc(this,s,e,n,i)}};function ih(t,e,i,n,s,a){if(!e.contains(i)&&(a===void 0&&(a=!1),!n||a||i.canMove()||i.canCopy()))if(s===void 0&&(s=Od(t)),i instanceof Le){if(e.add(i,t.Pd(s,i,i.location)),i instanceof ji&&(i.placeholder!==null||s.dragsMembers))for(a=i.memberParts;a.next();)ih(t,e,a.value,n,s,s.groupsAlwaysMove);for(a=i.linksConnected;a.next();){var l=a.value;if(!e.contains(l)){var c=l.fromNode,f=l.toNode;c!==null&&e.contains(c)&&f!==null&&e.contains(f)&&ih(t,e,l,n,s)}}if(s.dragsTree)for(i=i.Ou();i.next();)ih(t,e,i.value,n,s)}else if(i instanceof ue)for(e.add(i,t.Pd(s,i)),i=i.labelNodes;i.next();)ih(t,e,i.value,n,s);else i instanceof Cn||e.add(i,t.Pd(s,i,i.location))}function vc(t,e,i,n,s){if(e!==null&&e.count!==0){var a=z.alloc(),l=z.alloc();l.assign(i),isNaN(l.x)&&(l.x=0),isNaN(l.y)&&(l.y=0),(i=t.Mr)||Rh(t,e);for(var c=Pe(),f=Pe(),m=e.iterator,v=z.alloc();m.next();){var w=m.key,C=m.value;if(w.Zc()){var k=Bd(t,w,e);k!==null?c.push(new h(w,C,k)):(!s||w.canMove())&&(k=C.point,a.assign(k),t.computeMove(w,a.add(l),n,v),w.location=v,C.shifted===void 0&&(C.shifted=new z),C.shifted.assign(v.re(k)))}else m.key instanceof ue&&f.push(m.sa)}for(z.free(v),s=c.length,m=0;m<s;m++)w=c[m],a.assign(w.info.point),w.Su.shifted===void 0&&(w.Su.shifted=new z),w.node.location=a.add(w.Su.shifted);for(s=z.alloc(),m=z.alloc(),w=f.length,C=0;C<w;C++){var L=f[C];if(k=L.key,k instanceof ue)if(k.suspendsRouting){k.Tg=null,v=k.fromNode;var A=k.toNode;if(t.draggedLink!==null&&n.dragsLink)if(A=L.value.point,k.dragComputation===null)e.add(k,t.Pd(n,k,l)),kc(k,l.x-A.x,l.y-A.y);else{L=z.allocAt(0,0),(v=k.i(0))&&v.w()&&L.assign(v);var H=v=z.alloc().assign(L).add(l);n.isGridSnapEnabled&&(n.isGridSnapRealtime||t.lastInput.up)&&(H=z.alloc(),Dr(t,k,v,H,n)),v.assign(k.dragComputation(k,v,H)).re(L),e.add(k,t.Pd(n,k,v)),kc(k,v.x-A.x,v.y-A.y),z.free(L),z.free(v),H!==v&&z.free(H)}else v!==null&&(s.assign(v.location),H=e.I(v),H!==null&&s.re(H.point)),A!==null&&(m.assign(A.location),H=e.I(A),H!==null&&m.re(H.point)),v!==null&&A!==null?s.Xa(m)?(v=L.value.point,A=a,A.assign(s),A.re(v),e.add(k,t.Pd(n,k,s)),kc(k,A.x,A.y)):(k.suspendsRouting=!1,k.bb()):(L=L.value.point,v=v!==null?s:A!==null?m:l,e.add(k,t.Pd(n,k,v)),kc(k,v.x-L.x,v.y-L.y))}else(k.fromNode===null||k.toNode===null)&&(v=L.value.point,e.add(k,t.Pd(n,k,l)),kc(k,l.x-v.x,l.y-v.y))}z.free(a),z.free(l),z.free(s),z.free(m),qe(c),qe(f),i||(bo(t),Kl(t,e))}}wt.prototype.computeMove=function(t,e,i,n){if(n===void 0&&(n=new z),n.assign(e),t===null)return n;var s=e,a=i.isGridSnapEnabled;a&&(i.isGridSnapRealtime||this.lastInput.up)&&(s=z.alloc(),Dr(this,t,e,s,i)),i=t.dragComputation!==null?t.dragComputation(t,e,s):s;var l=t.minLocation,c=l.x;isNaN(c)&&(c=a?Math.round(1e3*t.location.x)/1e3:t.location.x),l=l.y,isNaN(l)&&(l=a?Math.round(1e3*t.location.y)/1e3:t.location.y);var f=t.maxLocation,m=f.x;return isNaN(m)&&(m=a?Math.round(1e3*t.location.x)/1e3:t.location.x),f=f.y,isNaN(f)&&(f=a?Math.round(1e3*t.location.y)/1e3:t.location.y),n.h(Math.max(c,Math.min(i.x,m)),Math.max(l,Math.min(i.y,f))),s!==e&&z.free(s),n};function Od(t){var e=t.toolManager.findTool("Dragging");return e!==null?e.dragOptions:t.Wm}function Dr(t,e,i,n,s){if(s===void 0&&(s=Od(t)),n.assign(i),e!==null){var a=t.grid;e=s.gridSnapCellSize,t=e.width,e=e.height;var l=s.gridSnapOrigin,c=l.x;if(l=l.y,s=s.gridSnapCellSpot,a!==null){var f=a.gridCellSize;isNaN(t)&&(t=f.width),isNaN(e)&&(e=f.height),a=a.gridOrigin,isNaN(c)&&(c=a.x),isNaN(l)&&(l=a.y)}a=z.allocAt(0,0),a.yi(0,0,t,e,s),ht.No(i.x,i.y,c+a.x,l+a.y,t,e,n),z.free(a)}}function Rh(t,e){if(e!==null)for(t.Mr=!0,t=e.iterator;t.next();)e=t.key,e instanceof ue&&(e.suspendsRouting=!0)}function Kl(t,e){if(e!==null){for(e=e.iterator;e.next();){var i=e.key;i instanceof ue&&(i.suspendsRouting=!1,fy(i)&&i.bb())}t.Mr=!1}}function Bd(t,e,i){return e=e.containingGroup,e!==null&&(t=Bd(t,e,i),t!==null||(t=i.I(e),t!==null))?t:null}T=wt.prototype,T.Pd=function(t,e,i){if(i===void 0)return new Ra(fn);var n=t.isGridSnapEnabled;return t.groupsSnapMembers||e.containingGroup===null||(n=!1),n?new Ra(new z(Math.round(1e3*i.x)/1e3,Math.round(1e3*i.y)/1e3)):new Ra(i.copy())};function oi(t,e,i){if(e.diagram!==null&&e.diagram!==t&&lt("Cannot share a Layer with another Diagram: "+e+" of "+e.diagram),i===null?e.diagram!==null&&lt("Cannot add an existing Layer to this Diagram again: "+e):(i.diagram!==t&&lt("Existing Layer must be in this Diagram: "+i+" not in "+i.diagram),e===i&&lt("Cannot move a Layer before or after itself: "+e)),e.diagram!==t){e=e.name,t=t.Wa,i=t.count;for(var n=0;n<i;n++)t.M(n).name===e&&lt("Cannot add Layer with the name '"+e+"'; a Layer with the same name is already present in this Diagram.")}}T.Al=function(t){oi(this,t,null),t.Xe(this);var e=this.Wa,i=e.count-1;if(!t.isTemporary)for(;0<=i&&e.M(i).isTemporary;)i--;return e.Gb(i+1,t),this.cc!==null&&this.cb(Yr,"layers",this,null,t,null,i+1),this.N(),this.Ya(),this},T.Ww=function(t,e){oi(this,t,e),t.Xe(this);var i=this.Wa,n=i.indexOf(t);0<=n&&(i.remove(t),this.cc!==null&&this.cb(Jr,"layers",this,t,null,n,null));var s=i.count,a;for(a=0;a<s;a++)if(i.M(a)===e){i.Gb(a,t);break}return this.cc!==null&&this.cb(Yr,"layers",this,null,t,null,a),this.N(),0>n&&this.Ya(),this},T.Cy=function(t,e){oi(this,t,e),t.Xe(this);var i=this.Wa,n=i.indexOf(t);0<=n&&(i.remove(t),this.cc!==null&&this.cb(Jr,"layers",this,t,null,n,null));var s=i.count,a;for(a=0;a<s;a++)if(i.M(a)===e){i.Gb(a+1,t);break}return this.cc!==null&&this.cb(Yr,"layers",this,null,t,null,a+1),this.N(),0>n&&this.Ya(),this},T.kA=function(t){if(t.diagram!==this&&lt("Cannot remove a Layer from another Diagram: "+t+" of "+t.diagram),t.name!==""){var e=this.Wa,i=e.indexOf(t);if(e.remove(t)){for(e=t.Pa.copy().iterator;e.next();){var n=e.value,s=n.layerName;s!==t.name?n.layerName=s:n.layerName=""}this.cc!==null&&this.cb(Jr,"layers",this,t,null,i,null),this.N(),this.Ya()}}},T.Qj=function(t){for(var e=this.layers;e.next();){var i=e.value;if(i.name===t)return i}return null},T.Yw=function(t){return this.pf===null&&(this.pf=new Kt),this.pf.add(t),this.model.Pe(t),this},T.mA=function(t){this.pf!==null&&(this.pf.remove(t),this.pf.count===0&&(this.pf=null)),this.model.ik(t)},T.Pe=function(t){return this.zg===null&&(this.zg=new Kt),this.zg.add(t),this},T.ik=function(t){this.zg!==null&&(this.zg.remove(t),this.zg.count===0&&(this.zg=null))},T.ds=function(t){if(this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.Tu(t),t.change!==wa&&(this.isModified=!0),this.zg!==null)for(var e=this.zg,i=e.length,n=0;n<i;n++)e.M(n)(t)},T.cb=function(t,e,i,n,s,a,l){a===void 0&&(a=null),l===void 0&&(l=null);var c=new Cr;c.diagram=this,c.change=t,c.propertyName=e,c.object=i,c.oldValue=n,c.oldParam=a,c.newValue=s,c.newParam=l,this.ds(c)},T.g=function(t,e,i,n,s){this.cb(Sr,t,this,e,i,n,s)},wt.prototype.changeState=function(t,e){if(t!==null&&t.diagram===this){var i=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var n=t.change;if(n===Sr){var s=t.object;if(mr(s,t.propertyName,t.I(e)),s instanceof at){var a=s.part;a!==null&&a.Wb()}this.isModified=!0}else if(n===Yr){var l=t.object,c=t.newParam,f=t.newValue;if(l instanceof ne)if(typeof c=="number"&&f instanceof at){e?l.pc(c):l.Gb(c,f);var m=l.part;m!==null&&m.Wb()}else typeof c=="number"&&f instanceof vo&&(f.isRow?e1(l,c,e?void 0:f):i1(l,c,e?void 0:f));else if(l instanceof Ho){var v=t.oldParam===!0;typeof c=="number"&&f instanceof ui&&(e?(f.isSelected=!1,f.isHighlighted=!1,f.Wb(),l.pc(v?c:-1,f,v)):l.oi(c,f,v))}else l instanceof wt?typeof c=="number"&&f instanceof Ho&&(e?this.Wa.mb(c):(f.Xe(this),this.Wa.Gb(c,f))):lt("unknown ChangedEvent.Insert object: "+t.toString());this.isModified=!0}else if(n===Jr){var w=t.object,C=t.oldParam,k=t.oldValue;if(w instanceof ne)typeof C=="number"&&k instanceof at?e?w.Gb(C,k):w.pc(C):typeof C=="number"&&k instanceof vo&&(k.isRow?e1(w,C,e?k:void 0):i1(w,C,e?k:void 0));else if(w instanceof Ho){var L=t.newParam===!0;typeof C=="number"&&k instanceof ui&&(e?0>w.Pa.indexOf(k)&&w.oi(C,k,L):(k.isSelected=!1,k.isHighlighted=!1,k.Wb(),w.pc(L?C:-1,k,L)))}else w instanceof wt?typeof C=="number"&&k instanceof Ho&&(e?(k.Xe(this),this.Wa.Gb(C,k)):this.Wa.mb(C)):lt("unknown ChangedEvent.Remove object: "+t.toString());this.isModified=!0}else n!==wa&&lt("unknown ChangedEvent: "+t.toString())}finally{this.skipsModelSourceBindings=i}}},wt.prototype.Ea=function(t){return this.undoManager.Ea(t)},wt.prototype.eb=function(t){return this.undoManager.eb(t)},wt.prototype.Kf=function(){return this.undoManager.Kf()},wt.prototype.commit=function(t,e){e===void 0&&(e="");var i=this.skipsUndoManager;e===null&&(this.skipsUndoManager=!0,e=""),this.undoManager.Ea(e);var n=!1;try{t(this),n=!0}finally{n?this.undoManager.eb(e):this.undoManager.Kf(),this.skipsUndoManager=i}},wt.prototype.updateAllTargetBindings=function(t){this.partManager.updateAllTargetBindings(t)},wt.prototype.rp=function(){this.partManager.rp()};function Q0(t,e,i){var n=t.animationManager;if(t.vb||t.ld)t.Ca=i,Yo(t),t.N(),t.Ee=!0,n.zb&&(Xu(n)||n.ce.add(n.H,"scale",e,t.Ca));else if(t.ta===null)t.Ca=i,Yo(t);else{t.vb=!0;var s=t.viewportBounds.copy(),a=t.Aa,l=t.ya,c=t.zoomPoint.x,f=t.zoomPoint.y,m=t.contentAlignment;isNaN(c)&&(m.$c()?m.Hf(sa)?c=0:m.Hf(fs)&&(c=a-1):c=m.sb()?m.x*(a-1):a/2),isNaN(f)&&(m.$c()?m.Hf(Ol)?f=0:m.Hf(jo)&&(f=l-1):f=m.sb()?m.y*(l-1):l/2),t.scaleComputation===null||t.animationManager.defaultAnimation.isAnimating||(i=t.scaleComputation(t,i)),i<t.minScale&&(i=t.minScale),i>t.maxScale&&(i=t.maxScale),a=z.allocAt(t.pa.x+c/e-c/i,t.pa.y+f/e-f/i),t.position=a,z.free(a),t.Ca=i,Yo(t),t.vb=!1,t.onViewportBoundsChanged(s,t.viewportBounds,e,!1),Ga(t,!1),n.zb&&(Xu(n)||n.ce.add(n.H,"scale",e,t.Ca))}}wt.prototype.onViewportBoundsChanged=function(t,e,i,n){if(!t.D(e)){n===void 0&&(n=!1),n||(this.Ee=!0),this.vd=!0;var s=this.layout;s===null||!s.isViewportSized||this.autoScale!==Jo||t.width===e.width&&t.height===e.height||s.C(),s=this.currentTool,this.Vk===!0&&s instanceof Vn&&(this.lastInput.documentPoint=this.Ps(this.lastInput.viewPoint),$u(s,this)),this.vb||this.invalidateViewport(t,e),Cu(this),this.fc.scale=i,this.fc.position.x=t.x,this.fc.position.y=t.y,this.fc.bounds.assign(t),this.fc.canvasSize.width=Math.round(t.width*i),this.fc.canvasSize.height=Math.round(t.height*i),this.fc.newCanvasSize.width=this.Aa,this.fc.newCanvasSize.height=this.ya,this.fc.isScroll=n,this.R("ViewportBoundsChanged",this.fc,t),this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Yc(e)&&a.bb()})}};function Cu(t,e){var i=t.fe;if(i!==null&&i.visible){for(var n=ii.alloc(),s=1,a=1,l=i.O.s,c=l.length,f=0;f<c;f++){var m=l[f],v=Math.abs(m.interval);2>v||(Zv(m.figure)?a=a*v/ht.vx(a,v):s=s*v/ht.vx(s,v))}if(l=i.gridCellSize,n.h(a*l.width,s*l.height),e!==void 0)s=e.width,a=e.height,t=e.x,l=e.y;else{if(e=It.alloc(),t=t.viewportBounds,e.h(t.x,t.y,t.width,t.height),!e.w()){It.free(e);return}s=e.width,a=e.height,t=e.x,l=e.y,It.free(e)}i.width=s+2*n.width,i.height=a+2*n.height,e=z.alloc(),ht.No(t,l,0,0,n.width,n.height,e),e.offset(-n.width,-n.height),ii.free(n),i.part.location=e,z.free(e)}}wt.prototype.clearSelection=function(t){t===void 0&&(t=!1);var e=this.selection;if(e.count!==0){t||this.R("ChangingSelection",e);for(var i=e.Fa(),n=i.length,s=0;s<n;s++)i[s].isSelected=!1;e.ka(),e.clear(),e.freeze(),t||this.R("ChangedSelection",e)}},wt.prototype.select=function(t){t!==null&&t.diagram===this&&(!t.isSelected||1<this.selection.count)&&(this.R("ChangingSelection",this.selection),this.clearSelection(!0),t.isSelected=!0,this.R("ChangedSelection",this.selection))},wt.prototype.rA=function(t){if(this.R("ChangingSelection",this.selection),this.clearSelection(!0),ce(t))for(var e=t.length,i=0;i<e;i++){var n=t[i];n instanceof ui||lt("Diagram.selectCollection given something that is not a Part: "+n),n.isSelected=!0}else for(t=t.iterator;t.next();)e=t.value,e instanceof ui||lt("Diagram.selectCollection given something that is not a Part: "+e),e.isSelected=!0;this.R("ChangedSelection",this.selection)},wt.prototype.clearHighlighteds=function(){var t=this.highlighteds;if(0<t.count){for(var e=t.Fa(),i=e.length,n=0;n<i;n++)e[n].isHighlighted=!1;t.ka(),t.clear(),t.freeze()}},T=wt.prototype,T.Iz=function(t){t!==null&&t.diagram===this&&(!t.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),t.isHighlighted=!0)},T.Jz=function(t){t=new At().addAll(t);for(var e=this.highlighteds.copy().hp(t).iterator;e.next();)e.value.isHighlighted=!1;for(t=t.iterator;t.next();)e=t.value,e instanceof ui||lt("Diagram.highlightCollection given something that is not a Part: "+e),e.isHighlighted=!0},T.scroll=function(t,e,i){i===void 0&&(i=1);var n=e==="up"||e==="down",s=0,a=z.alloc();if(t==="pixel")s=i;else if(t==="line")s=i*(n?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if(t==="page")t=n?this.viewportBounds.height:this.viewportBounds.width,t*=this.scale,t!==0&&(s=i*Math.max(t-(n?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0));else{if(t==="document"){s=this.documentBounds,i=this.viewportBounds,e==="up"?this.position=a.h(i.x,s.y):e==="left"?this.position=a.h(s.x,i.y):e==="down"?this.position=a.h(i.x,s.bottom-i.height):e==="right"&&(this.position=a.h(s.right-i.width,i.y)),z.free(a);return}lt("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+t)}s/=this.scale,i=this.position,e==="up"?this.position=a.h(i.x,i.y-s):e==="down"?this.position=a.h(i.x,i.y+s):e==="left"?this.position=a.h(i.x-s,i.y):e==="right"?this.position=a.h(i.x+s,i.y):lt("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+e),z.free(a)},T.tv=function(t){var e=this.viewportBounds;e.Re(t)||(t=t.center,t.x-=e.width/2,t.y-=e.height/2,this.position=t)},T.es=function(t){var e=this.viewportBounds;t=t.center,t.x-=e.width/2,t.y-=e.height/2,this.position=t},T.op=function(t){var e=this.Ab;e.reset(),this.Ca!==1&&e.scale(this.Ca);var i=this.pa;return(i.x!==0||i.y!==0)&&isFinite(i.x)&&isFinite(i.y)&&e.translate(-i.x,-i.y),t.copy().transform(this.Ab)},T.zA=function(t){var e=this.Ab,i=t.x,n=t.y,s=i+t.width,a=n+t.height,l=e.m11,c=e.m12,f=e.m21,m=e.m22,v=e.dx,w=e.dy,C=i*l+n*f+v;e=i*c+n*m+w;var k=s*l+n*f+v;return t=s*c+n*m+w,n=i*l+a*f+v,i=i*c+a*m+w,l=s*l+a*f+v,s=s*c+a*m+w,a=Math.min(C,k),C=Math.max(C,k),k=Math.min(e,t),e=Math.max(e,t),a=Math.min(a,n),C=Math.max(C,n),k=Math.min(k,i),e=Math.max(e,i),a=Math.min(a,l),C=Math.max(C,l),k=Math.min(k,s),e=Math.max(e,s),new It(a,k,C-a,e-k)},T.Ps=function(t){var e=this.Ab;e.reset(),this.Ca!==1&&e.scale(this.Ca);var i=this.pa;return(i.x!==0||i.y!==0)&&isFinite(i.x)&&isFinite(i.y)&&e.translate(-i.x,-i.y),Ji(t.copy(),this.Ab)};function Hp(t){var e=t.isModified;t.Tw!==e&&(t.Tw=e,t.R("Modified"))}function tm(t){return t=Vp.get(t),t!==null?new t:new _n}wt.prototype.doModelChanged=function(t){var e=this;if(t.model===this.model){var i=t.change,n=t.propertyName;if(i===wa&&n[0]==="S")if(n==="StartingFirstTransaction"){var s=this;t=this.toolManager,t.mouseDownTools.each(function(f){return f.diagram=s}),t.mouseMoveTools.each(function(f){return f.diagram=s}),t.mouseUpTools.each(function(f){return f.diagram=s}),this.ld||this.hf||(this.Jk=!0,this.fn&&(this.kg=!0))}else n==="StartingUndo"||n==="StartingRedo"?(t=this.animationManager,t.defaultAnimation.isAnimating&&!this.skipsUndoManager&&t.Cc(),this.R("ChangingSelection",this.selection)):n==="StartedTransaction"&&(t=this.animationManager,t.defaultAnimation.isAnimating&&!this.skipsUndoManager&&t.Cc());else if(this.aa){this.aa=!1;try{if(t.modelChange===""&&i===wa){(n==="FinishedUndo"||n==="FinishedRedo")&&(this.R("ChangedSelection",this.selection),bo(this));var a=this.animationManager;n==="RolledBackTransaction"&&a.Cc(),this.bx(),this.Jk=!0,this.bd(),this.undoManager.transactionLevel!==0&&this.undoManager.transactionLevel!==1||Of(a),n==="CommittedTransaction"&&this.undoManager.isJustDiscarded&&(this.Ce=Math.min(this.Ce,this.undoManager.historyIndex-1)),n!=="CommittedTransaction"&&n!=="RolledBackTransaction"||!this.undoManager.isPendingUnmodified||setTimeout(function(){e.isModified=!1},1);var l=t.isTransactionFinished;if(l&&(Hp(this),this.As.clear(),wn(this.animationManager)),!this.Rt&&l&&this.lastInput.targetDiagram){this.Rt=!0;var c=this;ge(function(){c.currentTool.standardMouseOver(),c.Rt=!1},10)}}}finally{this.aa=!0}}}};function nh(t,e){e=e.O.s;for(var i=e.length,n=0;n<i;n++)Yc(t,e[n])}function Yc(t,e){if(e instanceof da){var i=e.element;if(i!==null&&i instanceof HTMLImageElement){i.Bg instanceof At&&i.Bg.add(t);var n=e.Eg;if(n!==null&&n.sq===!0&&e.diagram!==null&&e.diagram.Xn.add(e),i.hn)if(i=i.getAttribute("src")||"",n=t.Og.I(i),n===null)n=[],n.push(e),t.Og.add(i,n);else{for(t=0;t<n.length;t++)if(n[t]===e)return;n.push(e)}}}}function em(t,e){if(e instanceof da){var i=e.element;if(i!==null&&i instanceof HTMLImageElement&&i.hn){var n=i.getAttribute("src")||"",s=t.Og.I(n);if(s!==null){for(var a=0;a<s.length;a++)if(s[a]===e){s.splice(a,1),s.length===0&&(t.Og.remove(n),i.Fq&&i.removeEventListener("load",i.Fq),i.Yp&&i.removeEventListener("error",i.Yp),delete i.Fq,delete i.Yp,i.Bg instanceof At&&i.Bg.remove(t),d0(n));break}}}}}wt.prototype.Wd=function(){this.partManager.Wd()},wt.prototype.Aj=function(t,e){this.Yd.Aj(t,e)},wt.prototype.Cj=function(t,e){this.Yd.Cj(t,e)},wt.prototype.findPartForKey=function(t){return this.partManager.findPartForKey(t)},wt.prototype.Vb=function(t){return this.partManager.Vb(t)},wt.prototype.findLinkForKey=function(t){return this.partManager.findLinkForKey(t)},T=wt.prototype,T.Lc=function(t){return this.partManager.Lc(t)},T.ii=function(t){return this.partManager.ii(t)},T.Kc=function(t){return this.partManager.Kc(t)},T.ms=function(t){for(var e=[],i=0;i<arguments.length;++i)e[i]=arguments[i];return this.partManager.ms.apply(this.partManager,e instanceof Array?e:Yn($n(e)))},T.ls=function(t){for(var e=[],i=0;i<arguments.length;++i)e[i]=arguments[i];return this.partManager.ls.apply(this.partManager,e instanceof Array?e:Yn($n(e)))};function Yo(t){var e=t.pa,i=t.Ca;t.Rw.h(e.x,e.y,Math.max(t.Aa,0)/i,Math.max(t.ya,0)/i),t.vd=!0}function rh(t,e){t.Zi=!1;var i=t.Sp;i.D(e)||(i=i.copy(),t.Sp.assign(e),Ga(t,!1),t.R("DocumentBoundsChanged",void 0,i),t.Ee=!0,t.N())}T.Va=function(){if(this.Zi){var t=It.alloc();rh(this,this.computeBounds(t)),It.free(t)}},T.rz=function(){for(var t=new At,e=this.nodes;e.next();){var i=e.value;i.isTopLevel&&t.add(i)}for(e=this.links;e.next();)i=e.value,i.isTopLevel&&t.add(i);return t.iterator},T.qz=function(){return this.ai.iterator},T.Uz=function(t){bo(this),t&&Jc(this,!0),this.ld?im(this,!1):(this.Jk=!0,Vs(this))};function Jc(t,e){for(var i=t.ai.iterator;i.next();)Vf(t,i.value,e);t.layout&&(e?t.layout.isValidLayout=!1:t.layout.C())}function Vf(t,e,i){if(e!==null){for(var n=e.gl.iterator;n.next();)Vf(t,n.value,i);e.layout!==null&&(i?e.layout.isValidLayout=!1:e.layout.C())}}function im(t,e){if(t.xh&&!t.lt){var i=t.aa;t.aa=!0;var n=t.undoManager.transactionLevel,s=t.layout,a=t.animationManager;try{n===0&&(t.undoManager.isInternalTransaction=!0,t.Ea("Layout")),1>=n&&!a.defaultAnimation.isAnimating&&!a.zb&&(e||Mu(a,"Layout")),t.xh=!1;for(var l=t.ai.iterator;l.next();)nm(t,l.value,e,n);s.isValidLayout||(!e||s.isRealtime||s.isRealtime===null||n===0?(s.doLayout(t),bo(t),s.isValidLayout=!0):t.xh=!0)}finally{e=t.undoManager.isInternalTransaction,n===0&&(t.eb("Layout"),t.undoManager.isInternalTransaction=!1),!e||n!==0&&n!==1||Of(a),t.aa=i}}}function nm(t,e,i,n){if(e!==null){for(var s=e.gl.iterator;s.next();)nm(t,s.value,i,n);s=e.layout,s===null||s.isValidLayout||(!i||s.isRealtime||n===0?(e.rh=!e.location.w(),s.doLayout(e),e.C(32),Bh(t,e),s.isValidLayout=!0):t.xh=!0)}}T.yz=function(){for(var t=new Kt,e=this.nodes;e.next();){var i=e.value;i.isTopLevel&&i.kh()===null&&t.add(i)}return t.iterator};function rm(t){function e(s){var a=s.toLowerCase(),l=new Kt;i.add(s,l),i.add(a,l),n.add(s,s),n.add(a,s)}var i=new pe,n=new pe;e("InitialAnimationStarting"),e("AnimationStarting"),e("AnimationFinished"),e("BackgroundSingleClicked"),e("BackgroundDoubleClicked"),e("BackgroundContextClicked"),e("ClipboardChanged"),e("ClipboardPasted"),e("DocumentBoundsChanged"),e("ExternalObjectsDropped"),e("GainedFocus"),e("InitialLayoutCompleted"),e("LayoutCompleted"),e("LinkDrawn"),e("LinkRelinked"),e("LinkReshaped"),e("LostFocus"),e("Modified"),e("ObjectSingleClicked"),e("ObjectDoubleClicked"),e("ObjectContextClicked"),e("PartCreated"),e("PartResized"),e("PartRotated"),e("SelectionMoved"),e("SelectionCopied"),e("SelectionDeleting"),e("SelectionDeleted"),e("SelectionGrouped"),e("SelectionUngrouped"),e("ChangingSelection"),e("ChangedSelection"),e("SubGraphCollapsed"),e("SubGraphExpanded"),e("TextEdited"),e("TreeCollapsed"),e("TreeExpanded"),e("ViewportBoundsChanged"),e("InvalidateDraw"),t.iw=i,t.hw=n}function om(t,e){var i=t.hw.I(e);return i!==null?i:t.hw.I(e.toLowerCase())}function qc(t,e){var i=t.iw.I(e);if(i!==null||(i=t.iw.I(e.toLowerCase()),i!==null))return i;lt("Unknown DiagramEvent name: "+e)}T.Bj=function(t,e){return t=qc(this,t),t!==null&&t.add(e),this},T.am=function(t,e){t=qc(this,t),t!==null&&t.remove(e)},T.R=function(t,e,i){var n=qc(this,t),s=new Sh;if(s.diagram=this,t=om(this,t),t!==null&&(s.name=t),e!==void 0&&(s.subject=e),i!==void 0&&(s.parameter=i),e=n.length,e===1)n.M(0)(s);else if(e!==0)for(n=n.Fa(),i=0;i<e;i++)(0,n[i])(s)};function Ca(t){if(t.animationManager.isTicking)return!1;var e=t.currentTool;return e===t.toolManager.findTool("Dragging")?!t.Mr||e.isComplexRoutingRealtime:!0}T.Yj=function(t,e){return oh(this,!1,null,e||null).Yj(t.x,t.y,t.width,t.height)},wt.prototype.computeOccupiedArea=function(t){return this.isVirtualized?this.viewportBounds.copy():this.Zi?zi(this,t):t.assign(this.documentBounds)};function oh(t,e,i,n){var s=t.Xh;if(s===null&&(t.Xh=s=new fp(t.avoidanceCellSize)),s.vs||s.group!==i||s.Yx!==n){if(s.Hx=Math.max(s.Os+1,Math.floor(t.avoidanceLimit/t.avoidanceCellSize.width)),s.Ix=Math.max(s.Os+1,Math.floor(t.avoidanceLimit/t.avoidanceCellSize.height)),i!==null&&(i=sm(t,i)),i===null){e=It.alloc(),t.computeOccupiedArea(e),e.Bc(100,100),s.initialize(e);for(var a=t.nodes;a.next();){var l=a.value,c=l.layer;c!==null&&c.visible&&!c.isTemporary&&Wf(t,l,n,e)}It.free(e)}else{for(0<i.memberParts.count&&(e=t.computePartsBounds(i.memberParts,!1),e.Bc(20,20),s.initialize(e)),e=It.alloc(),a=i.memberParts;a.next();)l=a.value,l instanceof Le&&Wf(t,l,n,e);It.free(e)}s.group=i,s.Yx=n,s.vs=!1}else e&&b1(s);return s}function sm(t,e){return e.avoidable&&!e.isLinkLabel?e:e.containingGroup!==null?sm(t,e.containingGroup):null}function Wf(t,e,i,n){if(e!==i&&e.isVisible()){if(e.avoidable&&!e.isLinkLabel){e=e.getAvoidableRect(n),t=t.Xh;var s=e.x,a=e.y;if(b0(t,s,a))for(i=(a-t.Od)/t.sc|0,n=Math.min((s+e.width-t.Nd)/t.rc|0,t.di),e=Math.min((a+e.height-t.Od)/t.sc|0,t.ei),s=(s-t.Nd)/t.rc|0;s<=n;s++)if(a=t.ac[s],a.fill)a.fill(fh,i,e+1);else for(var l=i;l<=e;l++)a[l]=fh}else if(e instanceof ji)for(e=e.memberParts;e.next();)s=e.value,s instanceof Le&&Wf(t,s,i,n)}}function sh(t,e){t.Xh===null||t.Xh.vs||e!==void 0&&(!e.avoidable||e.isLinkLabel)||(t.Xh.vs=!0)}wt.prototype.gs=function(t){this.wp.assign(t),this.computeAutoScrollPosition(this.wp).Xa(this.position)?this.ug():am(this)};function am(t){t.vk===-1&&(t.vk=ge(function(){if(t.vk!==-1&&(t.ug(),t.lastInput.event!==null)){var e=t.computeAutoScrollPosition(t.wp);e.Xa(t.position)||(t.position=e,t.lastInput.documentPoint=t.Ps(t.wp),t.doMouseMove(),t.Zi=!0,e=It.alloc(),t.computeBounds(e),e.ed(t.documentBounds),rh(t,e),It.free(e),t.Fc=!0,t.bd(),am(t))}},t.vp))}wt.prototype.ug=function(){this.vk!==-1&&(Z.clearTimeout(this.vk),this.vk=-1)},wt.prototype.computeAutoScrollPosition=function(t){var e=this.position,i=this.xp;if(0>=i.top&&0>=i.left&&0>=i.right&&0>=i.bottom)return e;var n=this.viewportBounds,s=this.scale;n=It.allocAt(0,0,n.width*s,n.height*s);var a=z.allocAt(0,0);if(t.x>=n.x&&t.x<n.x+i.left&&this.allowHorizontalScroll){var l=Math.max(this.scrollHorizontalLineChange,1);l|=0,a.x-=l,t.x<n.x+i.left/2&&(a.x-=l),t.x<n.x+i.left/4&&(a.x-=4*l)}else t.x<=n.x+n.width&&t.x>n.x+n.width-i.right&&this.allowHorizontalScroll&&(l=Math.max(this.scrollHorizontalLineChange,1),l|=0,a.x+=l,t.x>n.x+n.width-i.right/2&&(a.x+=l),t.x>n.x+n.width-i.right/4&&(a.x+=4*l));return t.y>=n.y&&t.y<n.y+i.top&&this.allowVerticalScroll?(l=Math.max(this.scrollVerticalLineChange,1),l|=0,a.y-=l,t.y<n.y+i.top/2&&(a.y-=l),t.y<n.y+i.top/4&&(a.y-=4*l)):t.y<=n.y+n.height&&t.y>n.y+n.height-i.bottom&&this.allowVerticalScroll&&(l=Math.max(this.scrollVerticalLineChange,1),l|=0,a.y+=l,t.y>n.y+n.height-i.bottom/2&&(a.y+=l),t.y>n.y+n.height-i.bottom/4&&(a.y+=4*l)),a.Xa(fn)||(e=new z(e.x+a.x/s,e.y+a.y/s)),It.free(n),z.free(a),e},T=wt.prototype,T.Cs=function(){return null},T.av=function(){return null},T.bs=function(t,e){this.pj.add(t,e)},T.Fu=function(t){(this.Pw=t)||this.nodes.each(function(e){e instanceof ji&&(e.$p=null)})};function Uf(t,e,i){function n(){var v=+new Date;for(a=!0,l.reset();l.next();)if(!l.value[0].al){a=!1;break}a||v-m>f?e(i,s,c):Z.requestAnimationFrame(n)}for(var s=i.callback,a=!0,l=t.Og.iterator;l.next();)if(!l.value[0].al){a=!1;break}if(typeof s!="function"||a)return e(i,s,t);var c=t,f=i.callbackTimeout||300,m=+new Date;return Z.requestAnimationFrame(function(){n()}),null}T.Wz=function(t){return Bn?(t===void 0&&(t={}),t.returnType="Image",this.Jx(t)):null},T.Jx=function(t){return t===void 0&&(t={}),Uf(this,this.Xz,t)},T.Xz=function(t,e,i){var n=wg(i,t,"canvas",null);if(n===null)return null;i=n.Z.canvas;var s=null;if(i!==null)switch(s=t.returnType,s===void 0?s="string":s=s.toLowerCase(),s){case jd+"data":s=n.getImageData(0,0,i.width,i.height);break;case jd:n=(t.document||document).createElement("img"),n.src=i.toDataURL(t.type,t.details),s=n;break;case"blob":return typeof e!="function"&&lt('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.'),typeof i.toBlob=="function"?(i.toBlob(e,t.type,t.details),"toBlob"):(e(null),null);default:s=i.toDataURL(t.type,t.details)}return typeof e=="function"?(e(s),null):s};function wg(t,e,i,n){if(t.animationManager.Cc(),t.bd(),t.ta===null)return null;typeof e!="object"&&lt("properties argument must be an Object.");var s=e.size||null,a=e.scale||null;e.scale!==void 0&&isNaN(e.scale)&&(a="NaN");var l=e.maxSize;e.maxSize===void 0&&(l=i==="SVG"?new ii(1/0,1/0):new ii(2e3,2e3));var c=e.position||null,f=e.parts||null,m=e.padding===void 0?1:e.padding,v=e.background||null,w=e.omitTemporary;w===void 0&&(w=!0);var C=e.document||document,k=e.elementFinished||null,L=e.showTemporary;L===void 0&&(L=!w),e=e.showGrid,e===void 0&&(e=L),s!==null&&isNaN(s.width)&&isNaN(s.height)&&(s=null),typeof m=="number"?m=new ai(m):m instanceof ai||lt("MakeImage padding must be a Margin or a number."),m.left=Math.max(m.left,0),m.right=Math.max(m.right,0),m.top=Math.max(m.top,0),m.bottom=Math.max(m.bottom,0),t.ib.Vc(!0),w=new Tl(null,C,void 0,!0);var A=w.context;if(!(s||a||f||c))return w.width=t.Aa+Math.ceil(m.left+m.right),w.height=t.ya+Math.ceil(m.top+m.bottom),i==="SVG"?n===null?null:(n.resize(w.width,w.height,w.width,w.height),n.ownerDocument=C,n.hs=k,$l(t,n.context,m,new ii(w.width,w.height),t.Ca,t.pa,f,v,L,e),n.context):(t.Xm=!1,$l(t,A,m,new ii(w.width,w.height),t.Ca,t.pa,f,v,L,e),t.Xm=!0,w.context);var H=t.Pp,R=t.documentBounds.copy();if(R.Fv(t.yb),L)for(var X=t.Wa.s,Y=X.length,tt=0;tt<Y;tt++){var st=X[tt];if(st.visible&&st.isTemporary){st=st.Pa.s;for(var bt=st.length,Te=0;Te<bt;Te++){var Ke=st[Te];Ke.isInDocumentBounds&&Ke.isVisible()&&(Ke=Ke.actualBounds,Ke.w()&&R.ed(Ke))}}}if(X=new z(R.x,R.y),f!==null){for(Y=new It(0,0,0,0),tt=!0,st=f.iterator,st.reset();st.next();)bt=st.value,bt instanceof ui&&(Te=bt.layer,Te!==null&&!Te.visible||Te!==null&&!L&&Te.isTemporary||!bt.isVisible()||(bt=bt.actualBounds,bt.w()&&(tt?(tt=!1,Y.assign(bt)):Y.ed(bt))));R.width=Y.width,R.height=Y.height,X.x=Y.x,X.y=Y.y}return c!==null&&c.w()&&(X=c,a||(a=H)),Y=c=0,m!==null&&(c=m.left+m.right,Y=m.top+m.bottom),tt=st=0,s!==null&&(st=s.width,tt=s.height,isFinite(st)&&(st=Math.max(0,st-c)),isFinite(tt)&&(tt=Math.max(0,tt-Y))),s!==null&&a!==null?(a==="NaN"&&(a=H),s.w()?(s=st,R=tt):isNaN(tt)?(s=st,R=R.height*a):(s=R.width*a,R=tt)):s!==null?s.w()?(a=Math.min(st/R.width,tt/R.height),s=st,R=tt):isNaN(tt)?(a=st/R.width,s=st,R=R.height*a):(a=tt/R.height,s=R.width*a,R=tt):a!==null?a==="NaN"&&l.w()?(a=Math.min((l.width-c)/R.width,(l.height-Y)/R.height),a>H?(a=H,s=R.width,R=R.height):(s=l.width,R=l.height)):(s=R.width*a,R=R.height*a):(a=H,s=R.width,R=R.height),m!==null?(s+=c,R+=Y):m=new ai(0),l!==null&&(H=l.width,l=l.height,isNaN(H)&&(H=2e3),isNaN(l)&&(l=2e3),isFinite(H)&&(s=Math.min(s,H)),isFinite(l)&&(R=Math.min(R,l))),w.width=Math.ceil(s),w.height=Math.ceil(R),i==="SVG"?n===null?null:(n.resize(w.width,w.height,w.width,w.height),n.ownerDocument=C,n.hs=k,$l(t,n.context,m,new ii(Math.ceil(s),Math.ceil(R)),a,X,f,v,L,e),n.context):(t.Xm=!1,$l(t,A,m,new ii(Math.ceil(s),Math.ceil(R)),a,X,f,v,L,e),t.Xm=!0,w.context)}ct.Object.defineProperties(wt.prototype,{renderer:{get:function(){return this.nl},set:function(t){this instanceof S||(t===""&&(t="default"),t=t.toLowerCase(),t!==this.nl&&(this.nl=t,t==="default"||t==="canvas"?(t=this.pj.get("svg"),t!==null&&t.Oa.remove(),this.ta&&(this.ib=this.ta.context)):t==="svg"?(this.pj.contains("svg")?t=this.pj.get("svg"):(t=new su(this,Z.document),this.bs("svg",t)),this.div!==null&&this.div.appendChild(t.Oa),this.ib=t.context,this.ta&&(this.ta.context.setTransform(this.Mb,0,0,this.Mb,0,0),this.ta.context.clearRect(0,0,this.Aa,this.ya))):t!=="debug"||this.pj.contains("SVG")||(t=new su(this,Z.document),this.bs("SVG",t),t.Oa.style.backgroundColor="whitesmoke",this.div!==null&&this.div.after(t.Oa)),this.hk()))}},div:{get:function(){return this.Ka},set:function(t){if(this.Ka!==t){var e=this.Ka;e!==null?(e.H=void 0,e.goDiagram=void 0,e.go=void 0,e.innerHTML="",this.ta!==null&&(e=this.ta.Oa,this.removeEventListener(e,"pointermove",this.dk,!1),this.removeEventListener(e,"pointerdown",this.ui,!1),this.removeEventListener(e,"pointerup",this.fk,!1),this.removeEventListener(e,"pointerout",this.ek,!1),this.removeEventListener(e,"pointercancel",this.ck,!1),this.ta.mx()),this.ol&&(this.ol.disconnect(),this.ol=null),e=this.toolManager,e!==null&&(e.mouseDownTools.each(function(i){i.cancelWaitAfter()}),e.mouseMoveTools.each(function(i){i.cancelWaitAfter()}),e.mouseUpTools.each(function(i){i.cancelWaitAfter()})),e.cancelWaitAfter(),this.currentTool.doCancel(),this.ta=null,this.removeEventListener(Z,"resize",this.Ov,!1),this.removeEventListener(Z,"wheel",this.$j,!0),fr===this&&(fr=null)):this.ui===null&&(this.hf=!1),this.Ka=null,t!==null&&((e=t.H)&&(e.div=null),cl(this,t),this.hk())}}},$w:{get:function(){return this.Sq}},pi:{get:function(){return this.hf}},draggedLink:{get:function(){return this.nt},set:function(t){this.nt!==t&&(this.nt=t,t!==null&&(this.Vt=t.fromPort,this.Wt=t.toPort))}},Mx:{get:function(){return this.Vt},set:function(t){this.Vt=t}},Nx:{get:function(){return this.Wt},set:function(t){this.Wt=t}},animationManager:{get:function(){return this.Yd}},undoManager:{get:function(){return this.cc.undoManager}},skipsUndoManager:{get:function(){return this.Wg},set:function(t){this.Wg=t,this.cc.skipsUndoManager=t}},delaysLayout:{get:function(){return this.lt},set:function(t){this.lt=t}},opacity:{get:function(){return this.pb},set:function(t){var e=this.pb;e!==t&&((0>t||1<t)&&me(t,"0 <= value <= 1",wt,"opacity"),this.pb=t,this.g("opacity",e,t),this.N())}},validCycle:{get:function(){return this.wu},set:function(t){var e=this.wu;e!==t&&(this.wu=t,this.g("validCycle",e,t))}},layers:{get:function(){return this.Wa.iterator}},isModelReadOnly:{get:function(){var t=this.cc;return t===null?!1:t.isReadOnly},set:function(t){var e=this.cc;e!==null&&(e.isReadOnly=t)}},isReadOnly:{get:function(){return this.Gg},set:function(t){var e=this.Gg;e!==t&&(this.Gg=t,this.g("isReadOnly",e,t))}},isEnabled:{get:function(){return this.Jd},set:function(t){var e=this.Jd;e!==t&&(this.Jd=t,this.g("isEnabled",e,t))}},allowClipboard:{get:function(){return this.Us},set:function(t){var e=this.Us;e!==t&&(this.Us=t,this.g("allowClipboard",e,t))}},allowCopy:{get:function(){return this.Fi},set:function(t){var e=this.Fi;e!==t&&(this.Fi=t,this.g("allowCopy",e,t))}},allowDelete:{get:function(){return this.Gi},set:function(t){var e=this.Gi;e!==t&&(this.Gi=t,this.g("allowDelete",e,t))}},allowDragOut:{get:function(){return this.Vs},set:function(t){var e=this.Vs;e!==t&&(this.Vs=t,this.g("allowDragOut",e,t))}},allowDrop:{get:function(){return this.Ws},set:function(t){var e=this.Ws;e!==t&&(this.Ws=t,this.g("allowDrop",e,t))}},allowTextEdit:{get:function(){return this.Pi},set:function(t){var e=this.Pi;e!==t&&(this.Pi=t,this.g("allowTextEdit",e,t))}},allowGroup:{get:function(){return this.Hi},set:function(t){var e=this.Hi;e!==t&&(this.Hi=t,this.g("allowGroup",e,t))}},allowUngroup:{get:function(){return this.Qi},set:function(t){var e=this.Qi;e!==t&&(this.Qi=t,this.g("allowUngroup",e,t))}},allowInsert:{get:function(){return this.Ys},set:function(t){var e=this.Ys;e!==t&&(this.Ys=t,this.g("allowInsert",e,t))}},allowLink:{get:function(){return this.Ii},set:function(t){var e=this.Ii;e!==t&&(this.Ii=t,this.g("allowLink",e,t))}},allowRelink:{get:function(){return this.Ki},set:function(t){var e=this.Ki;e!==t&&(this.Ki=t,this.g("allowRelink",e,t))}},allowMove:{get:function(){return this.Ji},set:function(t){var e=this.Ji;e!==t&&(this.Ji=t,this.g("allowMove",e,t))}},allowReshape:{get:function(){return this.Li},set:function(t){var e=this.Li;e!==t&&(this.Li=t,this.g("allowReshape",e,t))}},allowResize:{get:function(){return this.Mi},set:function(t){var e=this.Mi;e!==t&&(this.Mi=t,this.g("allowResize",e,t))}},allowRotate:{get:function(){return this.Ni},set:function(t){var e=this.Ni;e!==t&&(this.Ni=t,this.g("allowRotate",e,t))}},allowSelect:{get:function(){return this.Oi},set:function(t){var e=this.Oi;e!==t&&(this.Oi=t,this.g("allowSelect",e,t))}},allowUndo:{get:function(){return this.Zs},set:function(t){var e=this.Zs;e!==t&&(this.Zs=t,this.g("allowUndo",e,t))}},allowZoom:{get:function(){return this.at},set:function(t){var e=this.at;e!==t&&(this.at=t,this.g("allowZoom",e,t))}},hasVerticalScrollbar:{get:function(){return this.nn},set:function(t){var e=this.nn;e!==t&&(this.nn=t,this.Ee=!0,this.N(),this.g("hasVerticalScrollbar",e,t),Ga(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.mn},set:function(t){var e=this.mn;e!==t&&(this.mn=t,this.Ee=!0,this.N(),this.g("hasHorizontalScrollbar",e,t),Ga(this,!1))}},allowHorizontalScroll:{get:function(){return this.Xs},set:function(t){var e=this.Xs;e!==t&&(this.Xs=t,this.g("allowHorizontalScroll",e,t),Ga(this,!1))}},allowVerticalScroll:{get:function(){return this.$s},set:function(t){var e=this.$s;e!==t&&(this.$s=t,this.g("allowVerticalScroll",e,t),Ga(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.iu},set:function(t){var e=this.iu;e!==t&&(0>t&&me(t,">= 0",wt,"scrollHorizontalLineChange"),this.iu=t,this.g("scrollHorizontalLineChange",e,t))}},scrollVerticalLineChange:{get:function(){return this.mu},set:function(t){var e=this.mu;e!==t&&(0>t&&me(t,">= 0",wt,"scrollVerticalLineChange"),this.mu=t,this.g("scrollVerticalLineChange",e,t))}},lastInput:{get:function(){return this.cj},set:function(t){this.cj=t}},previousInput:{get:function(){return this.Qg},set:function(t){this.Qg=t}},firstInput:{get:function(){return this.bq},set:function(t){this.bq=t}},currentCursor:{get:function(){return this.it},set:function(t){if(t===""&&(t=this.Op),this.it!==t){var e=this.ta,i=this.Ka;if(e!==null&&i!==null){this.it=t;var n=e.style.cursor;e.style.cursor=t,i.style.cursor=t,e.style.cursor===n&&(e.style.cursor="-webkit-"+t,i.style.cursor="-webkit-"+t,e.style.cursor===n&&(e.style.cursor="-moz-"+t,i.style.cursor="-moz-"+t,e.style.cursor===n&&(e.style.cursor=t,i.style.cursor=t)))}}}},defaultCursor:{get:function(){return this.Op},set:function(t){t===""&&(t="auto");var e=this.Op;e!==t&&(this.Op=t,this.g("defaultCursor",e,t))}},click:{get:function(){return this.zh},set:function(t){var e=this.zh;e!==t&&(this.zh=t,this.g("click",e,t))}},doubleClick:{get:function(){return this.Fh},set:function(t){var e=this.Fh;e!==t&&(this.Fh=t,this.g("doubleClick",e,t))}},contextClick:{get:function(){return this.Bh},set:function(t){var e=this.Bh;e!==t&&(this.Bh=t,this.g("contextClick",e,t))}},mouseOver:{get:function(){return this.Qh},set:function(t){var e=this.Qh;e!==t&&(this.Qh=t,this.g("mouseOver",e,t))}},mouseHover:{get:function(){return this.Oh},set:function(t){var e=this.Oh;e!==t&&(this.Oh=t,this.g("mouseHover",e,t))}},mouseHold:{get:function(){return this.Nh},set:function(t){var e=this.Nh;e!==t&&(this.Nh=t,this.g("mouseHold",e,t))}},mouseDragOver:{get:function(){return this.Qt},set:function(t){var e=this.Qt;e!==t&&(this.Qt=t,this.g("mouseDragOver",e,t))}},mouseDrop:{get:function(){return this.Lh},set:function(t){var e=this.Lh;e!==t&&(this.Lh=t,this.g("mouseDrop",e,t))}},handlesDragDropForTopLevelParts:{get:function(){return this.xt},set:function(t){var e=this.xt;e!==t&&(this.xt=t,this.g("handlesDragDropForTopLevelParts",e,t))}},mouseEnter:{get:function(){return this.Mh},set:function(t){var e=this.Mh;e!==t&&(this.Mh=t,this.g("mouseEnter",e,t))}},mouseLeave:{get:function(){return this.Ph},set:function(t){var e=this.Ph;e!==t&&(this.Ph=t,this.g("mouseLeave",e,t))}},toolTip:{get:function(){return this.$h},set:function(t){var e=this.$h;e!==t&&(this.$h=t,this.g("toolTip",e,t))}},contextMenu:{get:function(){return this.Ch},set:function(t){var e=this.Ch;e!==t&&(this.Ch=t,this.g("contextMenu",e,t))}},commandHandler:{get:function(){return this.nb},set:function(t){this.nb!==t&&(this.nb=t,t.Xe(this))}},toolManager:{get:function(){return this.te},set:function(t){this.te!==t&&(this.te=t,t.diagram=this)}},defaultTool:{get:function(){return this.ob},set:function(t){var e=this.ob;e!==t&&(this.ob=t,t.diagram=this,this.currentTool===e&&(this.currentTool=t))}},currentTool:{get:function(){return this.hb},set:function(t){var e=this.hb;e&&(e.isActive&&e.doDeactivate(),e.cancelWaitAfter(),e.doStop()),t===null&&(t=this.defaultTool),t!==null&&(this.hb=t,t.diagram=this,t.doStart())}},selection:{get:function(){return this.Hw}},maxSelectionCount:{get:function(){return this.Nt},set:function(t){var e=this.Nt;if(e!==t)if(0<=t&&!isNaN(t)){if(this.Nt=t,this.g("maxSelectionCount",e,t),!this.undoManager.isUndoingRedoing&&(t=this.selection.count-t,0<t)){this.R("ChangingSelection",this.selection),e=this.selection.Fa();for(var i=0;i<t;i++)e[i].isSelected=!1;this.R("ChangedSelection",this.selection)}}else me(t,">= 0",wt,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{get:function(){return this.St},set:function(t){var e=this.St;e!==t&&(this.St=t,this.g("nodeSelectionAdornmentTemplate",e,t))}},groupSelectionAdornmentTemplate:{get:function(){return this.wt},set:function(t){var e=this.wt;e!==t&&(this.wt=t,this.g("groupSelectionAdornmentTemplate",e,t))}},linkSelectionAdornmentTemplate:{get:function(){return this.Kt},set:function(t){var e=this.Kt;e!==t&&(this.Kt=t,this.g("linkSelectionAdornmentTemplate",e,t))}},highlighteds:{get:function(){return this.nw}},isModified:{get:function(){var t=this.undoManager;return t.isEnabled?t.currentTransaction!==null?!0:this.rn&&this.Ce!==t.historyIndex:this.rn},set:function(t){if(this.rn!==t){this.rn=t;var e=this.undoManager;!t&&e.isEnabled&&(this.Ce=e.historyIndex),t||Hp(this)}}},model:{get:function(){return this.cc},set:function(t){var e=this.cc;if(e!==t){this.currentTool.doCancel(),e&&e.undoManager!==t.undoManager&&e.undoManager.isInTransaction&&lt("Do not replace a Diagram.model while a transaction is in progress."),this.animationManager.Cc(!0);var i=Ah(this,!0);this.hf=!1,this.fn=!0,this.Ce=-2,this.kg=!1;var n=this.vb;this.vb=!0,Mu(this.animationManager,"Model"),e&&(this.pf!==null&&this.pf.each(function(a){return e.ik(a)}),e.ik(this.Oc)),this.cc=t,this.partManager=tm(this.cc.type);for(var s=0;s<i.length;s++)this.add(i[s]);t.Pe(this.Hb),this.partManager.addAllModeledParts(),t.ik(this.Hb),t.Pe(this.Oc),this.pf!==null&&this.pf.each(function(a){return t.Pe(a)}),this.vb=n,this.Ya(),this.vb||this.N(),e&&t.undoManager.copyProperties(e.undoManager)}}},aa:{get:function(){return this.rw},set:function(t){this.rw=t}},As:{get:function(){return this.sy}},skipsModelSourceBindings:{get:function(){return this.Iw},set:function(t){this.Iw=t}},Ns:{get:function(){return this.ou},set:function(t){this.ou=t}},nodeTemplate:{get:function(){return this.Lg.I("")},set:function(t){var e=this.Lg.I("");e!==t&&(this.Lg.add("",t),this.g("nodeTemplate",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},nodeTemplateMap:{get:function(){return this.Lg},set:function(t){var e=this.Lg;e!==t&&(this.Lg=t,this.g("nodeTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},groupTemplate:{get:function(){return this.Yi.I("")},set:function(t){var e=this.Yi.I("");e!==t&&(this.Yi.add("",t),this.g("groupTemplate",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},groupTemplateMap:{get:function(){return this.Yi},set:function(t){var e=this.Yi;e!==t&&(this.Yi=t,this.g("groupTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},linkTemplate:{get:function(){return this.Kh.I("")},set:function(t){var e=this.Kh.I("");e!==t&&(this.Kh.add("",t),this.g("linkTemplate",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},linkTemplateMap:{get:function(){return this.Kh},set:function(t){var e=this.Kh;e!==t&&(this.Kh=t,this.g("linkTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.Wd())}},isMouseCaptured:{get:function(){return this.qw},set:function(t){var e=this.ta;e!==null&&(e=e.Oa,e instanceof SVGElement||(t?(this.lastInput.bubbles=!1,this.removeEventListener(e,"pointermove",this.dk,!1),this.removeEventListener(e,"pointerdown",this.ui,!1),this.removeEventListener(e,"pointerup",this.fk,!1),this.removeEventListener(e,"pointerout",this.ek,!1),this.removeEventListener(e,"pointercancel",this.ck,!1),this.addEventListener(Z,"pointermove",this.dk,!0),this.addEventListener(Z,"pointerdown",this.ui,!0),this.addEventListener(Z,"pointerup",this.fk,!0),this.addEventListener(Z,"pointerout",this.ek,!0),this.addEventListener(Z,"pointercancel",this.ck,!0),this.removeEventListener(e,"wheel",this.$j,!1),this.addEventListener(Z,"wheel",this.$j,!0),this.addEventListener(Z,"selectstart",this.preventDefault,!1)):(this.removeEventListener(Z,"pointermove",this.dk,!0),this.removeEventListener(Z,"pointerdown",this.ui,!0),this.removeEventListener(Z,"pointerup",this.fk,!0),this.removeEventListener(Z,"pointerout",this.ek,!0),this.removeEventListener(Z,"pointercancel",this.ck,!0),this.addEventListener(e,"pointermove",this.dk,!1),this.addEventListener(e,"pointerdown",this.ui,!1),this.addEventListener(e,"pointerup",this.fk,!1),this.addEventListener(e,"pointerout",this.ek,!1),this.addEventListener(e,"pointercancel",this.ck,!1),this.removeEventListener(Z,"wheel",this.$j,!0),this.removeEventListener(Z,"selectstart",this.preventDefault,!1),this.addEventListener(e,"wheel",this.$j,!1)),this.qw=t))}},position:{get:function(){return this.pa},set:function(t){var e=z.alloc().assign(this.pa);if(!e.D(t)){var i=this.viewportBounds.copy();this.pa.assign(t),U0(this.animationManager,e,this.pa),this.vb||this.ta===null&&!this.wo.w()?Yo(this):(this.vb=!0,t=this.scale,Id(this,this.Sp,this.Aa/t,this.ya/t,this.zk,!1),this.vb=!1),this.vb||this.onViewportBoundsChanged(i,this.viewportBounds,this.Ca,!1)}z.free(e)}},initialPosition:{get:function(){return this.zt},set:function(t){this.zt.D(t)||(this.zt=t.J())}},initialScale:{get:function(){return this.At},set:function(t){this.At!==t&&(this.At=t)}},grid:{get:function(){return this.fe===null&&(this.fe=$p(this)),this.fe},set:function(t){var e=this.fe;if(e!==t){e===null&&(e=this.fe=$p(this)),t.type!==ne.Grid&&lt("Diagram.grid must be a Panel of type Panel.Grid");var i=e.panel;i!==null&&i.remove(e),this.fe=t,t.name="GRID",i!==null&&i.add(t),Cu(this),this.N(),this.g("grid",e,t)}}},viewportBounds:{get:function(){return this.Rw}},viewSize:{get:function(){return this.wo},set:function(t){var e=this.viewSize;e.D(t)||(this.wo=t=t.J(),this.ya=this.Aa=0,t.w()?(this.Aa=t.width,this.ya=t.height):this.Ka!==null&&(this.Aa=this.Ka.clientWidth||1,this.ya=this.Ka.clientHeight||1),Yo(this),this.Ya(),this.g("viewSize",e,t),this.redraw())}},fixedBounds:{get:function(){return this.ut},set:function(t){var e=this.ut;e.D(t)||(t.width!==-1/0&&t.height!==1/0&&t.height!==-1/0||lt("fixedBounds width/height must not be Infinity"),this.ut=t=t.J(),this.Ya(),this.g("fixedBounds",e,t))}},scrollMargin:{get:function(){return this.rj},set:function(t){typeof t=="number"&&(t=new ai(t));var e=this.rj;e.D(t)||(this.rj=t=t.J(),this.g("scrollMargin",e,t),this.hk())}},scrollMode:{get:function(){return this.sj},set:function(t){var e=this.sj;e!==t&&(this.sj=t,t===ah&&Ga(this,!1),this.g("scrollMode",e,t),this.Ee=!0,this.N())}},scrollsPageOnFocus:{get:function(){return this.nu},set:function(t){var e=this.nu;e!==t&&(this.nu=t,this.g("scrollsPageOnFocus",e,t))}},positionComputation:{get:function(){return this.Zt},set:function(t){var e=this.Zt;e!==t&&(this.Zt=t,Ga(this,!1),this.g("positionComputation",e,t))}},scaleComputation:{get:function(){return this.fu},set:function(t){var e=this.fu;e!==t&&(this.fu=t,Q0(this,this.scale,this.scale),this.g("scaleComputation",e,t))}},documentBounds:{get:function(){return this.Sp}},isVirtualized:{get:function(){return this.It},set:function(t){var e=this.It;e!==t&&(this.It=t,this.g("isVirtualized",e,t))}},scale:{get:function(){return this.Ca},set:function(t){var e=this.Ca;e!==t&&Q0(this,e,t)}},defaultScale:{get:function(){return this.Pp},set:function(t){this.Pp=t}},autoScale:{get:function(){return this.yh},set:function(t){var e=this.yh;e!==t&&(this.yh=t,this.g("autoScale",e,t),t!==Jo&&Ga(this,!1))}},initialAutoScale:{get:function(){return this.Fg},set:function(t){var e=this.Fg;e!==t&&(this.Fg=t,this.g("initialAutoScale",e,t))}},initialViewportSpot:{get:function(){return this.Bt},set:function(t){var e=this.Bt;e!==t&&(t.sb()||lt("initialViewportSpot must be a specific Spot: "+t),this.Bt=t,this.g("initialViewportSpot",e,t))}},initialDocumentSpot:{get:function(){return this.yt},set:function(t){var e=this.yt;e!==t&&(t.sb()||lt("initialViewportSpot must be a specific Spot: "+t),this.yt=t,this.g("initialDocumentSpot",e,t))}},minScale:{get:function(){return this.Ot},set:function(t){var e=this.Ot;e!==t&&(0<t?(this.Ot=t,this.g("minScale",e,t),t>this.scale&&(this.scale=t)):me(t,"> 0",wt,"minScale"))}},maxScale:{get:function(){return this.Mt},set:function(t){var e=this.Mt;e!==t&&(0<t?(this.Mt=t,this.g("maxScale",e,t),t<this.scale&&(this.scale=t)):me(t,"> 0",wt,"maxScale"))}},zoomPoint:{get:function(){return this.zu},set:function(t){this.zu.D(t)||(this.zu=t=t.J())}},contentAlignment:{get:function(){return this.zk},set:function(t){var e=this.zk;e.D(t)||(this.zk=t=t.J(),this.g("contentAlignment",e,t),Ga(this,!1))}},initialContentAlignment:{get:function(){return this.pq},set:function(t){var e=this.pq;e.D(t)||(this.pq=t=t.J(),this.g("initialContentAlignment",e,t))}},padding:{get:function(){return this.yb},set:function(t){typeof t=="number"&&(t=new ai(t));var e=this.yb;e.D(t)||(this.yb=t=t.J(),this.Ya(),this.g("padding",e,t))}},partManager:{get:function(){return this.Pc},set:function(t){var e=this.Pc;e!==t&&(t.diagram!==null&&lt("Cannot share PartManagers between Diagrams: "+t.toString()),e&&e.Xe(null),this.Pc=t,t.Xe(this))}},nodes:{get:function(){return this.partManager.nodes.iterator}},links:{get:function(){return this.partManager.links.iterator}},parts:{get:function(){return this.partManager.parts.iterator}},layout:{get:function(){return this.Sc},set:function(t){var e=this.Sc;e!==t&&(this.Sc=t,t.diagram=this,t.group=null,this.xh=!0,this.g("layout",e,t),this.$b())}},isTreePathToChildren:{get:function(){return this.Ht},set:function(t){var e=this.Ht;if(e!==t&&(this.Ht=t,this.g("isTreePathToChildren",e,t),!this.undoManager.isUndoingRedoing))for(t=this.nodes;t.next();)Im(t.value)}},treeCollapsePolicy:{get:function(){return this.uu},set:function(t){var e=this.uu;e!==t&&(t!==yc&&t!==go&&t!==Gp&&lt("Unknown Diagram.treeCollapsePolicy: "+t),this.uu=t,this.g("treeCollapsePolicy",e,t))}},Ue:{get:function(){return this.pw},set:function(t){this.pw=t}},avoidanceCellSize:{get:function(){return this.aw},set:function(t){this.Xh=null,this.aw=new ii(Math.max(1,t.width),Math.max(1,t.height))}},avoidanceLimit:{get:function(){return this.bw},set:function(t){this.bw=Math.max(1,t)}},autoScrollInterval:{get:function(){return this.vp},set:function(t){var e=this.vp;e!==t&&(this.vp=t,this.g("autoScrollInterval",e,t))}},autoScrollRegion:{get:function(){return this.xp},set:function(t){typeof t=="number"&&(t=new ai(t));var e=this.xp;e.D(t)||(this.xp=t=t.J(),this.Ya(),this.g("autoScrollRegion",e,t))}}}),ct.Object.defineProperties(wt,{licenseKey:{get:function(){return hm.jc()},set:function(t){hm.add(t.replace(/\s/g,""))}},version:{get:function(){return zd}}}),wt.prototype.makeImageData=wt.prototype.Jx,wt.prototype.makeImage=wt.prototype.Wz,wt.prototype.cacheGroupExternalLinks=wt.prototype.Fu,wt.prototype.addRenderer=wt.prototype.bs,wt.prototype.makeSVG=wt.prototype.av,wt.prototype.makeSvg=wt.prototype.Cs,wt.prototype.stopAutoScroll=wt.prototype.ug,wt.prototype.doAutoScroll=wt.prototype.gs,wt.prototype.isUnoccupied=wt.prototype.Yj,wt.prototype.raiseDiagramEvent=wt.prototype.R,wt.prototype.removeDiagramListener=wt.prototype.am,wt.prototype.addDiagramListener=wt.prototype.Bj,wt.prototype.findTreeRoots=wt.prototype.yz,wt.prototype.layoutDiagram=wt.prototype.Uz,wt.prototype.findTopLevelGroups=wt.prototype.qz,wt.prototype.findTopLevelNodesAndLinks=wt.prototype.rz,wt.prototype.ensureBounds=wt.prototype.Va,wt.prototype.findLinksByExample=wt.prototype.ls,wt.prototype.findNodesByExample=wt.prototype.ms,wt.prototype.findLinkForData=wt.prototype.Kc,wt.prototype.findNodeForData=wt.prototype.ii,wt.prototype.findPartForData=wt.prototype.Lc,wt.prototype.findLinkForKey=wt.prototype.findLinkForKey,wt.prototype.findNodeForKey=wt.prototype.Vb,wt.prototype.findPartForKey=wt.prototype.findPartForKey,wt.prototype.rebuildParts=wt.prototype.Wd,wt.prototype.transformViewToDoc=wt.prototype.Ps,wt.prototype.transformRectDocToView=wt.prototype.zA,wt.prototype.transformDocToView=wt.prototype.op,wt.prototype.centerRect=wt.prototype.es,wt.prototype.scrollToRect=wt.prototype.tv,wt.prototype.scroll=wt.prototype.scroll,wt.prototype.highlightCollection=wt.prototype.Jz,wt.prototype.highlight=wt.prototype.Iz,wt.prototype.selectCollection=wt.prototype.rA,wt.prototype.select=wt.prototype.select,wt.prototype.updateAllRelationshipsFromData=wt.prototype.rp,wt.prototype.updateAllTargetBindings=wt.prototype.updateAllTargetBindings,wt.prototype.commit=wt.prototype.commit,wt.prototype.rollbackTransaction=wt.prototype.Kf,wt.prototype.commitTransaction=wt.prototype.eb,wt.prototype.startTransaction=wt.prototype.Ea,wt.prototype.raiseChanged=wt.prototype.g,wt.prototype.raiseChangedEvent=wt.prototype.cb,wt.prototype.removeChangedListener=wt.prototype.ik,wt.prototype.addChangedListener=wt.prototype.Pe,wt.prototype.removeModelChangedListener=wt.prototype.mA,wt.prototype.addModelChangedListener=wt.prototype.Yw,wt.prototype.findLayer=wt.prototype.Qj,wt.prototype.removeLayer=wt.prototype.kA,wt.prototype.addLayerAfter=wt.prototype.Cy,wt.prototype.addLayerBefore=wt.prototype.Ww,wt.prototype.addLayer=wt.prototype.Al,wt.prototype.moveParts=wt.prototype.moveParts,wt.prototype.copyParts=wt.prototype.Kj,wt.prototype.removeParts=wt.prototype.Is,wt.prototype.remove=wt.prototype.remove,wt.prototype.add=wt.prototype.add,wt.prototype.clearDelayedGeometries=wt.prototype.bx,wt.prototype.setProperties=wt.prototype.nm,wt.prototype.attach=wt.prototype.Du,wt.prototype.set=wt.prototype.set,wt.prototype.resetInputOptions=wt.prototype.Sx,wt.prototype.setInputOption=wt.prototype.sA,wt.prototype.getInputOption=wt.prototype.Ql,wt.prototype.resetRenderingHints=wt.prototype.Tx,wt.prototype.setRenderingHint=wt.prototype.Xx,wt.prototype.getRenderingHint=wt.prototype.Gf,wt.prototype.maybeUpdate=wt.prototype.bd,wt.prototype.requestUpdate=wt.prototype.$b,wt.prototype.delayInitialization=wt.prototype.Xy,wt.prototype.isUpdateRequested=wt.prototype.Pz,wt.prototype.invalidateDocumentBounds=wt.prototype.Ya,wt.prototype.findObjectsNear=wt.prototype.og,wt.prototype.findPartsNear=wt.prototype.mz,wt.prototype.findObjectsIn=wt.prototype.Cf,wt.prototype.findPartsIn=wt.prototype.ux,wt.prototype.findObjectsAt=wt.prototype.ji,wt.prototype.findPartsAt=wt.prototype.lz,wt.prototype.findObjectAt=wt.prototype.ic,wt.prototype.findPartAt=wt.prototype.Ol,wt.prototype.focusObject=wt.prototype.zz,wt.prototype.alignDocument=wt.prototype.Jy,wt.prototype.zoomToRect=wt.prototype.BA,wt.prototype.zoomToFit=wt.prototype.zoomToFit,wt.prototype.diagramScroll=wt.prototype.kx,wt.prototype.focus=wt.prototype.focus;var Vp=new pe,lm=null,Bn=Z.document!==void 0,Fd=null,Qc="",Jo=new mt(wt,"None",0),Ya=new mt(wt,"Uniform",1),ku=new mt(wt,"UniformToFill",2),Zf=new mt(wt,"CycleAll",10),Wp=new mt(wt,"CycleNotDirected",11),Up=new mt(wt,"CycleNotDirectedFast",12),td=new mt(wt,"CycleNotUndirected",13),um=new mt(wt,"CycleDestinationTree",14),Zp=new mt(wt,"CycleSourceTree",15),ah=new mt(wt,"DocumentScroll",1),Rd=new mt(wt,"InfiniteScroll",2),yc=new mt(wt,"TreeParentCollapsed",21),go=new mt(wt,"AllParentsCollapsed",22),Gp=new mt(wt,"AnyParentsCollapsed",23),hm=new Kt,zd="2.3.10",jd="image",Gf=null,bg=!1;function Ro(){if(Bn){var t=Z.document.createElement("canvas"),e=t.getContext("2d"),i=Dt("7ca11abfd022028846");e[i]=Dt("398c3597c01238");for(var n=["5da73c80a36455d7038e4972187c3cae51fd22",xt.Dx+"4ae6247590da4bb21c324ba3a84e385776",nn.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",ht.za],s=1;5>s;s++)e[Dt("7ca11abfd7330390")](Dt(n[s-1]),10,15*s);for(e[i]=Dt("39f046ebb36e4b"),i=1;5>i;i++)e[Dt("7ca11abfd7330390")](Dt(n[i-1]),10,15*i);(n.length!==4||n[0][0]!=="5"||n[3][0]!=="7")&&(nn.prototype.Cd=nn.prototype.Eu),Gf=t}}wt.className="Diagram",wt.fromDiv=function(t){var e=t;return typeof t=="string"&&(e=Z.document.getElementById(t)),e instanceof HTMLDivElement&&e.H instanceof wt?e.H:null},wt.inherit=function(t,e){function i(){}if(Object.getPrototypeOf(t).prototype)throw Error(`Used go.Diagram.inherit defining already defined class
`+t);i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t},wt.useDOM=function(t){Bn=t?Z.document!==void 0:!1},wt.isUsingDOM=function(){return Bn},wt.None=Jo,wt.Uniform=Ya,wt.UniformToFill=ku,wt.CycleAll=Zf,wt.CycleNotDirected=Wp,wt.CycleNotDirectedFast=Up,wt.CycleNotUndirected=td,wt.CycleDestinationTree=um,wt.CycleSourceTree=Zp,wt.DocumentScroll=ah,wt.InfiniteScroll=Rd,wt.TreeParentCollapsed=yc,wt.AllParentsCollapsed=go,wt.AnyParentsCollapsed=Gp;function xc(){this.wy=null,this.j="zz@orderNum",this._tk==="63ad05bbe23a1786468a4c741b6d2"?this.Rc=this.j=!0:this.Rc=null}function Lu(t,e){if(e.ib.setTransform(e.Mb,0,0,e.Mb,0,0),e.ib.yc(),t.Rc===null)t:{e="f";var i=Z[Dt("76a715b2f73f148a")][Dt("72ba13b5")]||"";if(t.Rc=!0,Bn){var n=wt[Dt("76a115b6ed251eaf4692")];if(n)for(var s=hm.iterator;s.next()&&(n=s.value,n=Dt(n).split(Dt("39e9")),!(6>n.length));){var a=Dt(n[1]).split(".");if(n[4]!=="7da71ca0")break;var l=Dt(xt[Dt("6cae19")]).split(".");if(a[0]>l[0]||a[0]===l[0]&&a[1]>=l[1]){var c=Z[Dt("74a900bae4370f8b51")][Dt("6fbb13a1c2311e8a57")].toLowerCase();if(l=c[Dt("73a612b6fb191d")](Dt("3aad1ab6e022098b4dc4")),a=Dt(n[2]),-1<l&&(c=c[Dt("73a612b6fb191d")](a.toLowerCase()+"/"),t.Rc=!(-1<c&&c<l),!t.Rc))break;for(l=i[Dt("76ad18b4f73e")],c=i[Dt("73a612b6fb191d")](Dt("35e7"))+2;c<l;c++)e+=i[c];if(l=e[Dt("73a612b6fb191d")](a),0>l&&a!==Dt("7da71ca0ad381e90")&&(l=e[Dt("73a612b6fb191d")](Dt("76a715b2ef3e149757"))),0>l&&(l=e[Dt("73a612b6fb191d")](Dt("76a715b2ef3e149757"))),0>l&&(l=e[Dt("73a612b6fb191d")](Dt("2bfa41fdb3784bca12"))),0>l&&(l=i[Dt("73a612b6fb191d")](Dt("7baa19a6f76c1988428554"))),t.Rc=!(0<=l&&l<e[Dt("73a612b6fb191d")](Dt("35"))||e[Dt("73a612b6fb191d")](Dt("35"))===-1),!t.Rc||i[Dt("73a612b6fb191d")](Dt("7fb002b6ed25128b4da25b2e"))&&(t.Rc=!(-1<i[Dt("73a612b6fb191d")](a)),!t.Rc)||(l=Z[Dt("76a715b2f73f148a")][Dt("69ad17a1e03e")],c=l[Dt("73a612b6fb191d")](Dt("7fb002b6ed25128b4da25b2e")),-1<c&&(t.Rc=!(l[Dt("73a612b6fb191d")](a)>c),!t.Rc)))break;if(a[0]==="#"){l=Z.document.createElement("div");for(var f=n[0].replace(/[A-Za-z]/g,"");4>f.length;)f+="9";if(c=f,f=f.substr(f.length-4),n="",n+=["gsh","gsf"][parseInt(f.substr(0,1),10)%2],n+=["Header","Background","Display","Feedback"][parseInt(f.substr(0,1),10)%4],l[Dt("79a417a0f0181a8946")]=n,Z.document[Dt("78a712aa")]){Z.document[Dt("78a712aa")][Dt("7bb806b6ed32388c4a875b")](l),f=Z.getComputedStyle(l).getPropertyValue(Dt("78a704b7e62456904c9b12701b6532a8"));var m=Z.getComputedStyle(l).getPropertyValue(Dt("75b817b0ea2202"));if(Z.document[Dt("78a712aa")][Dt("68ad1bbcf533388c4a875b")](l),f){if(l=Z[Dt("77a902b0eb1b1e804a8a")],m==="0."+parseInt(c,10)%100||f.indexOf(parseInt(a[1]+a[2],16))!==-1&&f.indexOf(parseInt(a[3]+a[4],16))!==-1){t.Rc=!1;break}else if(l&&l(Dt("32ae19a1e0331fc94084537c067a67fa59f1386b89d006")).matches)for(n="."+n,a=0;a<document.styleSheets.length;a++){l=document.styleSheets[a].rules||document.styleSheets[a].cssRules;for(var v in l)if(n===l[v].selectorText){t.Rc=!1;break t}}}}else t.Rc=null,t.Rc=!1}}}else{for(v=i[Dt("76ad18b4f73e")],s=i[Dt("73a612b6fb191d")](Dt("35e7"))+2;s<v;s++)e+=i[s];i=e[Dt("73a612b6fb191d")](Dt("7da71ca0ad381e90")),t.Rc=!(0<=i&&i<e[Dt("73a612b6fb191d")](Dt("35")))}}}return 0<t.Rc&&t!==t.wy}xc.className="DiagramHelper";function Ra(t){this.j=t===void 0?new z:t,this.o=new z}ct.Object.defineProperties(Ra.prototype,{point:{get:function(){return this.j},set:function(t){this.j=t}},shifted:{get:function(){return this.o},set:function(t){this.o=t}}});var Hl="DraggingInfo";Ra.className="DraggingInfo";function h(t,e,i){this.node=t,this.info=e,this.Su=i}h.className="DraggingNodeInfoPair";function p(){this.reset()}p.prototype.reset=function(){this.isGridSnapEnabled=!1,this.isGridSnapRealtime=!0,this.gridSnapCellSize=new ii(NaN,NaN).freeze(),this.gridSnapCellSpot=An,this.gridSnapOrigin=new z(NaN,NaN).freeze(),this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1,this.dragsMembers=this.groupsAlwaysMove=!0},p.className="DraggingOptions";function x(t,e){if(typeof t=="string"||Z.Element&&t instanceof Element)var i=wt.call(this,t)||this;else i=wt.call(this)||this,e=t;return y(i),e&&i.nm(e),i}gi(x,wt);function y(t){t.allowDragOut=!0,t.allowMove=!1,t.isReadOnly=!0,t.contentAlignment=Rr,t.layout=new es}x.prototype.reset=function(){wt.prototype.reset.call(this),y(this)},x.className="Palette";function S(t,e){if(typeof t=="string"||Z.Element&&t instanceof Element)var i=wt.call(this,t)||this;else i=wt.call(this)||this,e=t;var n=i;i.animationManager.isEnabled=!1,i.vb=!0,i.V=null,i.mn=!1,i.nn=!1,i.F=!0,i.u=!0,i.ia=0,i.o=!1,i.ql=null,i.Xx("drawShadows",!1),t=new ui;var s=new Xi;return s.stroke="magenta",s.strokeWidth=2,s.fill="transparent",s.name="BOXSHAPE",t.selectable=!0,t.selectionAdorned=!1,t.selectionObjectName="BOXSHAPE",t.locationObjectName="BOXSHAPE",t.resizeObjectName="BOXSHAPE",t.cursor="move",t.add(s),i.j=t,i.allowCopy=!1,i.allowDelete=!1,i.allowSelect=!0,i.autoScrollRegion=new ai(0,0,0,0),i.pa.h(0,0),i.toolManager.gb("Dragging",new V,i.toolManager.mouseMoveTools),i.click=function(){var a=n.observed;if(a!==null){var l=a.viewportBounds,c=n.lastInput.documentPoint;a.position=new z(c.x-l.width/2,c.y-l.height/2)}},i.Pf=function(){n.Ya(),O(n)},i.Xd=function(){n.observed!==null&&(n.Ya(),n.N())},i.Ha=function(){1>n.updateDelay?n.N():n.o||(n.o=!0,setTimeout(function(){return n.redraw()},n.updateDelay))},i.Of=function(){n.observed!==null&&O(n)},i.autoScale=Ya,i.vb=!1,e&&Object.assign(i,e),i}gi(S,wt),S.prototype.computePixelRatio=function(){return 1},S.prototype.redraw=function(){if(this.o&&1<=this.updateDelay){this.o=!1;var t=this.ta,e=this.ib;if(t!==null&&e!==null){if(gc(this),this.ql===null){var i=new Tl(null);i.width=t.width,i.height=t.height,this.ql=i}try{this.ta=this.ql,this.ib=this.ta.context,this.ib.Vc(!0),this.ib.setTransform(1,0,0,1,0,0),this.ib.clearRect(0,0,this.ta.width,this.ta.height),_(this)}finally{this.ta=t,this.ib=e}}}wt.prototype.redraw.call(this)},S.prototype.gc=function(){if(this.Ka===null&&lt("No div specified"),this.ta===null&&lt("No canvas specified"),!(this.ta instanceof su)&&(_m(this.box),this.Fc)){var t=this.observed;if(t!==null&&!t.animationManager.defaultAnimation.isAnimating&&t.pi){gc(this);var e=this.ta;t=this.ib,t.Vc(!0),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),1>this.updateDelay?_(this):this.ql!==null&&(t.drawImage(this.ql.Oa,0,0),e=this.Ab,e.reset(),this.scale!==1&&e.scale(this.scale),this.position.x===0&&this.position.y===0||e.translate(-this.position.x,-this.position.y),t.scale(this.Mb,this.Mb),t.transform(e.m11,e.m12,e.m21,e.m22,e.dx,e.dy),t.yc()),e=this.Wa.s;for(var i=e.length,n=0;n<i;n++)e[n].gc(t,this);this.Fc=this.vd=!1}}};function _(t){var e=t.observed;if(e!==null){var i=t.drawsTemporaryLayers,n=t.drawsGrid&&i,s=e.grid;n&&s!==null&&s.visible&&!isNaN(s.width)&&!isNaN(s.height)&&(s=It.alloc().assign(t.viewportBounds).ed(e.viewportBounds),Cu(e,s),It.free(s),bo(e));var a=t.Ab;a.reset(),t.scale!==1&&a.scale(t.scale),t.position.x===0&&t.position.y===0||a.translate(-t.position.x,-t.position.y),s=t.ib,s.scale(t.Mb,t.Mb),s.transform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),s.yc(),e=e.Wa.s,a=e.length;for(var l=0;l<a;l++){var c=e[l],f=t;if(c.visible&&c.opacity!==0){var m=c.diagram.grid.part;if(!i&&c.isTemporary)n&&m.layer===c&&(c=th(c,s),m.gc(s,f),s.globalAlpha=c);else{for(var v=th(c,s),w=f.scale,C=It.alloc(),k=c.Pa.s,L=k.length,A=0;A<L;A++){var H=k[A];(n||H!==m)&&c.Oj(s,H,f,null,w,C,!1)}It.free(C),s.globalAlpha=v}}}}}function O(t){var e=t.box;if(e!==null){var i=t.observed;if(i!==null){t.Fc=!0,i=i.viewportBounds;var n=e.selectionObject,s=ii.alloc();s.h(i.width,i.height),n.desiredSize=s,ii.free(s),t=2/t.scale,n instanceof Xi&&(n.strokeWidth=t),e.location=new z(i.x-t/2,i.y-t/2),e.isSelected=!0}}}S.prototype.computeBounds=function(){var t=this.observed;if(t===null)return yn;var e=t.documentBounds.copy();return e.ed(t.viewportBounds),e},S.prototype.invalidateViewport=function(){this.Fc!==!0&&(this.Fc=!0,this.$b())},S.prototype.onViewportBoundsChanged=function(t,e,i,n){this.vb||(this.vd=!0,this.N(),this.Ee=!0,this.Ya(),O(this),this.fc.scale=i,this.fc.position.x=t.x,this.fc.position.y=t.y,this.fc.bounds.assign(t),this.fc.Oz=n,this.R("ViewportBoundsChanged",this.fc,t))},ct.Object.defineProperties(S.prototype,{observed:{get:function(){return this.V},set:function(t){var e=this.V;if(t instanceof S&&lt("Overview.observed Diagram may not be an Overview itself: "+t),e!==t){if(e!==null&&(this.remove(this.box),e.am("ViewportBoundsChanged",this.Pf),e.am("DocumentBoundsChanged",this.Xd),e.am("InvalidateDraw",this.Ha),e.am("AnimationFinished",this.Of)),this.V=t,t!==null&&(t.Bj("ViewportBoundsChanged",this.Pf),t.Bj("DocumentBoundsChanged",this.Xd),t.Bj("InvalidateDraw",this.Ha),t.Bj("AnimationFinished",this.Of),this.add(this.box)),this.Ya(),t===null){this.ql=null;var i=this.ta,n=this.ib;i&&n&&(n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,i.width,i.height))}else this.Ha(null),O(this),this.N();this.g("observed",e,t)}}},box:{get:function(){return this.j},set:function(t){var e=this.j;e!==t&&(this.j=t,this.remove(e),this.add(this.j),O(this),this.g("box",e,t))}},drawsTemporaryLayers:{get:function(){return this.F},set:function(t){this.F!==t&&(this.F=t,this.redraw())}},drawsGrid:{get:function(){return this.u},set:function(t){this.u!==t&&(this.u=t,this.redraw())}},updateDelay:{get:function(){return this.ia},set:function(t){0>t&&(t=0),this.ia!==t&&(this.ia=t)}}}),S.className="Overview";function V(){Pr.call(this),this.j=null}gi(V,Pr),V.prototype.canStart=function(){if(!this.isEnabled)return!1;var t=this.diagram;if(t===null||!t.allowMove||!t.allowSelect)return!1;var e=t.observed;if(e===null)return!1;var i=t.lastInput;return!i.left||t.currentTool!==this&&(!this.isBeyondDragSize()||i.isTouchEvent&&i.timestamp-t.firstInput.timestamp<this.delay)?!1:(this.findDraggablePart()===null&&(i=e.viewportBounds,this.j=new z(i.width/2,i.height/2),t=t.firstInput.documentPoint,e.position=new z(t.x-this.j.x,t.y-this.j.y)),!0)},V.prototype.doActivate=function(){this.j=null,Pr.prototype.doActivate.call(this)},V.prototype.doUpdateCursor=function(){var t=this.diagram,e=t.box;e!==null&&e.cursor&&(t.currentCursor=e.cursor)},V.prototype.moveParts=function(){var t=this.diagram,e=t.observed;if(e!==null){var i=t.box;if(i!==null){if(this.j===null){var n=t.firstInput.documentPoint;i=i.location,this.j=new z(n.x-i.x,n.y-i.y)}t=t.lastInput.documentPoint,e.position=new z(t.x-this.j.x,t.y-this.j.y)}}},V.className="OverviewDraggingTool";function K(){vi(this),this.H=fr,this.Ha=this.u=this.o=!0,this.F=this.V=this.nb=this.ia=!1,this.ij=this.j=null,this.Hb=1.05,this.Jt=NaN,this.sw=null,this.Au=NaN,this.yu=yn,this.hb=!0,this.cg=null,this.ob=200}K.prototype.toString=function(){return"CommandHandler"},K.prototype.Xe=function(t){this.H=t},K.prototype.doKeyDown=function(){var t=this.diagram,e=t.lastInput,i=re?e.meta:e.control,n=e.shift,s=e.alt,a=e.key;!i||a!=="C"&&a!=="Insert"?i&&a==="X"||n&&a==="Del"?this.canCutSelection()&&this.cutSelection():i&&a==="V"||n&&a==="Insert"?this.canPasteSelection()&&this.pasteSelection():i&&a==="Y"||s&&n&&a==="Backspace"?this.canRedo()&&this.redo():i&&a==="Z"||s&&a==="Backspace"?this.canUndo()&&this.undo():a==="Del"||a==="Backspace"?this.canDeleteSelection()&&this.deleteSelection():i&&a==="A"?this.canSelectAll()&&this.selectAll():a==="Esc"?this.canStopCommand()&&this.stopCommand():a==="Up"?t.allowVerticalScroll&&(i?t.scroll("pixel","up"):t.scroll("line","up")):a==="Down"?t.allowVerticalScroll&&(i?t.scroll("pixel","down"):t.scroll("line","down")):a==="Left"?t.allowHorizontalScroll&&(i?t.scroll("pixel","left"):t.scroll("line","left")):a==="Right"?t.allowHorizontalScroll&&(i?t.scroll("pixel","right"):t.scroll("line","right")):a==="PageUp"?n&&t.allowHorizontalScroll?t.scroll("page","left"):t.allowVerticalScroll&&t.scroll("page","up"):a==="PageDown"?n&&t.allowHorizontalScroll?t.scroll("page","right"):t.allowVerticalScroll&&t.scroll("page","down"):a==="Home"?i&&t.allowVerticalScroll?t.scroll("document","up"):!i&&t.allowHorizontalScroll&&t.scroll("document","left"):a==="End"?i&&t.allowVerticalScroll?t.scroll("document","down"):!i&&t.allowHorizontalScroll&&t.scroll("document","right"):a===" "?this.canScrollToPart()&&this.scrollToPart():a==="Subtract"?this.canDecreaseZoom()&&this.decreaseZoom():a==="Add"?this.canIncreaseZoom()&&this.increaseZoom():i&&a==="0"?this.canResetZoom()&&this.resetZoom():n&&a==="Z"?this.canZoomToFit()&&this.zoomToFit():i&&!n&&a==="G"?this.canGroupSelection()&&this.groupSelection():i&&n&&a==="G"?this.canUngroupSelection()&&this.ungroupSelection():a==="F2"||e.event&&e.event.key==="F2"?this.canEditTextBlock()&&this.editTextBlock():a==="ContextMenu"||e.event&&e.event.key==="ContextMenu"?this.canShowContextMenu()&&this.showContextMenu():e.bubbles=!0:this.canCopySelection()&&this.copySelection()},K.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0},K.prototype.stopCommand=function(){var t=this.diagram,e=t.currentTool;e instanceof Vn&&t.allowSelect&&t.clearSelection(),e!==null&&e.doCancel()},K.prototype.canStopCommand=function(){return!0},K.prototype.selectAll=function(){var t=this.diagram;t.N();try{t.currentCursor="wait",t.R("ChangingSelection",t.selection);for(var e=t.parts;e.next();)e.value.isSelected=!0;for(var i=t.nodes;i.next();)i.value.isSelected=!0;for(var n=t.links;n.next();)n.value.isSelected=!0}finally{t.R("ChangedSelection",t.selection),t.currentCursor=""}},K.prototype.canSelectAll=function(){return this.diagram.allowSelect},K.prototype.deleteSelection=function(){var t=this.diagram;try{t.currentCursor="wait",t.R("ChangingSelection",t.selection),t.Ea("Delete"),t.R("SelectionDeleting",t.selection);for(var e=new At,i=t.selection.iterator;i.next();)Cc(e,i.value,!0,this.deletesTree?1/0:0,this.deletesConnectedLinks?null:!1,function(n){return n.canDelete()});t.Is(e,!0),t.R("SelectionDeleted",e)}finally{t.eb("Delete"),t.R("ChangedSelection",t.selection),t.currentCursor=""}},K.prototype.canDeleteSelection=function(){var t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowDelete||t.selection.count===0)},K.prototype.copySelection=function(){var t=this.diagram,e=new At;for(t=t.selection.iterator;t.next();)Cc(e,t.value,!0,this.copiesTree?1/0:0,this.copiesConnectedLinks,function(i){return i.canCopy()});this.copyToClipboard(e)},K.prototype.canCopySelection=function(){var t=this.diagram;return!!(t.allowCopy&&t.allowClipboard&&t.selection.count!==0)},K.prototype.cutSelection=function(){this.copySelection(),this.deleteSelection()},K.prototype.canCutSelection=function(){var t=this.diagram;return!!(!t.isReadOnly&&!t.isModelReadOnly&&t.allowCopy&&t.allowDelete&&t.allowClipboard&&t.selection.count!==0)},K.prototype.copyToClipboard=function(t){var e=this.diagram,i=null;if(t===null)Fd=null,Qc="";else{i=e.model;var n=!1,s=!1,a=null;try{i.Tl()&&(n=i.Jj,i.Jj=this.copiesParentKey),i.Wj()&&(s=i.Ij,i.Ij=this.copiesGroupKey),a=e.Kj(t,null,!0)}finally{i.Tl()&&(i.Jj=n),i.Wj()&&(i.Ij=s),i=new Kt,i.addAll(a),Fd=i,Qc=e.model.dataFormat}}e.R("ClipboardChanged",i)},K.prototype.pasteFromClipboard=function(){var t=new At,e=Fd;if(e===null)return t;var i=this.diagram;if(Qc!==i.model.dataFormat)return t;var n=i.model,s=!1,a=!1,l=null;try{n.Tl()&&(s=n.Jj,n.Jj=this.copiesParentKey),n.Wj()&&(a=n.Ij,n.Ij=this.copiesGroupKey),l=i.Kj(e,i,!1)}finally{for(n.Tl()&&(n.Jj=s),n.Wj()&&(n.Ij=a),e=l.iterator;e.next();)i=e.value,n=e.key,i.location.w()||(n.location.w()?i.location=n.location:!i.position.w()&&n.position.w()&&(i.position=n.position)),t.add(i)}return t},K.prototype.pasteSelection=function(t){t===void 0&&(t=null);var e=this.diagram;try{e.currentCursor="wait",e.R("ChangingSelection",e.selection),e.Ea("Paste");var i=this.pasteFromClipboard();0<i.count&&e.clearSelection(!0);for(var n=i.iterator;n.next();)n.value.isSelected=!0;if(t!==null){var s=e.computePartsBounds(e.selection);if(s.w()){var a=this.computeEffectiveCollection(e.selection,e.Wm);vc(e,a,new z(t.x-s.centerX,t.y-s.centerY),e.Wm,!1)}}e.R("ClipboardPasted",i)}finally{e.eb("Paste"),e.R("ChangedSelection",e.selection),e.currentCursor=""}},K.prototype.canPasteSelection=function(){var t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowClipboard||Fd===null||Fd.count===0||Qc!==t.model.dataFormat)},K.prototype.undo=function(){this.diagram.undoManager.undo()},K.prototype.canUndo=function(){var t=this.diagram;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canUndo()},K.prototype.redo=function(){this.diagram.undoManager.redo()},K.prototype.canRedo=function(){var t=this.diagram;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canRedo()},K.prototype.decreaseZoom=function(t){t===void 0&&(t=1/this.zoomFactor);var e=this.diagram;e.autoScale===Jo&&(t=e.scale*t,t<e.minScale||t>e.maxScale||(e.scale=t))},K.prototype.canDecreaseZoom=function(t){t===void 0&&(t=1/this.zoomFactor);var e=this.diagram;return e.autoScale!==Jo?!1:(t=e.scale*t,t<e.minScale||t>e.maxScale?!1:e.allowZoom)},K.prototype.increaseZoom=function(t){t===void 0&&(t=this.zoomFactor);var e=this.diagram;e.autoScale===Jo&&(t=e.scale*t,t<e.minScale||t>e.maxScale||(e.scale=t))},K.prototype.canIncreaseZoom=function(t){t===void 0&&(t=this.zoomFactor);var e=this.diagram;return e.autoScale!==Jo?!1:(t=e.scale*t,t<e.minScale||t>e.maxScale?!1:e.allowZoom)},K.prototype.resetZoom=function(t){t===void 0&&(t=this.defaultScale);var e=this.diagram;t<e.minScale||t>e.maxScale||(e.scale=t)},K.prototype.canResetZoom=function(t){t===void 0&&(t=this.defaultScale);var e=this.diagram;return t<e.minScale||t>e.maxScale?!1:e.allowZoom},K.prototype.zoomToFit=function(){var t=this.diagram,e=t.animationManager;e.Cc(),t.redraw();var i=t.position,n=t.scale;Mu(e,"Zoom To Fit"),this.isZoomToFitRestoreEnabled&&n===this.Au&&!isNaN(this.Jt)&&t.documentBounds.D(this.yu)?(t.scale=this.Jt,t.position=this.sw,this.Au=NaN,this.yu=yn):(this.Jt=n,this.sw=i.copy(),t.zoomToFit(),this.Au=t.scale,this.yu=t.documentBounds.copy()),Of(e)},K.prototype.canZoomToFit=function(){return this.diagram.allowZoom},K.prototype.scrollToPart=function(t){t===void 0&&(t=null);var e=this.diagram;if(e.Va(),t===null){try{this.cg!==null&&(this.cg.next()?t=this.cg.value:this.cg=null)}catch(f){this.cg=null}t===null&&(0<e.highlighteds.count?this.cg=e.highlighteds.iterator:0<e.selection.count&&(this.cg=e.selection.iterator),this.cg!==null&&this.cg.next()&&(t=this.cg.value))}if(t!==null){var i=e.animationManager;Mu(i,"Scroll To Part");var n=this.scrollToPartPause;if(0<n){var s=et(this,t,[t]);if(s.length===1)e.Ea(),e.es(t.actualBounds),e.eb("Scroll To Part");else{var a=function(){e.Ea();for(var f=s.pop();0<s.length&&f instanceof Le&&f.isTreeExpanded&&(!(f instanceof ji)||f.isSubGraphExpanded);)f=s.pop();0<s.length?(f instanceof ui&&e.tv(f.actualBounds),f instanceof Le&&!f.isTreeExpanded&&(f.isTreeExpanded=!0),f instanceof ji&&!f.isSubGraphExpanded&&(f.isSubGraphExpanded=!0)):(f instanceof ui&&e.es(f.actualBounds),e.am("LayoutCompleted",l)),e.eb("Scroll To Part")},l=function(){ge(a,(i.isEnabled?i.duration:0)+n)};e.Bj("LayoutCompleted",l),a()}}else{var c=e.position.copy();e.es(t.actualBounds),c.Xa(e.position)&&i.Cc()}}};function et(t,e,i){if(e.isVisible())return i;if(e instanceof Cn)et(t,e.adornedPart,i);else if(e instanceof ue){var n=e.fromNode;n!==null&&et(t,n,i),e=e.toNode,e!==null&&et(t,e,i)}else e instanceof Le&&(n=e.labeledLink,n!==null&&et(t,n,i),n=e.pg(),n!==null&&(n.isTreeExpanded||n.wasTreeExpanded||i.push(n),et(t,n,i))),e=e.containingGroup,e!==null&&(e.isSubGraphExpanded||e.wasSubGraphExpanded||i.push(e),et(t,e,i));return i}K.prototype.canScrollToPart=function(t){return t===void 0&&(t=null),t!==null&&!(t instanceof ui)?!1:(t=this.diagram,t.selection.count===0&&t.highlighteds.count===0?!1:t.allowHorizontalScroll&&t.allowVerticalScroll)},K.prototype.collapseTree=function(t){t===void 0&&(t=null);var e=this.diagram;try{e.Ea("Collapse Tree"),Mu(e.animationManager,"Collapse Tree");var i=new Kt;if(t!==null&&t.isTreeExpanded)t.collapseTree(),i.add(t);else if(t===null)for(var n=e.selection.iterator;n.next();){var s=n.value;s instanceof Le&&s.isTreeExpanded&&(s.collapseTree(),i.add(s))}e.R("TreeCollapsed",i)}finally{e.eb("Collapse Tree")}},K.prototype.canCollapseTree=function(t){t===void 0&&(t=null);var e=this.diagram;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof Le&&t.isTreeExpanded))return!1;if(0<t.Qo().count)return!0}else for(t=e.selection.iterator;t.next();)if(e=t.value,e instanceof Le&&e.isTreeExpanded&&0<e.Qo().count)return!0;return!1},K.prototype.expandTree=function(t){t===void 0&&(t=null);var e=this.diagram;try{e.Ea("Expand Tree"),Mu(e.animationManager,"Expand Tree");var i=new Kt;if(t!==null&&!t.isTreeExpanded)t.expandTree(),i.add(t);else if(t===null)for(var n=e.selection.iterator;n.next();){var s=n.value;s instanceof Le&&!s.isTreeExpanded&&(s.expandTree(),i.add(s))}e.R("TreeExpanded",i)}finally{e.eb("Expand Tree")}},K.prototype.canExpandTree=function(t){t===void 0&&(t=null);var e=this.diagram;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof Le)||t.isTreeExpanded)return!1;if(0<t.Qo().count)return!0}else for(t=e.selection.iterator;t.next();)if(e=t.value,e instanceof Le&&!e.isTreeExpanded&&0<e.Qo().count)return!0;return!1},K.prototype.groupSelection=function(){var t=this.diagram,e=t.model;if(e.Xj()){var i=this.archetypeGroupData;if(i!==null){var n=null;try{t.currentCursor="wait",t.R("ChangingSelection",t.selection),t.Ea("Group");for(var s=new Kt,a=t.selection.iterator;a.next();){var l=a.value;l.Zc()&&l.canGroup()&&s.add(l)}for(var c=new Kt,f=s.iterator;f.next();){var m=f.value;a=!1;for(var v=s.iterator;v.next();)if(m.Td(v.value)){a=!0;break}a||c.add(m)}if(0<c.count){var w=c.first().containingGroup;if(w!==null)for(;w!==null;){s=!1;for(var C=c.iterator;C.next();)if(!C.value.Td(w)){s=!0;break}if(s)w=w.containingGroup;else break}if(i instanceof ji)_a(i),n=i.copy(),n!==null&&t.add(n);else if(e.Yu(i)){var k=e.copyNodeData(i);Tt(k)&&(e.xf(k),n=t.ii(k))}if(n!==null){w!==null&&this.isValidMember(w,n)&&(n.containingGroup=w);for(var L=c.iterator;L.next();){var A=L.value;this.isValidMember(n,A)&&(A.containingGroup=n)}t.clearSelection(!0),n.isSelected=!0}}t.R("SelectionGrouped",n)}finally{t.eb("Group"),t.R("ChangedSelection",t.selection),t.currentCursor=""}}}},K.prototype.canGroupSelection=function(){var t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowGroup||!t.model.Xj()||this.archetypeGroupData===null)return!1;for(t=t.selection.iterator;t.next();){var e=t.value;if(e.Zc()&&e.canGroup())return!0}return!1};function Lt(t){var e=Pe();for(t=t.iterator;t.next();){var i=t.value;i instanceof ue||e.push(i)}t=new At,i=e.length;for(var n=0;n<i;n++){for(var s=e[n],a=!0,l=0;l<i;l++)if(s.Td(e[l])){a=!1;break}a&&t.add(s)}return qe(e),t}K.prototype.isValidMember=function(t,e){if(e===null||t===e||e instanceof ue)return!1;if(t!==null){if(t===e||t.Td(e))return!1;var i=t.memberValidation;if(i!==null&&!i(t,e)||t.data===null&&e.data!==null||t.data!==null&&e.data===null)return!1}return i=this.memberValidation,i!==null?i(t,e):!0},K.prototype.ungroupSelection=function(t){t===void 0&&(t=null);var e=this.diagram,i=e.model;if(i.Xj())try{e.currentCursor="wait",e.R("ChangingSelection",e.selection),e.Ea("Ungroup");var n=new Kt;if(t!==null)n.add(t);else for(var s=e.selection.iterator;s.next();){var a=s.value;a instanceof ji&&a.canUngroup()&&n.add(a)}var l=new Kt;if(0<n.count){e.clearSelection(!0);for(var c=n.iterator;c.next();){var f=c.value;f.expandSubGraph();var m=f.containingGroup,v=m!==null&&m.data!==null?i.wa(m.data):void 0;l.addAll(f.memberParts);for(var w=l.iterator;w.next();){var C=w.value;if(C.isSelected=!0,!(C instanceof ue)){var k=C.data;k!==null?i.mp(k,v):C.containingGroup=m}}e.remove(f)}}e.R("SelectionUngrouped",n,l)}finally{e.eb("Ungroup"),e.R("ChangedSelection",e.selection),e.currentCursor=""}},K.prototype.canUngroupSelection=function(t){t===void 0&&(t=null);var e=this.diagram;if(e.isReadOnly||e.isModelReadOnly||!e.allowDelete||!e.allowUngroup||!e.model.Xj())return!1;if(t!==null){if(!(t instanceof ji))return!1;if(t.canUngroup())return!0}else for(t=e.selection.iterator;t.next();)if(e=t.value,e instanceof ji&&e.canUngroup())return!0;return!1},K.prototype.addTopLevelParts=function(t,e){var i=!0;for(t=Lt(t).iterator;t.next();){var n=t.value;n.containingGroup!==null&&(!e||this.isValidMember(null,n)?n.containingGroup=null:i=!1)}return i},K.prototype.collapseSubGraph=function(t){t===void 0&&(t=null);var e=this.diagram;try{e.Ea("Collapse SubGraph"),Mu(e.animationManager,"Collapse SubGraph");var i=new Kt;if(t!==null&&t.isSubGraphExpanded)t.collapseSubGraph(),i.add(t);else if(t===null)for(var n=e.selection.iterator;n.next();){var s=n.value;s instanceof ji&&s.isSubGraphExpanded&&(s.collapseSubGraph(),i.add(s))}e.R("SubGraphCollapsed",i)}finally{e.eb("Collapse SubGraph")}},K.prototype.canCollapseSubGraph=function(t){t===void 0&&(t=null);var e=this.diagram;if(e.isReadOnly)return!1;if(t!==null)return!!(t instanceof ji&&t.isSubGraphExpanded);for(t=e.selection.iterator;t.next();)if(e=t.value,e instanceof ji&&e.isSubGraphExpanded)return!0;return!1},K.prototype.expandSubGraph=function(t){t===void 0&&(t=null);var e=this.diagram;try{e.Ea("Expand SubGraph"),Mu(e.animationManager,"Expand SubGraph");var i=new Kt;if(t!==null&&!t.isSubGraphExpanded)t.expandSubGraph(),i.add(t);else if(t===null)for(var n=e.selection.iterator;n.next();){var s=n.value;s instanceof ji&&!s.isSubGraphExpanded&&(s.expandSubGraph(),i.add(s))}e.R("SubGraphExpanded",i)}finally{e.eb("Expand SubGraph")}},K.prototype.canExpandSubGraph=function(t){t===void 0&&(t=null);var e=this.diagram;if(e.isReadOnly)return!1;if(t!==null)return t instanceof ji&&!t.isSubGraphExpanded;for(t=e.selection.iterator;t.next();)if(e=t.value,e instanceof ji&&!e.isSubGraphExpanded)return!0;return!1},K.prototype.editTextBlock=function(t){t===void 0&&(t=null);var e=this.diagram,i=e.toolManager.findTool("TextEditing");if(i!==null){if(t===null){t=null;for(var n=e.selection.iterator;n.next();){var s=n.value;if(s.canEdit()){t=s;break}}if(t===null)return;t=t.Nl(function(a){return a instanceof Wn&&a.editable})}t!==null&&(e.currentTool=null,i.textBlock=t,e.currentTool=i)}},K.prototype.canEditTextBlock=function(t){t===void 0&&(t=null);var e=this.diagram;if(e.isReadOnly||e.isModelReadOnly||!e.allowTextEdit||e.toolManager.findTool("TextEditing")===null)return!1;if(t!==null){if(!(t instanceof Wn))return!1;if(t=t.part,t!==null&&t.canEdit())return!0}else for(e=e.selection.iterator;e.next();)if(t=e.value,t.canEdit()&&(t=t.Nl(function(i){return i instanceof Wn&&i.editable}),t!==null))return!0;return!1},K.prototype.showContextMenu=function(t){var e=this.diagram,i=e.toolManager.findTool("ContextMenu");if(i!==null&&(t===void 0&&(t=0<e.selection.count?e.selection.first():e),t=i.findObjectWithContextMenu(t),t!==null)){var n=e.lastInput,s=null;t instanceof at?s=t.ga(on):e.viewportBounds.ca(n.documentPoint)||(s=e.viewportBounds,s=new z(s.x+s.width/2,s.y+s.height/2)),s!==null&&(n.viewPoint=e.op(s),n.documentPoint=s,n.left=!1,n.right=!0,n.up=!0),e.currentTool=i,nu(i,!1,t)}},K.prototype.canShowContextMenu=function(t){var e=this.diagram,i=e.toolManager.findTool("ContextMenu");return i===null?!1:(t===void 0&&(t=0<e.selection.count?e.selection.first():e),i.findObjectWithContextMenu(t)!==null)},K.prototype.computeEffectiveCollection=function(t,e){var i=this.diagram,n=i.toolManager.findTool("Dragging"),s=i.currentTool===n;if(e===void 0&&(e=s?n.dragOptions:i.Wm),n=new pe,t===null)return n;for(var a=t.iterator;a.next();)ih(i,n,a.value,s,e);if(i.draggedLink!==null&&e.dragsLink)return n;for(a=t.iterator;a.next();)t=a.value,t instanceof ue&&(e=t.fromNode,e===null||n.contains(e)?(e=t.toNode,e===null||n.contains(e)||n.remove(t)):n.remove(t));return n},ct.Object.defineProperties(K.prototype,{diagram:{get:function(){return this.H}},copiesClipboardData:{get:function(){return this.o},set:function(t){this.o=t}},copiesConnectedLinks:{get:function(){return this.u},set:function(t){this.u=t}},deletesConnectedLinks:{get:function(){return this.Ha},set:function(t){this.Ha=t}},copiesTree:{get:function(){return this.ia},set:function(t){this.ia=t}},deletesTree:{get:function(){return this.nb},set:function(t){this.nb=t}},copiesParentKey:{get:function(){return this.V},set:function(t){this.V=t}},copiesGroupKey:{get:function(){return this.F},set:function(t){this.F=t}},archetypeGroupData:{get:function(){return this.j},set:function(t){this.j=t}},memberValidation:{get:function(){return this.ij},set:function(t){this.ij=t}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(t){this.diagram.defaultScale=t}},zoomFactor:{get:function(){return this.Hb},set:function(t){1<t||lt("zoomFactor must be larger than 1.0, not: "+t),this.Hb=t}},isZoomToFitRestoreEnabled:{get:function(){return this.hb},set:function(t){this.hb=t}},scrollToPartPause:{get:function(){return this.ob},set:function(t){this.ob=t}}}),K.className="CommandHandler",X0=function(){return new K};function at(){vi(this),this.l=30723,this.pb=1,this.bn="",this.Ma=this.Me=null,this.pa=new z(NaN,NaN).freeze(),this.jd=Ps,this.Ab=new nn,this.wh=new nn,this.Lb=null,this.Ca=this.Kk=1,this.Kb=0,this.Kg=ro,this.uc=new It(NaN,NaN,NaN,NaN).freeze(),this.Ib=new It(NaN,NaN,NaN,NaN).freeze(),this.dc=new It(0,0,NaN,NaN).freeze(),this.ba=this.Yn=this.Zn=null,this.sk=this.Jb=zn,this.Ag=this.io=0,this.V=this.tb=this.Dh=this.A=this.Ua=null,this.Uc=!1,this.jo=this.Ng=null}var ie,Yt,Ge,si,yi,Vi,un,qi,dn,Dn;at.prototype.cloneProtected=function(t){t.l=this.l|6144,t.pb=this.pb,t.bn=this.bn,t.Ma=this.Ma,t.pa.assign(this.pa),t.jd=this.jd.J(),this.Lb!==null?t.Lb=this.Lb.copy():t.Lb=null,t.Ca=this.Ca,t.Kb=this.Kb,t.Kg=this.Kg.J(),t.uc.assign(this.uc),t.Ib.assign(this.Ib),t.dc.assign(this.dc),t.Yn=this.Yn,this.ba!==null&&(t.ba=this.ba.copy()),t.Jb=this.Jb.J(),t.sk=this.sk.J(),t.io=this.io,t.Ag=this.Ag,this.Ua!==null&&(t.Ua=this.Ua.copy()),this.A!==null&&(t.A=this.A.nc?this.A:this.A.copy()),this.Dh!==null&&(t.Dh=bi(this.Dh)),this.tb!==null&&(t.tb=this.tb.copy())},at.prototype.Vw=function(t){var e=this.Dh;if(ce(e)){for(var i=0;i<e.length;i++)if(e[i]===t)return}else this.Dh=e=[];e.push(t)},at.prototype.Af=function(t){t.Zn=null,t.Ng=null,t.v()},at.prototype.clone=function(){var t=new this.constructor;if(this.cloneProtected(t),this.Dh!==null)for(var e=0;e<this.Dh.length;e++){var i=this.Dh[e];t[i]=this[i]}return t},at.prototype.copy=function(){return this.clone()},T=at.prototype,T.qb=function(t){t.classType===ue?t.name.indexOf("Orient")===0?this.segmentOrientation=t:lt("Unknown Link enum value for GraphObject.segmentOrientation property: "+t):t.classType===at&&(this.stretch=t)},T.toString=function(){return Re(this.constructor)+"#"+Ti(this)},T.th=function(){this.A!==null&&(this.A.nc=!0)};function en(t){t.A===null?t.A=new Kd:t.A.nc&&(t.A=t.A.copy())}T.Xc=function(){if(this.ba===null){var t=new Hd;t.Xi=Nn,t.yj=Nn,t.Vi=10,t.wj=10,t.Wi=0,t.xj=0,this.ba=t}},T.cb=function(t,e,i,n,s,a,l){var c=this.part;if(c!==null&&(c.gk(t,e,i,n,s,a,l),i===this&&t===Sr&&as(this)&&lr(this,c,e),a=this.diagram,this.animationTriggers===null||a===null||!a.pi||a.undoManager.isUndoingRedoing||a.animationManager.Dm||(t=this.animationTriggers.get(e),t!==null&&a.animationManager.isEnabled&&!a.animationManager.isTicking&&(this.jo===null&&(this.jo=new pe),l=a.undoManager.transactionLevel===0,t.startCondition===Zc?l=!0:t.startCondition===Nh&&(l=!1),l?(a=new ms,mg(t,a),l=this.jo.get(t),l!==null&&l.stop(),this.jo.add(t,a),a.vu=this,a.Nw=t,a.add(this,e,n,s),a.start()):(Mu(a.animationManager,"Trigger"),a.animationManager.defaultAnimation.add(this,e,n,s)))),this instanceof ne&&i===c&&(c.l&16777216)!==0&&c.data!==null))for(i=this.O.s,n=i.length,s=0;s<n;s++)c=i[s],c instanceof ne&&Hh(c,function(f){f.data!==null&&f.l&16777216&&f.La(e)})};function lr(t,e,i){var n=t.ih();if(n!==null)for(var s=t.localBindings.iterator;s.next();){var a=s.value,l=null;if(a.sourceName!==null){if(l=Ty(a,n,t),l===null)continue;a.sp(t,l,i,null)}else if(a.isToModel){var c=e.diagram;c===null||c.skipsModelSourceBindings||a.sp(t,c.model.modelData,i,n)}else{if(c=n.data,c===null)continue;var f=e.diagram;f===null||f.skipsModelSourceBindings||a.sp(t,c,i,n)}l===t&&(c=n.ks(a.Ai),c!==null&&a.Mv(c,l,i))}}T.ks=function(t){return this.bindingId===t?this:null},T.g=function(t,e,i){this.cb(Sr,t,this,e,i)},T.Ge=function(t,e,i,n){var s=this.uc;if(s.h(t,e,i,n),this.Ca!==1||this.Kb!==0){this.Lb===null&&(this.Lb=new nn);var a=this.Lb;a.reset(),this.no(a,t,e,i,n),a.pp(s)}};function To(t,e,i,n){return t.pickable===!1?!1:(n.multiply(t.transform),i?t.Yc(e,n):t.fh(e,n))}T.tx=function(t,e,i){if(this.pickable===!1)return!1;var n=this.naturalBounds;return e=t.Bf(e),i?Fn(t.x,t.y,0,0,0,n.height)<=e||Fn(t.x,t.y,0,n.height,n.width,n.height)<=e||Fn(t.x,t.y,n.width,n.height,n.width,0)<=e||Fn(t.x,t.y,n.width,0,0,0)<=e:t.zd(0,0)<=e&&t.zd(0,n.height)<=e&&t.zd(n.width,0)<=e&&t.zd(n.width,n.height)<=e},T.se=function(){return!0},T.ca=function(t){var e=z.alloc();e.assign(t),this.transform.Ga(e);var i=this.actualBounds;if(!i.w())return z.free(e),!1;var n=this.diagram;if(n!==null&&n.wq){var s=n.Ql("extraTouchThreshold"),a=n.Ql("extraTouchArea"),l=a/2,c=this.naturalBounds;n=this.Df()*n.scale;var f=1/n;if(c.width*n<s&&c.height*n<s)return t=jr(i.x-l*f,i.y-l*f,i.width+a*f,i.height+a*f,e.x,e.y),z.free(e),t}return s=!1,(this instanceof Cn||this instanceof Xi?jr(i.x-5,i.y-5,i.width+10,i.height+10,e.x,e.y):i.ca(e))&&(this.tb&&!this.tb.ca(e)?s=!1:this.areaBackground!==null&&i.ca(e)||this.Ma!==null&&this.dc.ca(t)?s=!0:s=this.gh(t)),z.free(e),s},T.gh=function(t){var e=this.naturalBounds;return jr(0,0,e.width,e.height,t.x,t.y)},T.Re=function(t){if(this.angle===0)return this.actualBounds.Re(t);var e=this.naturalBounds;e=It.allocAt(0,0,e.width,e.height);var i=this.transform,n=!1,s=z.allocAt(t.x,t.y);return e.ca(i.Cd(s))&&(s.h(t.x,t.bottom),e.ca(i.Cd(s))&&(s.h(t.right,t.bottom),e.ca(i.Cd(s))&&(s.h(t.right,t.y),e.ca(i.Cd(s))&&(n=!0)))),z.free(s),It.free(e),n},T.fh=function(t,e){if(e===void 0)return t.Re(this.actualBounds);var i=this.naturalBounds,n=!1,s=z.allocAt(0,0);return t.ca(e.Ga(s))&&(s.h(0,i.height),t.ca(e.Ga(s))&&(s.h(i.width,i.height),t.ca(e.Ga(s))&&(s.h(i.width,0),t.ca(e.Ga(s))&&(n=!0)))),z.free(s),n},T.Yc=function(t,e){if(e===void 0&&(e=this.transform,this.angle===0))return t.Yc(this.actualBounds);var i=this.naturalBounds,n=z.allocAt(0,0),s=z.allocAt(0,i.height),a=z.allocAt(i.width,i.height),l=z.allocAt(i.width,0),c=!1;if(t.ca(e.Ga(n))||t.ca(e.Ga(s))||t.ca(e.Ga(a))||t.ca(e.Ga(l)))c=!0;else{i=It.allocAt(0,0,i.width,i.height);var f=z.allocAt(t.x,t.y);i.ca(e.Cd(f))?c=!0:(f.h(t.x,t.bottom),i.ca(e.Cd(f))?c=!0:(f.h(t.right,t.bottom),i.ca(e.Cd(f))?c=!0:(f.h(t.right,t.y),i.ca(e.Cd(f))&&(c=!0)))),z.free(f),It.free(i),!c&&(ht.us(t,n,s)||ht.us(t,s,a)||ht.us(t,a,l)||ht.us(t,l,n))&&(c=!0)}return z.free(n),z.free(s),z.free(a),z.free(l),c},T.ga=function(t,e){if(e===void 0&&(e=new z),t instanceof Ze){var i=this.naturalBounds;e.h(t.x*i.width+t.offsetX,t.y*i.height+t.offsetY)}else e.set(t);return this.oe.Ga(e),e},T.mi=function(t){t===void 0&&(t=new It);var e=this.naturalBounds,i=this.oe,n=z.allocAt(0,0).transform(i);return t.h(n.x,n.y,0,0),n.h(e.width,0).transform(i),vr(t,n.x,n.y,0,0),n.h(e.width,e.height).transform(i),vr(t,n.x,n.y,0,0),n.h(0,e.height).transform(i),vr(t,n.x,n.y,0,0),z.free(n),t},T.li=function(){var t=this.oe;return t.m11===1&&t.m12===0?t=0:(t=180*Math.atan2(t.m12,t.m11)/Math.PI,0>t&&(t+=360)),t},T.Df=function(){if(!(this.l&4096))return this.Kk;var t=this.Ca;return this.panel!==null?t*this.panel.Df():t},T.qs=function(t,e){return e===void 0&&(e=new z),e.assign(t),this.oe.Cd(e),e},T.rs=function(t,e,i){return this.Sj(t.x,t.y,e.x,e.y,i)},T.Sj=function(t,e,i,n,s){var a=this.transform,l=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*l,f=-a.m12*l,m=-a.m21*l,v=a.m11*l,w=l*(a.m21*a.dy-a.m22*a.dx),C=l*(a.m12*a.dx-a.m11*a.dy);return this.areaBackground!==null?(a=this.actualBounds,ht.Ff(a.left,a.top,a.right,a.bottom,t,e,i,n,s)):(l=t*c+e*m+w,t=t*f+e*v+C,e=i*c+n*m+w,i=i*f+n*v+C,s.h(0,0),n=this.naturalBounds,i=ht.Ff(0,0,n.width,n.height,l,t,e,i,s),s.transform(a),i)},at.prototype.measure=function(t,e,i,n){if(ha(this)!==!1){var s=this.Kg,a=s.right+s.left;s=s.top+s.bottom,t=Math.max(t-a,0),e=Math.max(e-s,0),i=Math.max((i||0)-a,0),n=Math.max((n||0)-s,0),a=this.angle,s=this.desiredSize;var l=this.kq();a===90||a===270?(t=isFinite(s.height)?s.height+l:t,e=isFinite(s.width)?s.width+l:e):(t=isFinite(s.width)?s.width+l:t,e=isFinite(s.height)?s.height+l:e),s=i||0,l=n||0;var c=this instanceof ne;switch(Qs(this,!0)){case Yt:l=s=0,c&&(e=t=1/0);break;case ie:isFinite(t)&&t>i&&(s=t),isFinite(e)&&e>n&&(l=e);break;case si:isFinite(t)&&t>i&&(s=t),l=0,c&&(e=1/0);break;case yi:isFinite(e)&&e>n&&(l=e),s=0,c&&(t=1/0)}c=this.maxSize;var f=this.minSize;s>c.width&&f.width<c.width&&(s=c.width),l>c.height&&f.height<c.height&&(l=c.height),i=Math.max(s,f.width),n=Math.max(l,f.height),c.width<i&&(i=Math.min(f.width,i)),c.height<n&&(n=Math.min(f.height,n)),t=Math.min(c.width,t),e=Math.min(c.height,e),t=Math.max(i,t),e=Math.max(n,e),(a===90||a===270)&&(a=t,t=e,e=a,a=i,i=n,n=a),this.uc.ka(),this.Wl(t,e,i,n),this.uc.freeze(),this.uc.w()||lt("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.uc.toString()),Hr(this,!1)}},at.prototype.Wl=function(){},at.prototype.Dd=function(){return!1},at.prototype.arrange=function(t,e,i,n,s){this.Uk();var a=It.alloc();a.assign(this.Ib),this.Ib.ka(),Us(this)===!1?this.Ib.h(t,e,i,n):this.eh(t,e,i,n),this.Ib.freeze(),s===void 0?this.tb=null:this.tb=s,i=!1,s!==void 0?i=!0:(s=this.panel,s!==null&&bc(s)&&(s=s.panel),s!==null&&(s=s.dc,n=this.measuredBounds,this.areaBackground!==null&&(n=this.Ib),i=e+n.height,n=t+n.width,i=!(0<=t+.05&&n<=s.width+.05&&0<=e+.05&&i<=s.height+.05),this instanceof Wn&&(t=this.naturalBounds,this.Lq>t.height||this.Cb>t.width))&&(i=!0)),this.l=i?this.l|256:this.l&-257,this.Ib.w()||lt("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.Ib.toString()),this.Xl(a,this.Ib),vs(this,!1),It.free(a)},T=at.prototype,T.eh=function(){};function Ws(t,e,i,n,s){if(t.Ib.h(e,i,n,s),!t.desiredSize.w()){var a=t.uc;i=t.Kg,e=i.right+i.left;var l=i.top+i.bottom;switch(i=a.width+e,a=a.height+l,n+=e,s+=l,e=Qs(t,!0),i===n&&a===s&&(e=Yt),e){case Yt:(i>n||a>s)&&(Hr(t,!0),t.measure(i>n?n:i,a>s?s:a,0,0));break;case ie:Hr(t,!0),t.measure(n,s,0,0);break;case si:Hr(t,!0),t.measure(n,a,0,0);break;case yi:Hr(t,!0),t.measure(i,s,0,0)}}}T.Xl=function(t,e){var i=this.part;i!==null&&i.diagram!==null&&(i.selectionObject!==this&&i.resizeObject!==this&&i.rotateObject!==this||Gg(i,!0),this.N(),Xs(t,e)||(i.oh(),this.Pn(i)))},T.Pn=function(t){this.portId!==null&&(Gg(t,!0),t instanceof Le&&Am(t,this))},T.gc=function(t,e){if(!dl(this,t,e)&&this.visible){var i=this.opacity;if(i!==0){var n=1;i!==1&&(n=t.globalAlpha,t.globalAlpha=n*i);var s="";this.filter!==""&&(s=t.filter,t.filter=this.filter);var a=this instanceof ne&&bc(this),l=this.Ib;if(a){var c=this.Ib,f=this.dc,m=this.areaBackground,v=this.Ma;m===null&&v===null||t.yc(),m!==null&&(Br(this,t,m,!0,!0,f,c),m instanceof Tn&&m.type===fl?(t.beginPath(),t.rect(c.x,c.y,c.width,c.height),t.ng(m)):t.fillRect(c.x,c.y,c.width,c.height)),v!==null&&(Br(this,t,v,!0,!1,f,c),v instanceof Tn&&v.type===fl?(t.beginPath(),t.rect(c.x,c.y,c.width,c.height),t.ng(v)):t.fillRect(c.x,c.y,c.width,c.height)),this.hh(t,e)}if(!a&&(a||l.width!==0&&l.height!==0&&!isNaN(l.x)&&!isNaN(l.y))){a=this.transform,c=this.panel,this.l&4096&&ss(this),m=this.part,f=!1;var w=0;m&&e.Gf("drawShadows")&&(f=m.isShadowed)&&(v=m.shadowOffset,w=Math.max(v.y,v.x)*e.scale*e.Mb),v=this.Dd();var C;if(!(C=e.$i||!v)){var k=this.naturalBounds;C=this.wh;var L=C.m11,A=C.m21,H=C.dx,R=C.m12,X=C.m22,Y=C.dy,tt,st=tt=0;C=tt*L+st*A+H;var bt=tt*R+st*X+Y;tt=k.width+w,st=0;var Te=tt*L+st*A+H;tt=tt*R+st*X+Y,st=Math.min(C,Te);var Ke=Math.min(bt,tt),Oe=Math.max(C+0,Te)-st,he=Math.max(bt+0,tt)-Ke;C=st,bt=Ke,tt=k.width+w,st=k.height+w,Te=tt*L+st*A+H,tt=tt*R+st*X+Y,st=Math.min(C,Te),Ke=Math.min(bt,tt),Oe=Math.max(C+Oe,Te)-st,he=Math.max(bt+he,tt)-Ke,C=st,bt=Ke,tt=0,st=k.height+w,Te=tt*L+st*A+H,tt=tt*R+st*X+Y,st=Math.min(C,Te),Ke=Math.min(bt,tt),Oe=Math.max(C+Oe,Te)-st,he=Math.max(bt+he,tt)-Ke,C=st,bt=Ke,w=e.viewportBounds,k=w.x,L=w.y,C=!(C>w.width+k||k>Oe+C||bt>w.height+L||L>he+bt)}if(C){if(C=(this.l&256)!==0,t.clipInsteadOfFill&&(C=!1),this instanceof Wn&&(t.font=this.font),C){if(bt=c.se()?c.naturalBounds:c.actualBounds,Oe=Math.max(l.x,bt.x),he=Math.max(l.y,bt.y),w=Math.min(l.right,bt.right)-Oe,k=Math.min(l.bottom,bt.bottom)-he,L=this.tb,L!==null&&(Oe=L.x,he=L.y,w=L.width,k=L.height),Oe>l.width+l.x||l.x>bt.width+bt.x){i!==1&&(t.globalAlpha=n),this.filter!==""&&(t.filter=s);return}t.save(),t.beginPath(),t.rect(Oe,he,w,k),t.clip()}if(v){if(!m.isVisible()){i!==1&&(t.globalAlpha=n),this.filter!==""&&(t.filter=s);return}f&&(bt=m.shadowOffset,t.Ev(bt.x*e.scale*this.scale*e.Mb,bt.y*e.scale*this.scale*e.Mb,m.shadowBlur),zh(t),t.shadowColor=m.shadowColor)}f&&this.shadowVisible===!0?zh(t):f&&this.shadowVisible===!1&&Vl(t),m=this.naturalBounds,this.areaBackground!==null&&(t.yc(),za(this,t,m,l)),t.transform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),f&&qo(this,c)&&this.shadowVisible===null&&Vl(t),this.Ma!==null&&(t.yc(),ka(this,t,m,l)),f&&(this.Ma!==null||this.areaBackground!==null||qo(this,c))?(Kr(this,!0),this.shadowVisible===null&&Vl(t)):Kr(this,!1),this.hh(t,e),f&&this.l&512&&zh(t),v&&f&&Vl(t),C&&(t.restore(),t.Vc(this instanceof ne)),a.ws()||(e=1/(a.m11*a.m22-a.m12*a.m21),t.transform(a.m22*e,-a.m12*e,-a.m21*e,a.m11*e,e*(a.m21*a.dy-a.m22*a.dx),e*(a.m12*a.dx-a.m11*a.dy)))}}i!==1&&(t.globalAlpha=n),this.filter!==""&&(t.filter=s)}}};function qo(t,e){return e===null?!1:(bc(e)&&(e=e.panel),(e.l&512)!==0||(e.type===ne.Auto||e.type===ne.Spot)&&e.Pb()!==t)}T.Dv=function(){};function za(t,e,i,n){Br(t,e,t.areaBackground,!0,!0,i,n),t.areaBackground instanceof Tn&&t.areaBackground.type===fl?(e.beginPath(),e.rect(n.x,n.y,n.width,n.height),e.ng(t.areaBackground)):e.fillRect(n.x,n.y,n.width,n.height)}function ka(t,e,i,n){var s=t.kq(),a=i.x,l=i.y,c=i.width+s,f=i.height+s;Br(t,e,t.Ma,!0,!1,i,n),t.Ma instanceof Tn&&t.Ma.type===fl?(e.beginPath(),e.rect(a-s/2,l-s/2,c,f),e.ng(t.Ma)):e.fillRect(a-s/2,l-s/2,c,f)}function Os(t,e,i){for(var n=e.O.s,s=n.length,a=-1,l=0;l<s;l++)if(n[l]===t){a=l;break}if(t=a,t!==-1)if(t===0)e.svg.gd?e.svg.gd.after(i):e.svg.Ma?e.svg.Ma.after(i):e.type===ne.Table?(e=e.svg.getElementsByClassName("gojs-ts"),e=e.length!==0?e[0]:null,e!==null&&e.after(i)):e.svg.prepend(i);else{for(;t!==0&&!e.M(t-1).Ed();)t--;t===0?e.svg.prepend(i):(t=e.M(t-1).svg,t!==null?t.after(i):e.svg.appendChild(i))}}function dl(t,e,i){if(!(e instanceof Bs))return!1;if(!t.visible||t.opacity===0||t.Dd()&&!t.isVisible())return t.svg!==null&&t.svg.parentNode!==null&&t.svg.remove(),!0;var n=t.panel,s=t.nk(e);if(t.kk(e,i,s))return t.svg.parentElement!==null?(t.Dd()&&(e.ti=t.svg),!0):(t.Dd()?(e.ti!==null?e.ti.after(t.svg):e.Nj.prepend(t.svg),e.ti=t.svg):n&&Os(t,n,t.svg),!0);if(t.Dd()&&t.isShadowed){var a=t.shadowOffset;e.Ev(a.x*i.scale*t.scale*i.Mb,a.y*i.scale*t.scale*i.Mb,t.shadowBlur),zh(e),e.shadowColor=t.shadowColor}t instanceof Wn&&(e.font=t.font),e.yd=null;var l=t.transform;a=t instanceof ne;var c=t instanceof ne?bc(t):!1;t.l&4096&&ss(t);var f=t.Ib;if(e.rb.ha=[1,0,0,1,0,0],e.o=!1,s&&(e.o=!0,a&&c?(Jp(e,1,0,0,1,0,0),t.svg=e.ad):a?(Jp(e,l.m11,l.m12,l.m21,l.m22,l.dx,l.dy),t.svg=e.ad):Jp(e,1,0,0,1,0,0)),s=t.naturalBounds,t.areaBackground!==null){var m=l.copy().Vj();e.rb.ha=[m.m11,m.m12,m.m21,m.m22,m.dx,m.dy],za(t,e,s,f),e.rb.ha=[1,0,0,1,0,0],e.yd.gd=e.ad,e.yd.prepend(e.ad)}return a||(e.rb.ha=[l.m11,l.m12,l.m21,l.m22,l.dx,l.dy]),t.background!==null&&(a?(c&&(e.rb.ha=[l.m11,l.m12,l.m21,l.m22,l.dx,l.dy]),ka(t,e,s,f),c&&(e.rb.ha=[1,0,0,1,0,0])):(e.rb.ha=[l.m11,l.m12,l.m21,l.m22,l.dx,l.dy],ka(t,e,s,f)),e.yd.Ma=e.ad,e.yd.prepend(e.ad)),l=e.yd,s=t.part,c=!1,s&&i.Gf("drawShadows")&&(c=s.isShadowed),e.clipInsteadOfFill&&(c=!1),t.Dd()&&c&&zh(e),c&&t.shadowVisible===!0?zh(e):c&&t.shadowVisible===!1&&Vl(e),s=t.panel,c&&qo(t,s)&&t.shadowVisible===null&&Vl(e),e.Il&&(m=i.computePixelRatio(),m="drop-shadow("+e.shadowOffsetX/m+"px "+e.shadowOffsetY/m+"px "+e.shadowBlur/m/2+"px "+e.shadowColor+")",t.background!==null&&l.Ma.setAttributeNS(null,"filter",m),t.areaBackground!==null&&l.gd.setAttributeNS(null,"filter",m)),c&&(t.Ma!==null||t.areaBackground!==null||qo(t,s))?(Kr(t,!0),t.shadowVisible===null&&Vl(e)):Kr(t,!1),s=c,t.hh(e,i),a&&e.nh.pop(),e.o&&e.nh.pop(),l=e.Gv.hs,c=a?t.svg:e.yd,m=t.svg,!a&&m!==null&&c!==m&&m.parentNode===t.panel.svg?(t.svg.replaceWith(c),t.svg=c,c!==null&&t.$o(e,n,f,c),rr(e,m),!0):(t.svg=c,l!==null&&c===null&&(Mg(e),e.nh.pop()),c===null||(t.$o(e,n,f,c),e.Il&&(i=i.computePixelRatio(),t.Dv(c,"drop-shadow("+e.shadowOffsetX/i+"px "+e.shadowOffsetY/i+"px "+e.shadowBlur/i/2+"px "+e.shadowColor+")")),s&&t.l&512&&zh(e),t.Dd()&&Vl(e),i=t.Dd()?t.opacity*e.globalAlpha:t.opacity,i!==1&&c.setAttributeNS(null,"opacity",i.toString()),t.filter!==""&&c.setAttributeNS(null,"filter",t.filter),t.Dd()?(e.ti?e.ti.after(c):e.Nj.prepend(c),e.ti=c):n!==null&&Os(t,n,c),l!==null&&l(t,c)),!0)}T.$o=function(t,e,i,n){var s=(this.l&256)!==0;if(t.clipInsteadOfFill&&(s=!1),s){var a=e.se()?e.naturalBounds:e.actualBounds;e=Math.max(i.x,a.x),s=Math.max(i.y,a.y);var l=Math.min(i.right,a.right)-e;i=Math.min(i.bottom,a.bottom)-s,a=this.tb,a!==null&&(e=a.x,s=a.y,l=a.width,i=a.height),a=n.getAttribute("clip-path");var c=null;a!==null&&(c=t.svg.getElementById(a.split("#")[1].slice(0,-1))),c===null?(a="CLIP"+gn++,c=t.Ud("clipPath",{id:a}),e=t.Ud("rect",{x:e,y:s,width:l,height:i}),this instanceof ne&&(s=this.transform.copy().Vj(),e.setAttribute("transform","matrix("+s.m11+", "+s.m12+", "+s.m21+", "+s.m22+", "+s.dx+", "+s.dy+")")),c.appendChild(e),t.svg.appendChild(c),n.setAttributeNS(null,"clip-path","url(#"+a+")")):(t=c.firstElementChild,t.setAttribute("x",e.toString()),t.setAttribute("y",s.toString()),t.setAttribute("width",l.toString()),t.setAttribute("height",i.toString()))}else n.removeAttributeNS(null,"clip-path"),rr(t,n)};function rr(t,e){e=e.getAttribute("clip-path"),e!==null&&(t=t.svg.getElementById(e.split("#")[1].slice(0,-1)),t!==null&&t.remove())}function gs(t){if(t.svg!==null){var e=t.svg.innerHTML.match(/url\(#((CLIP|GRAD).+?)\)/g),i=t.svg.ownerDocument;if(e!==null){e=$n(e);for(var n=e.next();!n.done;n=e.next())n=i.getElementById(n.value.split("#")[1].slice(0,-1)),n!==null&&n.remove()}t.svg.remove()}}T.hh=function(){},T.lv=function(){this.Uc=!0},T.kk=function(t,e,i){if(this.Uc)return this.lv(),this.Uc=!1;if(e=this.svg,e===null)return!1;if(!this.visible)return e.remove(),!1;if(e.nodeName!=="g"&&i||e.nodeName==="g"&&!i)return!1;var n=this.transform,s=this instanceof ne?bc(this):!1;if(!(this instanceof ne&&s))if(this instanceof da){var a=this.bt;t.rb.ha=[n.m11,n.m12,n.m21,n.m22,n.dx,n.dy],a!==null&&Xp(t,a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]),i?e.lastElementChild.setAttributeNS(null,"transform",Sg(t)):e.setAttributeNS(null,"transform",Sg(t))}else if(!i||this instanceof ne)e.setAttributeNS(null,"transform","matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+n.dx+", "+n.dy+")");else if(this instanceof Xi){a=e.getElementsByTagName("path");for(var l=0;l<a.length;l++)a[l].setAttributeNS(null,"transform","matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+n.dx+", "+n.dy+")")}else e.lastElementChild.setAttributeNS(null,"transform","matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+n.dx+", "+n.dy+")");return a=this.Dd()?this.opacity*t.globalAlpha:this.opacity,a===1?e.removeAttribute("opacity"):e.setAttributeNS(null,"opacity",a.toString()),t.rb.ha=[1,0,0,1,0,0],(this.areaBackground!==null||e.gd!==void 0)&&(a=e.gd,this.areaBackground===null?(e.gd.remove(),e.gd=void 0):(l=n.copy().Vj(),t.rb.ha=[l.m11,l.m12,l.m21,l.m22,l.dx,l.dy],za(this,t,this.naturalBounds,this.actualBounds),t.rb.ha=[1,0,0,1,0,0],e.gd?(l=e.gd.getAttribute("filter"),l!==null&&t.ad.setAttribute("filter",l),e.gd.replaceWith(t.ad)):e.prepend(t.ad),e.gd=t.ad),a&&Cg(t,a)),(this.background!==null||e.Ma!==void 0)&&(a=e.Ma,this.background===null?(Cg(t,e.Ma),e.Ma.remove(),e.Ma=void 0):((s||i&&!(this instanceof ne))&&(t.rb.ha=[n.m11,n.m12,n.m21,n.m22,n.dx,n.dy]),ka(this,t,this.naturalBounds,this.actualBounds),e.Ma?(Cg(t,e.Ma),i=e.Ma.getAttribute("filter"),i!==null&&t.ad.setAttribute("filter",i),e.Ma.replaceWith(t.ad)):e.prepend(t.ad),e.Ma=t.ad),a&&Cg(t,a)),this.$o(t,this.panel,this.actualBounds,e),!0},T.nk=function(t){if(this.background!==null||this.areaBackground!==null)return!0;var e=(this.l&256)!==0;return t.clipInsteadOfFill&&(e=!1),!!e};function Br(t,e,i,n,s,a,l){if(i!==null){var c=1,f=1;if(typeof i=="string")n?e.fillStyle=i:e.strokeStyle=i;else if(i.type===$h)n?e.fillStyle=i.color:e.strokeStyle=i.color;else{var m=t.kq();if(c=a.width,f=a.height,s?(c=l.width,f=l.height):n||(c+=m,f+=m),(a=e instanceof uh)&&i.xe&&(i.type===Qp||i.yk===c&&i.ft===f))var v=i.xe;else{var w=0,C=0,k=0,L=0,A=0,H=0;if(H=A=0,s?(A=l.x,H=l.y):n||(A-=m/2,H-=m/2),w=i.start.x*c+i.start.offsetX,C=i.start.y*f+i.start.offsetY,k=i.end.x*c+i.end.offsetX,L=i.end.y*f+i.end.offsetY,w+=A,k+=A,C+=H,L+=H,i.type===Kh)v=e.createLinearGradient(w,C,k,L);else if(i.type===fl)H=isNaN(i.endRadius)?Math.max(c,f)/2:i.endRadius,isNaN(i.startRadius)?(A=0,H=Math.max(c,f)/2):A=i.startRadius,v=e.createRadialGradient(w,C,A,k,L,H);else if(i.type===Qp)try{v=e.createPattern(i.pattern,"repeat")}catch(X){v=null}if(i.type!==Qp&&(s=i.colorStops,s!==null))for(s=s.iterator;s.next();)v.addColorStop(s.key,s.value);if(a&&(i.xe=v,v!==null&&(i.yk=c,i.ft=f),v===null&&i.type===Qp&&i.yk!==-1)){i.yk=-1;var R=t.diagram;R!==null&&i.yk===-1&&ge(function(){R.redraw()},600)}}n?e.fillStyle=v:e.strokeStyle=v}}}T.rg=function(t){if(t instanceof ne)t:{if(this!==t&&t!==null)for(var e=this.panel;e!==null;){if(e===t){t=!0;break t}e=e.panel}t=!1}else t=!1;return t},T.Ed=function(){if(!this.visible)return!1;var t=this.panel;return t!==null?t.Ed():!0},T.If=function(){for(var t=this instanceof ne?this:this.panel;t!==null&&t.isEnabled;)t=t.panel;return t===null};function ss(t){if(t.l&2048){var e=t.Ab;if(e.reset(),!t.Ib.w()||!t.uc.w()){_l(t,!1);return}if(e.translate(t.Ib.x-t.uc.x,t.Ib.y-t.uc.y),t.scale!==1||t.angle!==0){var i=t.naturalBounds;t.no(e,i.x,i.y,i.width,i.height)}_l(t,!1),Ja(t,!0)}t.l&4096&&(e=t.panel,e===null?(t.wh.set(t.Ab),t.Kk=t.scale,Ja(t,!1)):e.oe!==null&&(i=t.wh,i.reset(),e.se()?i.multiply(e.wh):e.panel!==null&&i.multiply(e.panel.wh),i.multiply(t.Ab),t.Kk=t.scale*e.Kk,Ja(t,!1)))}T.no=function(t,e,i,n,s){if(this.Ca!==1&&t.scale(this.Ca),this.Kb!==0){var a=z.alloc();a.yi(e,i,n,s,on),t.rotate(this.Kb,a.x,a.y),z.free(a)}},T.v=function(t){if(!ha(this)){t===void 0&&(t=!1),Hr(this,!0),vs(this,!0);var e=this.panel;e===null||t||e.v()}},T.Uj=function(){ha(this)||(Hr(this,!0),vs(this,!0))};function Qo(t){if(!Us(t)){var e=t.panel;e!==null?e.v():t.Dd()&&(e=t.diagram,e!==null&&(e.De.add(t),t instanceof Le&&t.Bd(),e.$b())),vs(t,!0)}}T.Uk=function(){!(this.l&2048)&&(_l(this,!0),Ja(this,!0))},T.Wu=function(){Ja(this,!0)},T.N=function(){var t=this.part;t!==null&&t.N()};function Qs(t,e){var i=t.stretch,n=t.panel;return n!==null&&n.type===ne.Table?La(t,n.Fb(t.row),n.Eb(t.column),e):n!==null&&n.type===ne.Auto&&n.Pb()===t?Wo(t,ie,e):i===Vi?n!==null?n.type===ne.Spot&&n.Pb()===t?Wo(t,ie,e):(i=n.defaultStretch,i===Vi?Wo(t,Yt,e):Wo(t,i,e)):Wo(t,Yt,e):Wo(t,i,e)}function La(t,e,i,n){var s=t.stretch;if(s!==Vi)return Wo(t,s,n);var a=s=null;switch(e.stretch){case yi:a=!0;break;case ie:a=!0}switch(i.stretch){case si:s=!0;break;case ie:s=!0}return e=t.panel.defaultStretch,s===null&&(s=e===si||e===ie),a===null&&(a=e===yi||e===ie),s===!0&&a===!0?Wo(t,ie,n):s===!0?Wo(t,si,n):a===!0?Wo(t,yi,n):Wo(t,Yt,n)}function Wo(t,e,i){if(i)return e;if(e===Yt||(i=t.desiredSize,i.w()))return Yt;if(t=t.angle,!isNaN(i.width))if(t!==90&&t!==270){if(e===si)return Yt;if(e===ie)return yi}else{if(e===yi)return Yt;if(e===ie)return si}if(!isNaN(i.height))if(t!==90&&t!==270){if(e===yi)return Yt;if(e===ie)return si}else{if(e===si)return Yt;if(e===ie)return yi}return e}function Kr(t,e){t.l=e?t.l|512:t.l&-513}function as(t){return(t.l&1024)!==0}function $d(t,e){t.l=e?t.l|1024:t.l&-1025}function _l(t,e){t.l=e?t.l|2048:t.l&-2049}function Ja(t,e){t.l=e?t.l|4096:t.l&-4097}function ha(t){return(t.l&8192)!==0}function Hr(t,e){t.l=e?t.l|8192:t.l&-8193}function Us(t){return(t.l&16384)!==0}function vs(t,e){t.l=e?t.l|16384:t.l&-16385}T.Gj=function(){this.svg=null},T.wi=function(t){this.Me=t,this.svg!==null&&this.svg.remove()},T.Av=function(){},T.zv=function(t){return this.pa=t,Qo(this),!0},T.mm=function(t,e){(this.pa.x!==t||this.pa.y!==e)&&(this.pa.h(t,e),this.Uk())},T.kq=function(){return 0};function ed(t){var e=t.part;if(e instanceof Le&&(t.portId!==null||t===e.port)){var i=e.diagram;i===null||i.undoManager.isUndoingRedoing||Am(e,t)}}function Rv(t){var e=t.diagram;e===null||e.undoManager.isUndoingRedoing||(t instanceof ne?t instanceof Le?t.Bd():t.qm(t,function(i){ed(i)}):ed(t))}T.bind=function(t,e,i,n){var s=null;return typeof t=="string"?s=new Un(t,e,i,n):s=t,s.xd=this,t=this.ih(),t!==null&&n1(t)&&lt("Cannot add a Binding to a template that has already been copied: "+s),this.localBindings===null&&(this.localBindings=new Kt),this.localBindings.add(s),this},T.set=function(t){return Object.assign(this,t),this},T.Du=function(t){return ts(this,t),this},T.apply=function(t){return t(this),this},T.nm=function(t){return Xc(this,t),this},T.pz=function(){return this.ih()},T.ih=function(){for(var t=this instanceof ne?this:this.panel;t!==null;){if(t.allBindings!==null)return t;t=t.panel}return null},T.Jv=function(t){return t.xd=this,this.animationTriggers===null&&(this.animationTriggers=new pe),this.animationTriggers.add(t.propertyName,t),this};function fi(t,e){for(var i=1;i<arguments.length;++i);i=arguments;var n=null,s=null;if(typeof t=="function")s=t;else if(typeof t=="string"){var a=Xf.I(t);typeof a=="function"?(i=bi(arguments),n=a(i),Tt(n)||lt('GraphObject.make invoked object builder "'+t+'", but it did not return an Object')):s=Z.go[t]}if(n===null&&(s!=null&&s.constructor||lt("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+t),n=new s),s=1,n instanceof wt&&1<i.length){a=n;var l=i[1];(typeof l=="string"||l instanceof HTMLDivElement)&&(cl(a,l),s++)}for(;s<i.length;s++)a=i[s],a===void 0?lt("Undefined value at argument "+s+" for object being constructed by GraphObject.make: "+n):ts(n,a);return n}function ts(t,e){if(typeof e=="string")if(t instanceof Wn)t.text=e;else if(t instanceof Xi)t.figure=e;else if(t instanceof da)t.source=e;else if(t instanceof ne)e=Ta.I(e),e!==null&&(t.type=e);else if(t instanceof Tn){var i=Xe(Tn,e);i!==null?t.type=i:lt("Unknown Brush type as an argument to GraphObject.make: "+e)}else t instanceof fe?(e=Xe(fe,e),e!==null&&(t.type=e)):t instanceof an&&(e=Xe(an,e),e!==null&&(t.type=e));else if(e instanceof at)t instanceof ne||lt("A GraphObject can only be added to a Panel, not to: "+t),t.add(e);else if(e instanceof vo){var n;e.isRow&&typeof t.getRowDefinition=="function"?n=t.getRowDefinition(e.index):e.isRow||typeof t.getColumnDefinition!="function"||(n=t.getColumnDefinition(e.index)),n instanceof vo?np(n,e):lt("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+t)}else if(e instanceof mt)typeof t.qb=="function"&&t.qb(e);else if(e instanceof So)t.type=e;else if(e instanceof Un)t instanceof at||t instanceof vo?t.bind(e):lt("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+t);else if(e instanceof zl)t instanceof at?t.Jv(e):lt("An AnimationTrigger can only be applied to a GraphObject, not to: "+t);else if(e instanceof Mr)t instanceof fe&&t.type===fe.o?t.figures.add(e):lt("A PathFigure can only be added to a Path Geometry, not to: "+t);else if(e instanceof an)t instanceof Mr?t.segments.add(e):lt("A PathSegment can only be added to a PathFigure, not to: "+t);else if(e instanceof pr)t instanceof wt||t instanceof ji?t.layout=e:lt("A Layout can only be assigned to a Diagram or a Group, not to: "+t);else if(Array.isArray(e))for(i=0;i<e.length;i++)ts(t,e[i]);else if(typeof e=="object"&&e!==null)if(t instanceof Tn){i=new ci;for(var s in e)n=parseFloat(s),isNaN(n)?i[s]=e[s]:t.addColorStop(n,e[s]);Xc(t,i)}else if(t instanceof vo){e.row!==void 0?(s=e.row,(s==null||s===1/0||isNaN(s)||0>s)&&lt("Must specify non-negative integer row for RowColumnDefinition "+e+", not: "+s),t.isRow=!0,t.index=s):e.column!==void 0&&(s=e.column,(s==null||s===1/0||isNaN(s)||0>s)&&lt("Must specify non-negative integer column for RowColumnDefinition "+e+", not: "+s),t.isRow=!1,t.index=s),s=new ci;for(i in e)i!=="row"&&i!=="column"&&(s[i]=e[i]);Xc(t,s)}else Xc(t,e);else lt('Unknown initializer "'+e+'" for object being constructed by GraphObject.make: '+t)}function id(t,e){Xf.add(t,e)}function zv(t,e,i){i===void 0&&(i=null);var n=t[1];if(typeof i=="function"?i(n):typeof n=="string")return t.splice(1,1),n;if(e===void 0)throw Error("no "+(typeof i=="function"?"satisfactory":"string")+" argument for GraphObject builder "+t[0]);return e}ct.Object.defineProperties(at.prototype,{bindingId:{get:function(){return this.A!==null?this.A.zp:-1},set:function(t){this.bindingId!==t&&(this.A===null&&(this.A=new Kd),this.A.zp=t)}},localBindings:{get:function(){return this.A!==null?this.A.te:null},set:function(t){this.localBindings!==t&&(this.A===null&&(this.A=new Kd),this.A.te=t)}},srcBindings:{get:function(){return this.A!==null?this.A.wm:null},set:function(t){this.srcBindings!==t&&(this.A===null&&(this.A=new Kd),this.A.wm=t)}},shadowVisible:{get:function(){return this.A!==null?this.A.Ci:null},set:function(t){var e=this.shadowVisible;e!==t&&(en(this),this.A.Ci=t,this.Uc=!0,this.N(),this.g("shadowVisible",e,t))}},enabledChanged:{get:function(){return this.A!==null?this.A.Hb:null},set:function(t){var e=this.enabledChanged;e!==t&&(en(this),this.A.Hb=t,this.g("enabledChanged",e,t))}},segmentOrientation:{get:function(){return this.Ua!==null?this.Ua.rr:ea},set:function(t){var e=this.segmentOrientation;e!==t&&(this.Ua===null&&(this.Ua=new Eu),this.Ua.rr=t,this.v(),this.g("segmentOrientation",e,t),t===ea&&(this.angle=0))}},segmentIndex:{get:function(){return this.Ua!==null?this.Ua.u:-1/0},set:function(t){t=Math.round(t);var e=this.segmentIndex;e!==t&&(this.Ua===null&&(this.Ua=new Eu),this.Ua.u=t,this.v(),this.g("segmentIndex",e,t))}},segmentFraction:{get:function(){return this.Ua!==null?this.Ua.o:0},set:function(t){isNaN(t)||0>t?t=0:1<t&&(t=1);var e=this.segmentFraction;e!==t&&(this.Ua===null&&(this.Ua=new Eu),this.Ua.o=t,this.v(),this.g("segmentFraction",e,t))}},segmentOffset:{get:function(){return this.Ua!==null?this.Ua.F:fn},set:function(t){var e=this.segmentOffset;e.D(t)||(t=t.J(),this.Ua===null&&(this.Ua=new Eu),this.Ua.F=t,this.v(),this.g("segmentOffset",e,t))}},stretch:{get:function(){return this.A!==null?this.A.hg:Vi},set:function(t){var e=this.stretch;e!==t&&(en(this),this.A.hg=t,this.v(),this.g("stretch",e,t))}},name:{get:function(){return this.A!==null?this.A.xa:""},set:function(t){var e=this.name;e!==t&&(en(this),this.A.xa=t,this.part!==null&&(this.part.Rh=null),this.g("name",e,t))}},opacity:{get:function(){return this.pb},set:function(t){var e=this.pb;e!==t&&((0>t||1<t)&&me(t,"0 <= value <= 1",at,"opacity"),this.pb=t,this.g("opacity",e,t),t=this.diagram,e=this.part,t!==null&&e!==null&&t.N(hu(e,e.actualBounds)))}},filter:{get:function(){return this.bn},set:function(t){var e=this.bn;e!==t&&(this.bn=t,this.Uc=!0,this.g("filter",e,t),t=this.diagram,e=this.part,t!==null&&e!==null&&t.N(hu(e,e.actualBounds)))}},visible:{get:function(){return(this.l&1)!==0},set:function(t){var e=(this.l&1)!==0;e!==t&&(this.l^=1,this.g("visible",e,t),e=this.panel,e!==null?e.v():this.Dd()&&this.Zb(t),this.N(),Rv(this))}},pickable:{get:function(){return(this.l&2)!==0},set:function(t){var e=(this.l&2)!==0;e!==t&&(this.l^=2,this.g("pickable",e,t))}},fromLinkableDuplicates:{get:function(){return(this.l&4)!==0},set:function(t){var e=(this.l&4)!==0;e!==t&&(this.l^=4,this.g("fromLinkableDuplicates",e,t))}},fromLinkableSelfNode:{get:function(){return(this.l&8)!==0},set:function(t){var e=(this.l&8)!==0;e!==t&&(this.l^=8,this.g("fromLinkableSelfNode",e,t))}},toLinkableDuplicates:{get:function(){return(this.l&16)!==0},set:function(t){var e=(this.l&16)!==0;e!==t&&(this.l^=16,this.g("toLinkableDuplicates",e,t))}},toLinkableSelfNode:{get:function(){return(this.l&32)!==0},set:function(t){var e=(this.l&32)!==0;e!==t&&(this.l^=32,this.g("toLinkableSelfNode",e,t))}},isPanelMain:{get:function(){return(this.l&64)!==0},set:function(t){var e=(this.l&64)!==0;e!==t&&(this.l^=64,this.v(),this.g("isPanelMain",e,t))}},isActionable:{get:function(){return(this.l&128)!==0},set:function(t){var e=(this.l&128)!==0;e!==t&&(this.l^=128,this.g("isActionable",e,t))}},areaBackground:{get:function(){return this.A!==null?this.A.gd:null},set:function(t){var e=this.areaBackground;e!==t&&(t!==null&&tp(t,"GraphObject.areaBackground"),t instanceof Tn&&t.freeze(),en(this),this.A.gd=t,this.N(),this.g("areaBackground",e,t))}},background:{get:function(){return this.Ma},set:function(t){var e=this.Ma;e!==t&&(t!==null&&tp(t,"GraphObject.background"),t instanceof Tn&&t.freeze(),this.Ma=t,this.N(),this.g("background",e,t))}},part:{get:function(){if(this.Dd())return this;if(this.Ng!==null)return this.Ng;var t;for(t=this.panel;t;){if(t instanceof ui)return this.Ng=t;t=t.panel}return null}},svg:{get:function(){return this.V},set:function(t){this.V=t}},panel:{get:function(){return this.Me}},layer:{get:function(){var t=this.part;return t!==null?t.layer:null}},diagram:{get:function(){var t=this.part;return t!==null?t.diagram:null}},position:{get:function(){return this.pa},set:function(t){var e=t.x,i=t.y,n=this.pa,s=n.x;n=n.y,(s===e||isNaN(s)&&isNaN(e))&&(n===i||isNaN(n)&&isNaN(i))?this.Av():(t=t.copy(),this.zv(t,s,n)&&this.g("position",new z(s,n),t))}},actualBounds:{get:function(){return this.Ib}},scale:{get:function(){return this.Ca},set:function(t){var e=this.Ca;e!==t&&(0>=t&&lt("GraphObject.scale for "+this+" must be greater than zero, not: "+t),this.Ca=t,this.v(),this.g("scale",e,t))}},angle:{get:function(){return this.Kb},set:function(t){var e=this.Kb;e!==t&&(t%=360,0>t&&(t+=360),e!==t&&(this.Kb=t,Rv(this),this.v(),this.g("angle",e,t)))}},desiredSize:{get:function(){return this.jd},set:function(t){var e=t.width,i=t.height,n=this.jd,s=n.width,a=n.height;(s===e||isNaN(s)&&isNaN(e))&&(a===i||isNaN(a)&&isNaN(i))||(this.jd=t=t.J(),this.v(),this instanceof Xi&&this.qc(),this.g("desiredSize",n,t),as(this)&&(t=this.part,t!==null&&(lr(this,t,"width"),lr(this,t,"height"))))}},width:{get:function(){return this.jd.width},set:function(t){var e=this.jd.width;e===t||isNaN(e)&&isNaN(t)||(e=this.jd,this.jd=t=new ii(t,this.jd.height).freeze(),this.v(),this instanceof Xi&&this.qc(),this.g("desiredSize",e,t),as(this)&&(t=this.part,t!==null&&lr(this,t,"width")))}},height:{get:function(){return this.jd.height},set:function(t){var e=this.jd.height;e===t||isNaN(e)&&isNaN(t)||(e=this.jd,this.jd=t=new ii(this.jd.width,t).freeze(),this.v(),this instanceof Xi&&this.qc(),this.g("desiredSize",e,t),as(this)&&(t=this.part,t!==null&&lr(this,t,"height")))}},minSize:{get:function(){return this.A!==null?this.A.u:xr},set:function(t){var e=this.minSize;e.D(t)||(t=t.copy(),isNaN(t.width)&&(t.width=0),isNaN(t.height)&&(t.height=0),t.freeze(),en(this),this.A.u=t,this.v(),this.g("minSize",e,t))}},maxSize:{get:function(){return this.A!==null?this.A.o:ds},set:function(t){var e=this.maxSize;e.D(t)||(t=t.copy(),isNaN(t.width)&&(t.width=1/0),isNaN(t.height)&&(t.height=1/0),t.freeze(),en(this),this.A.o=t,this.v(),this.g("maxSize",e,t))}},measuredBounds:{get:function(){return this.uc}},naturalBounds:{get:function(){return this.dc}},margin:{get:function(){return this.Kg},set:function(t){typeof t=="number"&&(t=new ai(t));var e=this.Kg;e.D(t)||(this.Kg=t=t.J(),this.v(),this.g("margin",e,t))}},transform:{get:function(){return this.l&2048&&ss(this),this.Ab}},oe:{get:function(){return this.l&4096&&ss(this),this.wh}},animationTriggers:{get:function(){return this.A!==null?this.A.hb:null},set:function(t){this.animationTriggers!==t&&(en(this),this.A.hb=t)}},reshapingBehavior:{get:function(){return this.A!==null?this.A.Pf:Yt},set:function(t){this.reshapingBehavior!==t&&(en(this),this.A.Pf=t)}},alignment:{get:function(){return this.Jb},set:function(t){var e=this.Jb;e.D(t)||(t.Mc()&&!t.Xb()&&lt("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+t),this.Jb=t=t.J(),Qo(this),this.g("alignment",e,t))}},column:{get:function(){return this.Ag},set:function(t){t=Math.round(t);var e=this.Ag;e!==t&&(0>t&&me(t,">= 0",at,"column"),this.Ag=t,this.v(),this.g("column",e,t),this.svg!==null&&this.svg.remove())}},columnSpan:{get:function(){return this.A!==null?this.A.ob:1},set:function(t){t=Math.round(t);var e=this.columnSpan;e!==t&&(1>t&&me(t,">= 1",at,"columnSpan"),en(this),this.A.ob=t,this.v(),this.g("columnSpan",e,t))}},row:{get:function(){return this.io},set:function(t){t=Math.round(t);var e=this.io;e!==t&&(0>t&&me(t,">= 0",at,"row"),this.io=t,this.v(),this.g("row",e,t),this.svg!==null&&this.svg.remove())}},rowSpan:{get:function(){return this.A!==null?this.A.Bi:1},set:function(t){t=Math.round(t);var e=this.rowSpan;e!==t&&(1>t&&me(t,">= 1",at,"rowSpan"),en(this),this.A.Bi=t,this.v(),this.g("rowSpan",e,t))}},spanAllocation:{get:function(){return this.A!==null?this.A.Di:null},set:function(t){var e=this.spanAllocation;e!==t&&(en(this),this.A.Di=t,this.v(),this.g("spanAllocation",e,t))}},alignmentFocus:{get:function(){return this.sk},set:function(t){var e=this.sk;e.D(t)||(this.sk=t=t.J(),this.v(),this.g("alignmentFocus",e,t))}},portId:{get:function(){return this.Yn},set:function(t){var e=this.Yn;if(e!==t){var i=this.part;i===null||i instanceof Le||lt("Cannot set portID on a Link: "+t),e!==null&&i!==null&&uy(i,this),this.Yn=t,t!==null&&i!==null&&(i.Te=!0,ly(i,this)),this.g("portId",e,t)}}},toSpot:{get:function(){return this.ba!==null?this.ba.yj:Nn},set:function(t){var e=this.toSpot;e.D(t)||(t=t.J(),this.Xc(),this.ba.yj=t,this.g("toSpot",e,t),ed(this))}},toEndSegmentLength:{get:function(){return this.ba!==null?this.ba.wj:10},set:function(t){var e=this.toEndSegmentLength;e!==t&&(0>t&&me(t,">= 0",at,"toEndSegmentLength"),this.Xc(),this.ba.wj=t,this.g("toEndSegmentLength",e,t),ed(this))}},toShortLength:{get:function(){return this.ba!==null?this.ba.xj:0},set:function(t){var e=this.toShortLength;e!==t&&(this.Xc(),this.ba.xj=t,this.g("toShortLength",e,t),ed(this))}},toLinkable:{get:function(){return this.ba!==null?this.ba.Tr:null},set:function(t){var e=this.toLinkable;e!==t&&(this.Xc(),this.ba.Tr=t,this.g("toLinkable",e,t))}},toMaxLinks:{get:function(){return this.ba!==null?this.ba.Ur:1/0},set:function(t){var e=this.toMaxLinks;e!==t&&(0>t&&me(t,">= 0",at,"toMaxLinks"),this.Xc(),this.ba.Ur=t,this.g("toMaxLinks",e,t))}},fromSpot:{get:function(){return this.ba!==null?this.ba.Xi:Nn},set:function(t){var e=this.fromSpot;e.D(t)||(t=t.J(),this.Xc(),this.ba.Xi=t,this.g("fromSpot",e,t),ed(this))}},fromEndSegmentLength:{get:function(){return this.ba!==null?this.ba.Vi:10},set:function(t){var e=this.fromEndSegmentLength;e!==t&&(0>t&&me(t,">= 0",at,"fromEndSegmentLength"),this.Xc(),this.ba.Vi=t,this.g("fromEndSegmentLength",e,t),ed(this))}},fromShortLength:{get:function(){return this.ba!==null?this.ba.Wi:0},set:function(t){var e=this.fromShortLength;e!==t&&(this.Xc(),this.ba.Wi=t,this.g("fromShortLength",e,t),ed(this))}},fromLinkable:{get:function(){return this.ba!==null?this.ba.hq:null},set:function(t){var e=this.fromLinkable;e!==t&&(this.Xc(),this.ba.hq=t,this.g("fromLinkable",e,t))}},fromMaxLinks:{get:function(){return this.ba!==null?this.ba.iq:1/0},set:function(t){var e=this.fromMaxLinks;e!==t&&(0>t&&me(t,">= 0",at,"fromMaxLinks"),this.Xc(),this.ba.iq=t,this.g("fromMaxLinks",e,t))}},cursor:{get:function(){return this.A!==null?this.A.j:""},set:function(t){var e=this.cursor;e!==t&&(en(this),this.A.j=t,this.g("cursor",e,t))}},click:{get:function(){return this.A!==null?this.A.zh:null},set:function(t){var e=this.click;e!==t&&(en(this),this.A.zh=t,this.g("click",e,t))}},doubleClick:{get:function(){return this.A!==null?this.A.Fh:null},set:function(t){var e=this.doubleClick;e!==t&&(en(this),this.A.Fh=t,this.g("doubleClick",e,t))}},contextClick:{get:function(){return this.A!==null?this.A.Bh:null},set:function(t){var e=this.contextClick;e!==t&&(en(this),this.A.Bh=t,this.g("contextClick",e,t))}},mouseEnter:{get:function(){return this.A!==null?this.A.Mh:null},set:function(t){var e=this.mouseEnter;e!==t&&(en(this),this.A.Mh=t,this.g("mouseEnter",e,t))}},mouseLeave:{get:function(){return this.A!==null?this.A.Ph:null},set:function(t){var e=this.mouseLeave;e!==t&&(en(this),this.A.Ph=t,this.g("mouseLeave",e,t))}},mouseOver:{get:function(){return this.A!==null?this.A.Qh:null},set:function(t){var e=this.mouseOver;e!==t&&(en(this),this.A.Qh=t,this.g("mouseOver",e,t))}},mouseHover:{get:function(){return this.A!==null?this.A.Oh:null},set:function(t){var e=this.mouseHover;e!==t&&(en(this),this.A.Oh=t,this.g("mouseHover",e,t))}},mouseHold:{get:function(){return this.A!==null?this.A.Nh:null},set:function(t){var e=this.mouseHold;e!==t&&(en(this),this.A.Nh=t,this.g("mouseHold",e,t))}},mouseDragEnter:{get:function(){return this.A!==null?this.A.Of:null},set:function(t){var e=this.mouseDragEnter;e!==t&&(en(this),this.A.Of=t,this.g("mouseDragEnter",e,t))}},mouseDragLeave:{get:function(){return this.A!==null?this.A.Xd:null},set:function(t){var e=this.mouseDragLeave;e!==t&&(en(this),this.A.Xd=t,this.g("mouseDragLeave",e,t))}},mouseDrop:{get:function(){return this.A!==null?this.A.Lh:null},set:function(t){var e=this.mouseDrop;e!==t&&(en(this),this.A.Lh=t,this.g("mouseDrop",e,t))}},actionDown:{get:function(){return this.A!==null?this.A.V:null},set:function(t){var e=this.actionDown;e!==t&&(en(this),this.A.V=t,this.g("actionDown",e,t))}},actionMove:{get:function(){return this.A!==null?this.A.ia:null},set:function(t){var e=this.actionMove;e!==t&&(en(this),this.A.ia=t,this.g("actionMove",e,t))}},actionUp:{get:function(){return this.A!==null?this.A.Ha:null},set:function(t){var e=this.actionUp;e!==t&&(en(this),this.A.Ha=t,this.g("actionUp",e,t))}},actionCancel:{get:function(){return this.A!==null?this.A.F:null},set:function(t){var e=this.actionCancel;e!==t&&(en(this),this.A.F=t,this.g("actionCancel",e,t))}},toolTip:{get:function(){return this.A!==null?this.A.$h:null},set:function(t){var e=this.toolTip;e!==t&&(en(this),this.A.$h=t,this.g("toolTip",e,t))}},contextMenu:{get:function(){return this.A!==null?this.A.Ch:null},set:function(t){var e=this.contextMenu;e!==t&&(en(this),this.A.Ch=t,this.g("contextMenu",e,t))}}}),at.prototype.trigger=at.prototype.Jv,at.prototype.findBindingPanel=at.prototype.ih,at.prototype.findTemplateBinder=at.prototype.pz,at.prototype.setProperties=at.prototype.nm,at.prototype.apply=at.prototype.apply,at.prototype.attach=at.prototype.Du,at.prototype.set=at.prototype.set,at.prototype.isEnabledObject=at.prototype.If,at.prototype.isVisibleObject=at.prototype.Ed,at.prototype.isContainedBy=at.prototype.rg,at.prototype.getNearestIntersectionPoint=at.prototype.rs,at.prototype.getLocalPoint=at.prototype.qs,at.prototype.getDocumentScale=at.prototype.Df,at.prototype.getDocumentAngle=at.prototype.li,at.prototype.getDocumentBounds=at.prototype.mi,at.prototype.getDocumentPoint=at.prototype.ga,at.prototype.intersectsRect=at.prototype.Yc,at.prototype.containedInRect=at.prototype.fh,at.prototype.containsRect=at.prototype.Re,at.prototype.containsPoint=at.prototype.ca,at.prototype.raiseChanged=at.prototype.g,at.prototype.raiseChangedEvent=at.prototype.cb,at.prototype.addCopyProperty=at.prototype.Vw;var Xf=null;at.className="GraphObject",Xf=new pe,id("Button",function(){function t(i,n){return i.diagram.ic(i.documentPoint,function(s){for(;s.panel!==null&&!s.isActionable;)s=s.panel;return s},function(s){return s===n})!==null}var e=fi(ne,ne.Auto,{isActionable:!0,enabledChanged:function(i,n){if(i instanceof ne){var s=i.fb("ButtonBorder");s!==null&&(s.fill=n?i._buttonFillNormal:i._buttonFillDisabled)}},cursor:"pointer",_buttonFillNormal:"#F5F5F5",_buttonStrokeNormal:"#BDBDBD",_buttonFillOver:"#E0E0E0",_buttonStrokeOver:"#9E9E9E",_buttonFillPressed:"#BDBDBD",_buttonStrokePressed:"#9E9E9E",_buttonFillDisabled:"#E5E5E5"},fi(Xi,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new Ze(0,0,2.76142374915397,2.761423749153969),spot2:new Ze(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));return e.mouseEnter=function(i,n){if(n.If()&&n instanceof ne&&(i=n.fb("ButtonBorder"),i instanceof Xi)){var s=n._buttonFillOver;n._buttonFillNormal=i.fill,i.fill=s,s=n._buttonStrokeOver,n._buttonStrokeNormal=i.stroke,i.stroke=s}},e.mouseLeave=function(i,n){n.If()&&n instanceof ne&&(i=n.fb("ButtonBorder"),i instanceof Xi&&(i.fill=n._buttonFillNormal,i.stroke=n._buttonStrokeNormal))},e.actionDown=function(i,n){if(n.If()&&n instanceof ne&&n._buttonFillPressed!==null&&i.button===0){var s=n.fb("ButtonBorder");if(s instanceof Xi){i=i.diagram;var a=i.skipsUndoManager;i.skipsUndoManager=!0;var l=n._buttonFillPressed;n._buttonFillOver=s.fill,s.fill=l,l=n._buttonStrokePressed,n._buttonStrokeOver=s.stroke,s.stroke=l,i.skipsUndoManager=a}}},e.actionUp=function(i,n){if(n.If()&&n instanceof ne&&n._buttonFillPressed!==null&&i.button===0){var s=n.fb("ButtonBorder");if(s instanceof Xi){var a=i.diagram,l=a.skipsUndoManager;a.skipsUndoManager=!0,t(i,n)?(s.fill=n._buttonFillOver,s.stroke=n._buttonStrokeOver):(s.fill=n._buttonFillNormal,s.stroke=n._buttonStrokeNormal),a.skipsUndoManager=l}}},e.actionCancel=function(i,n){if(n.If()&&n instanceof ne&&n._buttonFillPressed!==null){var s=n.fb("ButtonBorder");if(s instanceof Xi){var a=i.diagram,l=a.skipsUndoManager;a.skipsUndoManager=!0,t(i,n)?(s.fill=n._buttonFillOver,s.stroke=n._buttonStrokeOver):(s.fill=n._buttonFillNormal,s.stroke=n._buttonStrokeNormal),a.skipsUndoManager=l}}},e.actionMove=function(i,n){if(n.If()&&n instanceof ne&&n._buttonFillPressed!==null){var s=i.diagram;if(s.firstInput.button===0&&(s.currentTool.standardMouseOver(),t(i,n)&&(i=n.fb("ButtonBorder"),i instanceof Xi))){var a=s.skipsUndoManager;s.skipsUndoManager=!0;var l=n._buttonFillPressed;i.fill!==l&&(i.fill=l),l=n._buttonStrokePressed,i.stroke!==l&&(i.stroke=l),s.skipsUndoManager=a}}},e}),id("TreeExpanderButton",function(){var t=fi("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},fi(Xi,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:br},new Un("figure","isTreeExpanded",function(e,i){return i=i.panel,e?i._treeExpandedFigure:i._treeCollapsedFigure}).cp()),{visible:!1},new Un("visible","isTreeLeaf",function(e){return!e}).cp());return t.click=function(e,i){if(i=i.part,i instanceof Cn&&(i=i.adornedPart),i instanceof Le){var n=i.diagram;if(n!==null){if(n=n.commandHandler,i.isTreeExpanded){if(!n.canCollapseTree(i))return}else if(!n.canExpandTree(i))return;e.handled=!0,i.isTreeExpanded?n.collapseTree(i):n.expandTree(i)}}},t}),id("SubGraphExpanderButton",function(){var t=fi("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},fi(Xi,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:br},new Un("figure","isSubGraphExpanded",function(e,i){return i=i.panel,e?i._subGraphExpandedFigure:i._subGraphCollapsedFigure}).cp()));return t.click=function(e,i){if(i=i.part,i instanceof Cn&&(i=i.adornedPart),i instanceof ji){var n=i.diagram;if(n!==null){if(n=n.commandHandler,i.isSubGraphExpanded){if(!n.canCollapseSubGraph(i))return}else if(!n.canExpandSubGraph(i))return;e.handled=!0,i.isSubGraphExpanded?n.collapseSubGraph(i):n.expandSubGraph(i)}}},t}),id("ToolTip",function(){return fi(Cn,ne.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new z(0,3),shadowBlur:5},fi(Xi,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new Ze(0,0,4,6),spot2:new Ze(1,1,-4,-4)}))}),id("ContextMenu",function(){return fi(Cn,ne.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new z(0,3),shadowBlur:5},new Un("background","",function(t){return t.adornedPart!==null&&t.placeholder!==null?null:"#F5F5F5"}))}),id("ContextMenuButton",function(){var t=fi("Button");t.stretch=si;var e=t.fb("ButtonBorder");return e instanceof Xi&&(e.figure="Rectangle",e.strokeWidth=0,e.spot1=new Ze(0,0,2,3),e.spot2=new Ze(1,1,-2,-2)),t}),id("PanelExpanderButton",function(t){var e=zv(t,"COLLAPSIBLE"),i=fi("Button",{_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8",_buttonFillNormal:"rgba(0, 0, 0, 0)",_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null,_buttonFillPressed:"rgba(0, 0, 0, .4)",_buttonStrokePressed:null},fi(Xi,{name:"ButtonIcon",strokeWidth:2},new Un("geometryString","visible",function(n){return n?i._buttonExpandedFigure:i._buttonCollapsedFigure}).cp(e)));return t=i.fb("ButtonBorder"),t instanceof Xi&&(t.stroke=null,t.fill="rgba(0, 0, 0, 0)"),i.click=function(n,s){var a=s.diagram;if(a!==null&&!a.isReadOnly){var l=s.ih();l===null&&(l=s.part),l!==null&&(s=l.fb(e),s!==null&&(n.handled=!0,a.Ea("Collapse/Expand Panel"),s.visible=!s.visible,a.eb("Collapse/Expand Panel")))}},i}),id("CheckBoxButton",function(t){var e=zv(t);return t=fi("Button",{desiredSize:new ii(14,14)},fi(Xi,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:ie,geometryStretch:Ge,visible:!1},e!==""?new Un("visible",e).Kx():[])),t.click=function(i,n){if(n instanceof ne){var s=i.diagram;if(!(s===null||s.isReadOnly||e!==""&&s.model.isReadOnly)){i.handled=!0;var a=n.fb("ButtonIcon");s.Ea("checkbox"),a.visible=!a.visible,typeof n._doClick=="function"&&n._doClick(i,n),s.eb("checkbox")}}},t}),id("CheckBox",function(t){t=zv(t),t=fi("CheckBoxButton",t,{name:"Button",isActionable:!1,margin:new ai(0,1,0,0)});var e=fi(ne,"Horizontal",t,{isActionable:!0,cursor:t.cursor,margin:new ai(1),_buttonFillNormal:t._buttonFillNormal,_buttonStrokeNormal:t._buttonStrokeNormal,_buttonFillOver:t._buttonFillOver,_buttonStrokeOver:t._buttonStrokeOver,_buttonFillPressed:t._buttonFillPressed,_buttonStrokePressed:t._buttonStrokePressed,_buttonFillDisabled:t._buttonFillDisabled,mouseEnter:t.mouseEnter,mouseLeave:t.mouseLeave,actionDown:t.actionDown,actionUp:t.actionUp,actionCancel:t.actionCancel,actionMove:t.actionMove,click:t.click,_buttonClick:t.click});return t.mouseEnter=null,t.mouseLeave=null,t.actionDown=null,t.actionUp=null,t.actionCancel=null,t.actionMove=null,t.click=null,e}),at.None=Yt=new mt(at,"None",0),at.Default=Vi=new mt(at,"Default",0),at.Vertical=yi=new mt(at,"Vertical",4),at.Horizontal=si=new mt(at,"Horizontal",5),at.Fill=ie=new mt(at,"Fill",3),at.Uniform=Ge=new mt(at,"Uniform",1),at.UniformToFill=un=new mt(at,"UniformToFill",2),at.FlipVertical=qi=new mt(at,"FlipVertical",1),at.FlipHorizontal=dn=new mt(at,"FlipHorizontal",2),at.FlipBoth=Dn=new mt(at,"FlipBoth",3),at.make=fi,at.getBuilders=function(){var t=new pe,e;for(e in Xf)if(e!==e.toLowerCase()){var i=Xf.I(e);typeof i=="function"&&t.add(e,i)}return t.freeze(),t},at.defineBuilder=id,at.build=function(t,e,i){for(var n=[],s=2;s<arguments.length;++s)n[s-2]=arguments[s];if(s=Xf.I(t),typeof s=="function"&&(n=s([t].concat(n)),n instanceof at))return e&&n.set(e),n;lt('GraphObject.build invoked object builder "'+t+'", but it did not return an Object')},at.takeBuilderArgument=zv;function Kd(){this.nc=!1,this.xa="",this.zp=-1,this.nb=this.wm=this.te=null,this.j="",this.hb=this.Di=this.Hb=this.Ch=this.$h=this.F=this.Ha=this.ia=this.V=this.Lh=this.Xd=this.Of=this.Nh=this.Oh=this.Qh=this.Ph=this.Mh=this.Bh=this.Fh=this.zh=null,this.u=xr,this.o=ds,this.hg=Vi,this.ob=this.Bi=1,this.Pf=Yt,this.Pc=this.Ci=this.gd=null,this.Oc="category"}Kd.prototype.copy=function(){var t=new Kd;return t.xa=this.xa,t.zp=this.zp,t.te=this.te,t.nb=this.nb,t.j=this.j,t.zh=this.zh,t.Fh=this.Fh,t.Bh=this.Bh,t.Mh=this.Mh,t.Ph=this.Ph,t.Qh=this.Qh,t.Oh=this.Oh,t.Nh=this.Nh,t.Of=this.Of,t.Xd=this.Xd,t.Lh=this.Lh,t.V=this.V,t.ia=this.ia,t.Ha=this.Ha,t.F=this.F,t.$h=this.$h,t.Ch=this.Ch,t.Hb=this.Hb,t.Di=this.Di,t.hb=this.hb,t.u=this.u.J(),t.o=this.o.J(),t.hg=this.hg,t.Bi=this.Bi,t.ob=this.ob,t.Pf=this.Pf,t.gd=this.gd,t.Ci=this.Ci,t.Pc=this.Pc,t.Oc=this.Oc,t};function Eu(){this.u=-1/0,this.o=0,this.F=fn,this.rr=ea,this.j=this.V="None"}Eu.prototype.copy=function(){var t=new Eu;return t.u=this.u,t.o=this.o,t.F=this.F.J(),t.rr=this.rr,t.V=this.V,t.j=this.j,t},Eu.className="LinkElementSettings";function Hd(){this.yj=this.Xi=zn,this.xj=this.Wi=this.wj=this.Vi=NaN,this.Tr=this.hq=null,this.Ur=this.iq=1/0}Hd.prototype.copy=function(){var t=new Hd;return t.Xi=this.Xi.J(),t.yj=this.yj.J(),t.Vi=this.Vi,t.wj=this.wj,t.Wi=this.Wi,t.xj=this.xj,t.hq=this.hq,t.Tr=this.Tr,t.iq=this.iq,t.Ur=this.Ur,t},Hd.className="LinkSettings";function Vd(){this.ha=[1,0,0,1,0,0]}Vd.prototype.copy=function(){var t=new Vd;return t.ha[0]=this.ha[0],t.ha[1]=this.ha[1],t.ha[2]=this.ha[2],t.ha[3]=this.ha[3],t.ha[4]=this.ha[4],t.ha[5]=this.ha[5],t},Vd.prototype.translate=function(t,e){this.ha[4]+=this.ha[0]*t+this.ha[2]*e,this.ha[5]+=this.ha[1]*t+this.ha[3]*e},Vd.prototype.scale=function(t,e){this.ha[0]*=t,this.ha[1]*=t,this.ha[2]*=e,this.ha[3]*=e},Vd.prototype.rotate=function(t,e,i){if(360<=t?t-=360:0>t&&(t+=360),t!==0){if(this.translate(e,i),t===90){t=0;var n=1}else t===180?(t=-1,n=0):t===270?(t=0,n=-1):(n=t*Math.PI/180,t=Math.cos(n),n=Math.sin(n));var s=this.ha[1]*t+this.ha[3]*n,a=this.ha[0]*-n+this.ha[2]*t,l=this.ha[1]*-n+this.ha[3]*t;this.ha[0]=this.ha[0]*t+this.ha[2]*n,this.ha[1]=s,this.ha[2]=a,this.ha[3]=l,this.translate(-e,-i)}},Vd.className="STransform";function Yf(t){this.type=t,this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0,this.gx=[],this.pattern=null}Yf.prototype.addColorStop=function(t,e){this.gx.push({offset:t,color:e})},Yf.className="SGradient";function su(t,e,i){this.ownerDocument=t=e===void 0?Z.document:e,this.cA="http://www.w3.org/2000/svg",t!==void 0&&(this.Oa=this.Ud("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.style.display="block",this.style.letterSpacing="normal",this.style.wordSpacing="normal",this.Oa.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Oa.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink")),this.hs=null,this.context=new Bs(this,i)}su.prototype.resize=function(t,e,i,n){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=n+"px",this.Oa.setAttributeNS(null,"width",i+"px"),this.Oa.setAttributeNS(null,"height",n+"px"),this.Oa.setAttributeNS(null,"viewBox","0 0 "+i+" "+n),this.context.ww.firstElementChild.setAttributeNS(null,"width",i+"px"),this.context.ww.firstElementChild.setAttributeNS(null,"height",n+"px"),!0):!1},su.prototype.Ud=function(t,e,i){if(t=this.ownerDocument.createElementNS(this.cA,t),Tt(e))for(var n in e)t.setAttributeNS(n==="href"?"http://www.w3.org/1999/xlink":"",n,e[n]);return i!==void 0&&(t.textContent=i),t},su.prototype.getBoundingClientRect=function(){return this.Oa.getBoundingClientRect()},su.prototype.focus=function(){this.Oa.focus()},su.prototype.mx=function(){this.ownerDocument=null},ct.Object.defineProperties(su.prototype,{width:{get:function(){return this.Oa.width.baseVal.value},set:function(t){this.Oa.setAttribute("width",t+"px")}},height:{get:function(){return this.Oa.height.baseVal.value},set:function(t){this.Oa.setAttribute("height",t+"px")}},style:{get:function(){return this.Oa.style}}}),su.className="SVGSurface";function Bs(t,e){this.Gv=t,this.svg=t.Oa,this.stack=[],this.nh=[],this.fillStyle="#000000",this.font="10px sans-serif",this.globalAlpha=1,this.lineCap="butt",this.lineDashOffset=0,this.lineJoin="miter",this.lineWidth=1,this.miterLimit=10,this.shadowBlur=0,this.shadowColor="rgba(0, 0, 0, 0)",this.shadowOffsetY=this.shadowOffsetX=0,this.Il=!1,this.strokeStyle="#000000",this.textAlign="start",this.clipInsteadOfFill=!1,this.Vg=this.Br=this.Ar=0,this.yd=this.ad=null,this.path=[],this.Yl={},this.Ct=!1,this.Yg=null,this.uj=0,this.rb=new Vd,this.j=Mg(this),this.Nj=Mg(this,"gojs-diagram"),this.Hl=this.ti=null;var i=gn++,n=this.Ud("clipPath",{id:"mainClip"+i});n.appendChild(this.Ud("rect",{x:0,y:0,width:t.width,height:t.height})),this.ww=n,this.svg.appendChild(this.j),this.j.appendChild(this.Nj),this.svg.appendChild(n),this.j.setAttributeNS(null,"clip-path","url(#mainClip"+i+")"),this.eA={},this.isTemporary=!!e,this.filter="",this.bk=null}function Ea(t,e,i,n,s,a,l){t.Nj===void 0?Jp(t,e,i,n,s,a,l):t.Nj.setAttribute("transform","matrix("+e+", "+i+", "+n+", "+s+", "+a+", "+l+")")}T=Bs.prototype,T.arc=function(t,e,i,n,s,a,l,c){var f=2*Math.PI,m=f-1e-6,v=i*Math.cos(n),w=i*Math.sin(n),C=t+v,k=e+w,L=a?0:1;n=a?n-s:s-n,(1e-6<Math.abs(l-C)||1e-6<Math.abs(c-k))&&this.path.push(["L",C,+k]),0>n&&(n=n%f+f),n>m?(this.path.push(["A",i,i,0,1,L,t-v,e-w]),this.path.push(["A",i,i,0,1,L,C,k])):1e-6<n&&this.path.push(["A",i,i,0,+(n>=Math.PI),L,t+i*Math.cos(s),e+i*Math.sin(s)])},T.beginPath=function(){this.path=[],this.Yl={stroke:"none",fill:"none"}},T.Se=function(t){this.addPath(this.path,this.rb,t||0)},T.bezierCurveTo=function(t,e,i,n,s,a){this.path.push(["C",t,e,i,n,s,a])},T.clearRect=function(){},T.clip=function(){this.Yl.clipPath=!0},T.closePath=function(){this.path.push(["z"])},T.createLinearGradient=function(t,e,i,n){var s=new Yf("linear");return s.x1=t,s.y1=e,s.x2=i,s.y2=n,s},T.createPattern=function(t){var e="";t instanceof HTMLCanvasElement&&(e=t.toDataURL()),t instanceof HTMLImageElement&&(e=t.getAttribute("src"));var i=this.eA;if(i[e])return"url(#"+i[e]+")";var n="PATTERN"+gn++,s={x:0,y:0,width:t.width,height:t.height,href:e};return t=this.Ud("pattern",{width:t.width,height:t.height,id:n,patternUnits:"userSpaceOnUse"}),t.appendChild(this.Ud(jd,s)),this.svg.appendChild(t),i[e]=n,"url(#"+n+")"},T.createRadialGradient=function(t,e,i,n,s,a){var l=new Yf("radial");return l.x1=t,l.y1=e,l.r1=i,l.x2=n,l.y2=s,l.r2=a,l};function Xp(t,e,i,n,s,a,l,c,f){n=c/n,s=f/s,a===0&&l===0||t.rb.translate(a,l),n===1&&s===1||t.rb.scale(n,s),e===0&&i===0||t.rb.translate(-e,-i)}T.drawImage=function(t,e,i,n,s,a,l,c,f){var m="";t instanceof HTMLCanvasElement&&(m=t.toDataURL()),t instanceof HTMLImageElement&&(m=t.getAttribute("src"));var v=t instanceof HTMLImageElement?t.naturalWidth:t.width;t=t instanceof HTMLImageElement?t.naturalHeight:t.height,n===void 0&&(a=e,l=i,c=n=v,f=s=t),n=n||0,s=s||0,c=c||0,f=f||0,Xp(this,e,i,n,s,a||0,l||0,c,f),a={x:0,y:0,width:v||n,height:t||s,href:m},ht.$(n,c)&&ht.$(s,f)?m.toLowerCase().indexOf(".svg")===-1&&m.toLowerCase().indexOf("data:image/svg")===-1&&(a.preserveAspectRatio="xMidYMid slice"):a.preserveAspectRatio="none",(e!==0||i!==0||n!==v||s!==t)&&(n+=e,s+=i,a["clip-path"]="path('M "+e+","+i+" L "+n+" "+i+" L "+n+" "+s+" L "+e+" "+s+" z')"),lh(this,jd,a,this.rb),this.addElement(jd,a)},T.fill=function(t){t&&(this.Yl["fill-rule"]="evenodd"),au(this,this.Yl)},T.ng=function(t,e){this.clipInsteadOfFill?this.clip():this.fill(e)},T.fillRect=function(t,e,i,n){t=[t,e,i,n],t={x:t[0],y:t[1],width:t[2],height:t[3]},lh(this,"fill",t,this.rb),this.addElement("rect",t)},T.ox=function(t,e,i,n){t={x:t,y:e,width:i,height:n},lh(this,"fill",t,this.rb),au(this,t),this.svg.prepend(this.Ud("rect",t))},T.fillText=function(t,e,i){t=[t,e,i],e=this.textAlign,e==="left"?e="start":e==="right"?e="end":e==="center"&&(e="middle"),e={x:t[1],y:t[2],style:"font: "+this.font,"text-anchor":e},lh(this,"fill",e,this.rb),this.addElement("text",e,t[0])},T.lineTo=function(t,e){this.path.push(["L",t,e])},T.moveTo=function(t,e){this.path.push(["M",t,e])},T.quadraticCurveTo=function(t,e,i,n){this.path.push(["Q",t,e,i,n])},T.rect=function(t,e,i,n){this.path.push(["M",t,e],["L",t+i,e],["L",t+i,e+n],["L",t,e+n],["z"])},T.restore=function(){this.rb=this.stack.pop(),this.path=this.stack.pop();var t=this.stack.pop();this.fillStyle=t.fillStyle,this.font=t.font,this.globalAlpha=t.globalAlpha,this.lineCap=t.lineCap,this.lineDashOffset=t.lineDashOffset,this.lineJoin=t.lineJoin,this.lineWidth=t.lineWidth,this.miterLimit=t.miterLimit,this.shadowBlur=t.shadowBlur,this.shadowColor=t.shadowColor,this.shadowOffsetX=t.shadowOffsetX,this.shadowOffsetY=t.shadowOffsetY,this.strokeStyle=t.strokeStyle,this.textAlign=t.textAlign,this.bk=t.bk},T.save=function(){this.stack.push({fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign,bk:this.bk});for(var t=[],e=0;e<this.path.length;e++)t.push(this.path[e]);this.stack.push(t),this.stack.push(this.rb.copy())},T.setTransform=function(t,e,i,n,s,a){t===1&&e===0&&i===0&&n===1&&s===0&&a===0||Jp(this,t,e,i,n,s,a)};function Sg(t){return t=t.rb.ha,"matrix("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}T.scale=function(t,e){this.rb.scale(t,e)},T.translate=function(t,e){this.rb.translate(t,e)},T.transform=function(){},T.yc=function(){},T.stroke=function(){Yp(this,this.Yl)},T.jk=function(){this.clipInsteadOfFill||this.stroke()},T.Ud=function(t,e,i){return this.Gv.Ud(t,e,i)},T.addElement=function(t,e,i){return t=this.Ud(t,e,i),this.yd!==null?this.yd.appendChild(t):this.yd=t,this.ad=t};function lh(t,e,i,n){e==="fill"?au(t,i):e==="stroke"&&Yp(t,i),n!==null&&(t=n.ha,i.transform="matrix("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")")}function au(t,e){t.fillStyle instanceof Yf?e.fill=Jf(t,t.fillStyle,!0):/^rgba\(/.test(t.fillStyle)?(t=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(t.fillStyle),e.fill="rgb("+t[1]+","+t[2]+","+t[3]+")",e["fill-opacity"]=t[4]):e.fill=t.fillStyle}function Xy(t,e,i){i=i?"fill":"stroke",t.fillStyle instanceof Yf?e.setAttributeNS(null,"fill",Jf(t,t.fillStyle,!0)):/^rgba\(/.test(t.fillStyle)?(t=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(t.fillStyle),e.setAttributeNS(null,i,"rgb("+t[1]+","+t[2]+","+t[3]+")"),e.setAttributeNS(null,i+"-opacity",t[4])):e.setAttributeNS(null,i,t.fillStyle)}function Yp(t,e){if(t.strokeStyle instanceof Yf)e.stroke=Jf(t,t.strokeStyle,!1);else if(/^rgba\(/.test(t.strokeStyle)){var i=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(t.strokeStyle);e.stroke="rgb("+i[1]+","+i[2]+","+i[3]+")",e["stroke-opacity"]=i[4]}else e.stroke=t.strokeStyle;e["stroke-width"]=t.lineWidth,e["stroke-linecap"]=t.lineCap,e["stroke-linejoin"]=t.lineJoin,e["stroke-miterlimit"]=t.miterLimit,t.Ct&&(e["stroke-dasharray"]=t.Yg.toString(),e["stroke-dashoffset"]=t.uj)}function Jf(t,e,i){var n="";if(n=t.Hl!==null?t.Hl.getAttribute(i?"fill":"stroke"):null,n!==null&&n.indexOf("GRAD")!==-1?(n=n.split("#")[1].slice(0,-1),i=t.svg.getElementById(n),i!==null&&i.remove()):n="GRAD"+gn++,e.type==="linear")i=t.Ud("linearGradient",{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,id:n,gradientUnits:"userSpaceOnUse"});else if(e.type==="radial")i=t.Ud("radialGradient",{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,r1:e.r1,r2:e.r2,id:n});else throw Error("invalid gradient");var s=e.gx;e=s.length;for(var a=[],l=0;l<e;l++){var c=s[l],f=c.color;c={offset:c.offset,"stop-color":f},/^rgba\(/.test(f)&&(f=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(f),c["stop-color"]="rgb("+f[1]+","+f[2]+","+f[3]+")",c["stop-opacity"]=f[4]),a.push(c)}for(a.sort(function(m,v){return m.offset>v.offset?1:-1}),s=0;s<e;s++)i.appendChild(t.Ud("stop",a[s]));return t.svg.appendChild(i),"url(#"+n+")"}T.addPath=function(t,e,i){for(var n=[],s=0;s<t.length;s++){var a=bi(t[s]),l=[a.shift()];if(l[0]==="A")l.push(a.shift()+","+a.shift(),a.shift(),a.shift()+","+a.shift(),a.shift()+","+a.shift());else for(;a.length;)l.push(a.shift()+","+a.shift());n.push(l.join(" "))}if(n=n.join(" "),t=this.Yl,t.clipPath)0<this.nh.length&&this.nh[this.nh.length-1].setAttributeNS(null,"clip-path",'path("'+n+'")');else if(t.d=n,lh(this,"",t,e),this.Hl!==null)if(e=this.Hl,e.nodeName!=="g")for(var c in t)c!=="transform"&&e.setAttributeNS(null,c,t[c]);else{c=e.getElementsByTagName("path");for(var f in t)f!=="transform"&&c[i].setAttributeNS(null,f,t[f])}else this.addElement("path",t)};function Jp(t,e,i,n,s,a,l){var c=new Vd;c.ha=[e,i,n,s,a,l],e={},lh(t,"g",e,c),c=t.addElement("g",e),t.nh.push(c)}function Mg(t,e){var i={};return e&&(i.class=e),e=t.addElement("g",i),t.nh.push(e),e}T.Ev=function(t,e,i){this.Ar=t,this.Br=e,this.Vg=i};function Vl(t){t.Il=!1,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0}function zh(t){t.Il=!0,t.shadowOffsetX=t.Ar,t.shadowOffsetY=t.Br,t.shadowBlur=t.Vg}T.js=function(t,e){this.Ct=!0,this.Yg=t,this.uj=e},T.fs=function(){this.Ct=!1},T.Vc=function(){},T.Wx=function(){},Bs.prototype.rotate=function(t){this.rb.rotate(57.2958*t,0,0)},Bs.prototype.getImageData=function(){return null},Bs.prototype.measureText=function(){return null};function Cg(t,e){e=e.getAttribute("fill"),e!==null&&(e=e.split("#"),e.length!==1&&(e=t.svg.getElementById(e[1].slice(0,-1)),e!==null&&t.svg.innerHTML.match(new RegExp(e.id,"g")).length===1&&e.remove()))}Bs.prototype.Hs=function(t){t.svg!==null&&t.svg.parentNode===this.Nj&&t.svg.remove()},Bs.className="SVGContext",wt.prototype.Cs=function(t){this.pj.contains("SVG")||this.bs("SVG",new su(this,Z.document));var e=new su(this,Z.document,!0);t===void 0&&(t=new ci);var i=this;return Uf(this,function(n,s){return n=wg(i,n,"SVG",e),n=n!==null?n.svg:null,typeof s=="function"?(s(n),null):n},t)},wt.prototype.makeSvg=wt.prototype.Cs,wt.prototype.av=function(t){return this.Cs(t)},wt.prototype.makeSVG=wt.prototype.av;function Tl(t,e,i,n){this.ownerDocument=e=e===void 0?Z.document:e,this.hs=null,e=e.createElement("canvas"),e.tabIndex=0,this.Oa=e,this.context=new uh(e,i,n),e.H=t}Tl.prototype.resize=function(t,e,i,n){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=n+"px",!0):!1},Tl.prototype.toDataURL=function(t,e){return this.Oa.toDataURL(t,e)},Tl.prototype.getBoundingClientRect=function(){return this.Oa.getBoundingClientRect()},Tl.prototype.focus=function(){this.Oa.focus()},Tl.prototype.mx=function(){this.ownerDocument=this.Oa.H=null},ct.Object.defineProperties(Tl.prototype,{width:{get:function(){return this.Oa.width},set:function(t){this.Oa.width=t}},height:{get:function(){return this.Oa.height},set:function(t){this.Oa.height=t}},style:{get:function(){return this.Oa.style}}}),Tl.className="CanvasSurface";function uh(t,e,i){this.Z=t.getContext?t.getContext("2d",e):null,this.Z===null&&lt("Browser does not support HTML Canvas Element"),this.ct=this.et=this.dt="",this.Hm=!1,this.Vg=this.Br=this.Ar=0,this.Il=!1,this.El=new nn,this.isTemporary=!!i}T=uh.prototype,T.Wx=function(t){this.Z.imageSmoothingEnabled=t},T.arc=function(t,e,i,n,s,a){this.Z.arc(t,e,i,n,s,a)},T.beginPath=function(){this.Z.beginPath()},T.Se=function(){},T.bezierCurveTo=function(t,e,i,n,s,a){this.Z.bezierCurveTo(t,e,i,n,s,a)},T.clearRect=function(t,e,i,n){this.yc(),this.Z.clearRect(t,e,i,n)},T.clip=function(){this.Z.clip()},T.closePath=function(){this.Z.closePath()},T.createLinearGradient=function(t,e,i,n){return this.Z.createLinearGradient(t,e,i,n)},T.createPattern=function(t,e){return this.Z.createPattern(t,e)},T.createRadialGradient=function(t,e,i,n,s,a){return this.Z.createRadialGradient(t,e,i,n,s,a)},T.drawImage=function(t,e,i,n,s,a,l,c,f){n===void 0?this.Z.drawImage(t,e,i):this.Z.drawImage(t,e,i,n,s,a,l,c,f)},T.fill=function(t){this.Z.fill(t?"evenodd":"nonzero")},T.fillRect=function(t,e,i,n){this.Z.fillRect(t,e,i,n)},T.ox=function(t,e,i,n){this.Z.fillRect(t,e,i,n)},T.fillText=function(t,e,i){this.Z.fillText(t,e,i)},T.getImageData=function(t,e,i,n){return this.Z.getImageData(t,e,i,n)},T.lineTo=function(t,e){this.Z.lineTo(t,e)},T.measureText=function(t){return this.Z.measureText(t)},T.moveTo=function(t,e){this.Z.moveTo(t,e)},T.quadraticCurveTo=function(t,e,i,n){this.Z.quadraticCurveTo(t,e,i,n)},T.rect=function(t,e,i,n){this.Z.rect(t,e,i,n)},T.restore=function(){this.Z.restore()},T.save=function(){this.yc(),this.Z.save()},uh.prototype.rotate=function(t){this.El.rotate(57.2958*t,0,0)},T=uh.prototype,T.setTransform=function(t,e,i,n,s,a){this.El.setTransform(t,e,i,n,s,a)},T.scale=function(t,e){this.El.scale(t,e)},T.translate=function(t,e){this.El.translate(t,e)},T.stroke=function(){this.Z.stroke()},T.transform=function(t,e,i,n,s,a){if(t!==1||e!==0||i!==0||n!==1||s!==0||a!==0){var l=this.El,c=l.m11*t+l.m21*e;t=l.m12*t+l.m22*e,e=l.m11*i+l.m21*n,i=l.m12*i+l.m22*n,l.dx=l.m11*s+l.m21*a+l.dx,l.dy=l.m12*s+l.m22*a+l.dy,l.m11=c,l.m12=t,l.m21=e,l.m22=i}},T.yc=function(){var t=this.El;this.Z.setTransform(t.m11,t.m12,t.m21,t.m22,t.dx,t.dy)},T.ng=function(t,e){if(t instanceof Tn&&t.type===fl){var i=t.yk;t=t.ft,t>i?(this.scale(i/t,1),this.translate((t-i)/2,0)):i>t&&(this.scale(1,t/i),this.translate(0,(i-t)/2)),this.Hm?this.clip():this.fill(e),t>i?(this.translate(-(t-i)/2,0),this.scale(1/(i/t),1)):i>t&&(this.translate(0,-(i-t)/2),this.scale(1,1/(t/i)))}else this.Hm?this.clip():this.fill(e)},T.jk=function(){this.Hm||this.stroke()},T.Ev=function(t,e,i){this.Ar=t,this.Br=e,this.Vg=i},T.js=function(t,e){var i=this.Z;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=e)},T.fs=function(){var t=this.Z;t.setLineDash!==void 0&&(t.setLineDash(cm),t.lineDashOffset=0)},T.Vc=function(t){t&&(this.dt=""),this.ct=this.et=""},T.Hs=function(){},ct.Object.defineProperties(uh.prototype,{fillStyle:{get:function(){return this.Z.fillStyle},set:function(t){this.ct!==t&&(this.ct=this.Z.fillStyle=t)}},font:{get:function(){return this.Z.font},set:function(t){this.dt!==t&&(this.dt=this.Z.font=t)}},globalAlpha:{get:function(){return this.Z.globalAlpha},set:function(t){this.Z.globalAlpha=t}},lineCap:{get:function(){return this.Z.lineCap},set:function(t){this.Z.lineCap=t}},lineDashOffset:{get:function(){return this.Z.lineDashOffset},set:function(t){this.Z.lineDashOffset=t}},lineJoin:{get:function(){return this.Z.lineJoin},set:function(t){this.Z.lineJoin=t}},lineWidth:{get:function(){return this.Z.lineWidth},set:function(t){this.Z.lineWidth=t}},miterLimit:{get:function(){return this.Z.miterLimit},set:function(t){this.Z.miterLimit=t}},shadowBlur:{get:function(){return this.Z.shadowBlur},set:function(t){this.Z.shadowBlur=t}},shadowColor:{get:function(){return this.Z.shadowColor},set:function(t){this.Z.shadowColor=t}},shadowOffsetX:{get:function(){return this.Z.shadowOffsetX},set:function(t){this.Z.shadowOffsetX=t}},shadowOffsetY:{get:function(){return this.Z.shadowOffsetY},set:function(t){this.Z.shadowOffsetY=t}},strokeStyle:{get:function(){return this.Z.strokeStyle},set:function(t){this.et!==t&&(this.et=this.Z.strokeStyle=t)}},textAlign:{get:function(){return this.Z.textAlign},set:function(t){this.Z.textAlign=t}},imageSmoothingEnabled:{get:function(){return this.Z.imageSmoothingEnabled},set:function(t){this.Z.imageSmoothingEnabled=t}},filter:{get:function(){return this.Z.filter},set:function(t){this.Z.filter=t===""?"none":t}},clipInsteadOfFill:{get:function(){return this.Hm},set:function(t){this.Hm=t}}});var cm=Object.freeze([]);uh.className="CanvasSurfaceContext";function qf(){this.F=this.o=this.u=this.j=0}qf.className="ColorNumbers";function Tn(t,e){ep||(Wv(),ep=!0),vi(this),this._isFrozen=!1,t===void 0?(this.na=$h,this.xk="black"):typeof t=="string"?(this.na=$h,this.xk=t):(this.na=t,this.xk="black"),t=this.na,t===Kh?(this.Qd=Rr,this.Lk=Rs):this.Lk=t===fl?this.Qd=on:this.Qd=Nn,this.Gr=0,this.Xp=NaN,this.xe=this.cr=this.we=null,this.ft=this.yk=0,e&&Object.assign(this,e)}Tn.prototype.copy=function(){var t=new Tn;return t.na=this.na,t.xk=this.xk,t.Qd=this.Qd.J(),t.Lk=this.Lk.J(),t.Gr=this.Gr,t.Xp=this.Xp,this.we!==null&&(t.we=this.we.copy()),t.cr=this.cr,t},T=Tn.prototype,T.freeze=function(){return this._isFrozen=!0,this.we!==null&&this.we.freeze(),this},T.ka=function(){return Object.isFrozen(this)&&lt("cannot thaw constant: "+this),this._isFrozen=!1,this.we!==null&&this.we.ka(),this},T.qb=function(t){t.classType===Tn&&(this.type=t)},T.toString=function(){var t="Brush(";if(this.type===$h)t+=this.color;else if(t=this.type===Kh?t+"Linear ":this.type===fl?t+"Radial ":this.type===Qp?t+"Pattern ":t+"(unknown) ",t+=this.start+" "+this.end,this.colorStops!==null)for(var e=this.colorStops.iterator;e.next();)t+=" "+e.key+":"+e.value;return t+")"},T.addColorStop=function(t,e){return this._isFrozen&&Qt(this),(typeof t!="number"||!isFinite(t)||1<t||0>t)&&me(t,"0 <= loc <= 1",Tn,"addColorStop:loc"),this.we===null&&(this.we=new pe),this.we.add(t,e),this.na===$h&&(this.type=Kh),this.xe=null,this},T.Vz=function(t,e){if(this._isFrozen&&Qt(this),t=t===void 0||typeof t!="number"?.2:t,e=e===void 0?t0:e,this.type===$h)jh(this.color),this.color=Qf(t,e);else if((this.type===Kh||this.type===fl)&&this.colorStops!==null)for(var i=this.colorStops.iterator;i.next();)jh(i.value),this.addColorStop(i.key,Qf(t,e));return this};function nd(t,e,i){return e=e===void 0||typeof e!="number"?.2:e,i=i===void 0?t0:i,jh(t),Qf(e,i)}T.Wy=function(t,e){if(this._isFrozen&&Qt(this),t=t===void 0||typeof t!="number"?.2:t,e=e===void 0?t0:e,this.type===$h)jh(this.color),this.color=Qf(-t,e);else if((this.type===Kh||this.type===fl)&&this.colorStops!==null)for(var i=this.colorStops.iterator;i.next();)jh(i.value),this.addColorStop(i.key,Qf(-t,e));return this};function Yy(t,e,i){return e=e===void 0||typeof e!="number"?.2:e,i=i===void 0?t0:i,jh(t),Qf(-e,i)}function kg(t,e,i){jh(t),t=or.j;var n=or.u,s=or.o,a=or.F;return jh(e),i===void 0&&(i=.5),"rgba("+Math.round((or.j-t)*i+t)+", "+Math.round((or.u-n)*i+n)+", "+Math.round((or.o-s)*i+s)+", "+Math.round((or.F-a)*i+a)+")"}T.Gx=function(){if(this.type===$h)return Wd(this.color);if((this.type===Kh||this.type===fl)&&this.colorStops!==null){var t=this.colorStops;if(this.type===fl)return Wd(t.first().value);if(t.get(.5)!==null)return Wd(t.get(.5));if(t.count===2)return t=t.Fa(),Wd(kg(t[0].value,t[1].value));for(var e=t.iterator,i=-1,n=-1,s=1,a=1;e.next();){var l=e.key,c=Math.abs(.5-e.key);s>a&&c<s?(i=l,s=c):a>=s&&c<a&&(n=l,a=c)}return i>n&&(a=i,i=n,n=a,a=s),s=n-i,Wd(kg(t.get(i),t.get(n),1-a/s))}return!1};function Wd(t){return t?t instanceof Tn?t.Gx():(jh(t),128>(299*or.j+587*or.u+114*or.o)/1e3):!1}function Qf(t,e){switch(e){case t0:e=100*$v(or.j);var i=100*$v(or.u),n=100*$v(or.o);return ta.j=.4124564*e+.3575761*i+.1804375*n,ta.u=.2126729*e+.7151522*i+.072175*n,ta.o=.0193339*e+.119192*i+.9503041*n,ta.F=or.F,e=Hv(ta.j/qp[0]),i=Hv(ta.u/qp[1]),n=Hv(ta.o/qp[2]),lu.j=116*i-16,lu.u=500*(e-i),lu.o=200*(i-n),lu.F=ta.F,lu.j=Math.min(100,Math.max(0,lu.j+100*t)),t=(lu.j+16)/116,e=t-lu.o/200,ta.j=qp[0]*Vv(lu.u/500+t),ta.u=qp[1]*(lu.j>Lg*Uv?Math.pow(t,3):lu.j/Lg),ta.o=qp[2]*Vv(e),ta.F=lu.F,t=-.969266*ta.j+1.8760108*ta.u+.041556*ta.o,e=.0556434*ta.j+-.2040259*ta.u+1.0572252*ta.o,or.j=255*Kv((3.2404542*ta.j+-1.5371385*ta.u+-.4985314*ta.o)/100),or.u=255*Kv(t/100),or.o=255*Kv(e/100),or.F=ta.F,or.j=Math.round(or.j),255<or.j?or.j=255:0>or.j&&(or.j=0),or.u=Math.round(or.u),255<or.u?or.u=255:0>or.u&&(or.u=0),or.o=Math.round(or.o),255<or.o?or.o=255:0>or.o&&(or.o=0),"rgba("+or.j+", "+or.u+", "+or.o+", "+or.F+")";case Jy:return jv(),qa.o=Math.min(100,Math.max(0,qa.o+100*t)),"hsla("+qa.j+", "+qa.u+"%, "+qa.o+"%, "+qa.F+")";default:lt("Unknown color space: "+e)}}function jh(t){ep||(Wv(),ep=!0);var e=Eg;if(e!==null){e.clearRect(0,0,1,1),e.fillStyle="#000000";var i=e.fillStyle;e.fillStyle=t,e.fillStyle!==i?(e.fillRect(0,0,1,1),t=e.getImageData(0,0,1,1).data,or.j=t[0],or.u=t[1],or.o=t[2],or.F=t[3]/255):(e.fillStyle="#FFFFFF",e.fillStyle=t,or.j=0,or.u=0,or.o=0,or.F=1)}}function jv(){var t=or.j/255,e=or.u/255,i=or.o/255,n=Math.max(t,e,i),s=Math.min(t,e,i),a=n-s;if(s=(n+s)/2,a===0)var l=t=0;else{switch(n){case t:l=(e-i)/a%6;break;case e:l=(i-t)/a+2;break;case i:l=(t-e)/a+4}l*=60,0>l&&(l+=360),t=a/(1-Math.abs(2*s-1))}qa.j=Math.round(l),qa.u=Math.round(100*t),qa.o=Math.round(100*s),qa.F=or.F}function $v(t){return t/=255,.04045>=t?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Kv(t){return .0031308>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055}function Hv(t){return t>Uv?Math.pow(t,1/3):(Lg*t+16)/116}function Vv(t){var e=t*t*t;return e>Uv?e:(116*t-16)/Lg}function tp(t,e){typeof t!="string"&&(t instanceof Tn||lt("Value for "+e+" must be a color string or a Brush, not "+t))}function Wv(){Eg=Bn?new Tl(null,void 0,{willReadFrequently:!0}).context:null}ct.Object.defineProperties(Tn.prototype,{type:{get:function(){return this.na},set:function(t){this._isFrozen&&Qt(this,t),this.na=t,this.start.Mc()&&(t===Kh?this.start=Rr:t===fl&&(this.start=on)),this.end.Mc()&&(t===Kh?this.end=Rs:t===fl&&(this.end=on)),this.xe=null}},color:{get:function(){return this.xk},set:function(t){this._isFrozen&&Qt(this,t),this.xk=t,this.xe=null}},start:{get:function(){return this.Qd},set:function(t){this._isFrozen&&Qt(this,t),this.Qd=t.J(),this.xe=null}},end:{get:function(){return this.Lk},set:function(t){this._isFrozen&&Qt(this,t),this.Lk=t.J(),this.xe=null}},startRadius:{get:function(){return this.Gr},set:function(t){this._isFrozen&&Qt(this,t),0>t&&me(t,">= zero",Tn,"startRadius"),this.Gr=t,this.xe=null}},endRadius:{get:function(){return this.Xp},set:function(t){this._isFrozen&&Qt(this,t),0>t&&me(t,">= zero",Tn,"endRadius"),this.Xp=t,this.xe=null}},colorStops:{get:function(){return this.we},set:function(t){this._isFrozen&&Qt(this,t),this.we=t,this.xe=null}},pattern:{get:function(){return this.cr},set:function(t){this._isFrozen&&Qt(this,t),this.cr=t,this.xe=null}}}),Tn.prototype.isDark=Tn.prototype.Gx,Tn.prototype.darkenBy=Tn.prototype.Wy,Tn.prototype.lightenBy=Tn.prototype.Vz,Tn.prototype.addColorStop=Tn.prototype.addColorStop;var Uv=216/24389,Lg=24389/27,qp=[95.047,100,108.883],Eg=null,or=new qf,qa=new qf,ta=new qf,lu=new qf,ep=!1;Tn.className="Brush";var $h;Tn.Solid=$h=new mt(Tn,"Solid",0);var Kh;Tn.Linear=Kh=new mt(Tn,"Linear",1);var fl;Tn.Radial=fl=new mt(Tn,"Radial",2);var Qp;Tn.Pattern=Qp=new mt(Tn,"Pattern",4);var t0;Tn.Lab=t0=new mt(Tn,"Lab",5);var Jy;Tn.HSL=Jy=new mt(Tn,"HSL",6),Tn.randomColor=function(t,e){t===void 0&&(t=128),e===void 0&&(e=Math.max(t,255));var i=Math.abs(e-t);e=Math.floor(t+Math.random()*i).toString(16);var n=Math.floor(t+Math.random()*i).toString(16);return t=Math.floor(t+Math.random()*i).toString(16),2>e.length&&(e="0"+e),2>n.length&&(n="0"+n),2>t.length&&(t="0"+t),"#"+e+n+t},Tn.isValidColor=function(t){if(t==="black")return!0;if(t==="")return!1;ep||(Wv(),ep=!0);var e=Eg;if(e===null)return!0;e.fillStyle="#000000";var i=e.fillStyle;return e.fillStyle=t,e.fillStyle!==i?!0:(e.fillStyle="#FFFFFF",i=e.fillStyle,e.fillStyle=t,e.fillStyle!==i)},Tn.lighten=function(t){return nd(t)},Tn.lightenBy=nd,Tn.darken=function(t){return Yy(t)},Tn.darkenBy=Yy,Tn.mix=kg,Tn.isDark=Wd;function So(){this.xa="Base"}So.prototype.measure=function(){},So.prototype.Yz=function(t,e,i,n,s){t.measure(e,i,n,s)},So.prototype.arrange=function(){},So.prototype.Ly=function(t,e,i,n,s,a){t.arrange(e,i,n,s,a)},So.prototype.iA=function(t){t.Uj()},So.prototype.gc=function(){},ct.Object.defineProperties(So.prototype,{name:{get:function(){return this.xa},set:function(t){this.xa=t}},classType:{get:function(){return ne}}}),So.prototype.remeasureObject=So.prototype.iA,So.prototype.arrangeElement=So.prototype.Ly,So.prototype.measureElement=So.prototype.Yz,So.className="PanelLayout";function _g(){this.xa="Base"}gi(_g,So),_g.prototype.measure=function(t,e,i,n,s,a,l){var c=n.length;t=uu(t);for(var f=0;f<c;f++){var m=n[f];if(m.visible||m===t){var v=m.margin,w=v.right+v.left;v=v.top+v.bottom,m.measure(e,i,a,l);var C=m.measuredBounds;w=Math.max(C.width+w,0),v=Math.max(C.height+v,0),C=m.position.x;var k=m.position.y;isFinite(C)||(C=0),isFinite(k)||(k=0),m instanceof Xi&&m.isGeometryPositioned&&(m=m.strokeWidth/2,C-=m,k-=m),vr(s,C,k,w,v)}}},_g.prototype.arrange=function(t,e,i){var n=e.length,s=t.padding;for(t=i.x-s.left,i=i.y-s.top,s=0;s<n;s++){var a=e[s],l=a.measuredBounds,c=a.margin,f=a.position.x,m=a.position.y;if(f=isNaN(f)?-t:f-t,m=isNaN(m)?-i:m-i,a instanceof Xi&&a.isGeometryPositioned){var v=a.strokeWidth/2;f-=v,m-=v}a.visible&&a.arrange(f+c.left,m+c.top,l.width,l.height)}};function Tg(){this.xa="Base"}gi(Tg,So),Tg.prototype.measure=function(t,e,i,n,s,a,l){var c=n.length;e=Pe(),a=uu(t);for(var f=0;f<c;f++){var m=n[f];if(m.visible||m===a){var v=Qs(m,!1);if(v!==Yt&&v!==si)e.push(m);else{m.measure(1/0,i,0,l),v=m.margin,m=m.measuredBounds;var w=Math.max(m.height+v.top+v.bottom,0);s.width+=Math.max(m.width+v.right+v.left,0),s.height=Math.max(s.height,w)}}}for(n=e.length,t.desiredSize.height?i=Math.min(t.desiredSize.height,t.maxSize.height):s.height!==0&&(i=Math.min(s.height,t.maxSize.height)),t=0;t<n;t++)f=e[t],(f.visible||f===a)&&(v=f.margin,c=v.right+v.left,v=v.top+v.bottom,f.measure(1/0,i,0,l),f=f.measuredBounds,v=Math.max(f.height+v,0),s.width+=Math.max(f.width+c,0),s.height=Math.max(s.height,v));qe(e)},Tg.prototype.arrange=function(t,e,i){for(var n=e.length,s=t.padding,a=s.top,l=t.isOpposite,c=l?i.width:s.left,f=0;f<n;f++){var m=a,v=e[f];if(v.visible){var w=v.measuredBounds,C=v.margin,k=C.top+C.bottom,L=a+s.bottom,A=w.height,H=Qs(v,!1);(isNaN(v.desiredSize.height)&&H===ie||H===yi)&&(A=Math.max(i.height-k-L,0)),k=A+k+L,L=v.alignment,L.Xb()&&(L=t.defaultAlignment),L.sb()||(L=on),l&&(c-=w.width+C.left+C.right),v.arrange(c+L.offsetX+C.left,m+L.offsetY+C.top+(i.height*L.y-k*L.y),w.width,A),l||(c+=w.width+C.left+C.right)}}};function Pg(){this.xa="Base"}gi(Pg,So),Pg.prototype.measure=function(t,e,i,n,s,a){var l=n.length;i=Pe();for(var c=uu(t),f=0;f<l;f++){var m=n[f];if(m.visible||m===c){var v=Qs(m,!1);if(v!==Yt&&v!==yi)i.push(m);else{var w=m.margin;v=w.right+w.left,w=w.top+w.bottom,m.measure(e,1/0,a,0),m=m.measuredBounds,Lo(s,Math.max(s.width,Math.max(m.width+v,0)),s.height+Math.max(m.height+w,0))}}}if(n=i.length,n!==0){for(t.desiredSize.width?e=Math.min(t.desiredSize.width,t.maxSize.width):s.width!==0&&(e=Math.min(s.width,t.maxSize.width)),t=0;t<n;t++)f=i[t],(f.visible||f===c)&&(m=f.margin,l=m.right+m.left,m=m.top+m.bottom,f.measure(e,1/0,a,0),f=f.measuredBounds,m=Math.max(f.height+m,0),s.width=Math.max(s.width,Math.max(f.width+l,0)),s.height+=m);qe(i)}},Pg.prototype.arrange=function(t,e,i){for(var n=e.length,s=t.padding,a=s.left,l=t.isOpposite,c=l?i.height:s.top,f=0;f<n;f++){var m=a,v=e[f];if(v.visible){var w=v.measuredBounds,C=v.margin,k=C.left+C.right,L=a+s.right,A=w.width,H=Qs(v,!1);(isNaN(v.desiredSize.width)&&H===ie||H===si)&&(A=Math.max(i.width-k-L,0)),k=A+k+L,L=v.alignment,L.Xb()&&(L=t.defaultAlignment),L.sb()||(L=on),l&&(c-=w.height+C.bottom+C.top),v.arrange(m+L.offsetX+C.left+(i.width*L.x-k*L.x),c+L.offsetY+C.top,A,w.height),l||(c+=w.height+C.bottom+C.top)}}};function dm(){this.xa="Base"}gi(dm,So),dm.prototype.measure=function(t,e,i,n,s,a,l){var c=n.length,f=t.Pb(),m=f.margin,v=m.right+m.left,w=m.top+m.bottom;f.measure(e,i,a,l);var C=f.measuredBounds;a=C.width,l=C.height;var k=Math.max(a+v,0),L=Math.max(l+w,0),A=t.isClipping,H=It.allocAt(-m.left,-m.top,k,L),R=It.allocAt(0,0,a,l);Ud(f,R,!0),a=R.width,l=R.height;for(var X=!0,Y=uu(t),tt=0;tt<c;tt++){var st=n[tt];C=e;var bt=i;if(st!==f&&(st.visible||st===Y)){m=st.margin;var Te=m.left,Ke=m.top;switch(k=m.right+m.left,L=m.top+m.bottom,m=Qs(st,!1),m){case ie:C=a,bt=l,Ke=Te=L=k=0;break;case si:C=a,Te=k=0;break;case yi:bt=l,Ke=L=0}st.measure(C,bt,0,0),C=st.measuredBounds,k=Math.max(C.width+k,0),L=Math.max(C.height+L,0),m=st.alignment,m.Xb()&&(m=t.defaultAlignment),m.sb()||(m=on);var Oe=st.alignmentFocus;if(Oe.Xb()&&(Oe=on),bt=null,st instanceof ne&&st.$e!==""&&(bt=st.fb(st.$e),bt===st&&(bt=null)),Te=R.x-Te,Ke=R.y-Ke,bt!==null){for(st.arrange(0,0,C.width,C.height),C=bt.actualBounds,C=z.allocAt(C.x+(Oe.x*C.width-Oe.offsetX),C.y+(Oe.y*C.height-Oe.offsetY)),bt=bt.panel;bt!==st;)bt.transform.Ga(C),bt=bt.panel;Te+=m.x*a+m.offsetX-C.x,Ke+=m.y*l+m.offsetY-C.y,z.free(C)}else Te+=m.x*a+m.offsetX-(Oe.x*C.width+Oe.offsetX),Ke+=m.y*l+m.offsetY-(Oe.y*C.height+Oe.offsetY);X?(X=!1,s.h(Te,Ke,k,L)):vr(s,Te,Ke,k,L)}}switch(X?s.assign(H):A?s.Uu(R.x,R.y,R.width,R.height):vr(s,H.x,H.y,H.width,H.height),It.free(H),It.free(R),m=f.stretch,m===Vi&&(m=Qs(f,!1)),m){case Yt:return;case ie:if(!isFinite(e)&&!isFinite(i))return;break;case si:if(!isFinite(e))return;break;case yi:if(!isFinite(i))return}for(C=f.measuredBounds,a=C.width,l=C.height,k=Math.max(a+v,0),L=Math.max(l+w,0),m=f.margin,R=It.allocAt(-m.left,-m.top,k,L),Ud(f,R,!0),a=R.width,l=R.height,e=0;e<c;e++)i=n[e],i===f||!i.visible&&i!==Y||(m=i.margin,k=m.right+m.left,L=m.top+m.bottom,C=i.measuredBounds,k=Math.max(C.width+k,0),L=Math.max(C.height+L,0),v=i.alignment,v.Xb()&&(v=t.defaultAlignment),v.sb()||(v=on),i=i.alignmentFocus,i.Xb()&&(i=on),X?(X=!1,s.h(v.x*a+v.offsetX-(i.x*C.width+i.offsetX)-m.left,v.y*l+v.offsetY-(i.y*C.height+i.offsetY)-m.top,k,L)):vr(s,v.x*a+v.offsetX-(i.x*C.width+i.offsetX)-m.left,v.y*l+v.offsetY-(i.y*C.height+i.offsetY)-m.top,k,L));X?s.assign(H):A?s.Uu(R.x,R.y,R.width,R.height):vr(s,H.x,H.y,H.width,H.height),It.free(R)},dm.prototype.arrange=function(t,e,i){var n=e.length,s=t.Pb(),a=s.measuredBounds,l=a.width,c=a.height,f=t.padding;a=f.left,f=f.top;var m=a-i.x,v=f-i.y;for(s.arrange(m,v,l,c),l=It.allocAt(0,0,l,c),Ud(s,l,!1),c=0;c<n;c++){var w=e[c];if(w!==s){m=w.measuredBounds;var C=m.width,k=m.height;v=w.alignment,v.Xb()&&(v=t.defaultAlignment),v.sb()||(v=on);var L=w.alignmentFocus;if(L.Xb()&&(L=on),m=null,w instanceof ne&&w.$e!==""&&(m=w.fb(w.$e),m===w&&(m=null)),m!==null){var A=m.actualBounds;for(L=z.allocAt(A.x+(L.x*A.width-L.offsetX),A.y+(L.y*A.height-L.offsetY)),m=m.panel;m!==w;)m.transform.Ga(L),m=m.panel;m=v.x*l.width+v.offsetX-L.x,v=v.y*l.height+v.offsetY-L.y,z.free(L)}else m=v.x*l.width+v.offsetX-(L.x*C+L.offsetX),v=v.y*l.height+v.offsetY-(L.y*k+L.offsetY);m+=l.x-i.x,v+=l.y-i.y,w.visible&&w.arrange(a+m,f+v,C,k)}}It.free(l)};function Ud(t,e,i){var n=null;if(t instanceof ne&&t.$e!==""&&(n=t.fb(t.$e),n===t&&(n=null)),n!==null)for(i&&t.arrange(0,0,e.width,e.height),e.assign(n.actualBounds),n=n.panel;n!==t;)n.transform.pp(e),n=n.panel}function Ng(){this.xa="Base"}gi(Ng,So),Ng.prototype.measure=function(t,e,i,n,s,a,l){var c=n.length,f=t.Pb(),m=f.margin,v=e,w=i,C=m.right+m.left,k=m.top+m.bottom;f.measure(e,i,a,l),m=f.measuredBounds;var L=0,A=null;f instanceof Xi&&(A=f,L=A.strokeWidth*A.scale);var H=Math.max(m.width+C,0);m=Math.max(m.height+k,0);var R=Xv(f),X=R.x*H+R.offsetX;R=R.y*m+R.offsetY;var Y=Yv(f),tt=Y.x*H+Y.offsetX;for(Y=Y.y*m+Y.offsetY,isFinite(e)&&(v=Math.max(Math.abs(X-tt)-L,0)),isFinite(i)&&(w=Math.max(Math.abs(R-Y)-L,0)),L=ii.alloc(),L.h(0,0),t=uu(t),Y=0;Y<c;Y++)R=n[Y],R===f||!R.visible&&R!==t||(m=R.margin,H=m.right+m.left,X=m.top+m.bottom,R.measure(v,w,0,0),m=R.measuredBounds,H=Math.max(m.width+H,0),m=Math.max(m.height+X,0),L.h(Math.max(H,L.width),Math.max(m,L.height)));if(c===1)s.width=H,s.height=m,ii.free(L);else{switch(R=Xv(f),Y=Yv(f),c=n=0,Y.x!==R.x&&Y.y!==R.y&&(n=L.width/Math.abs(Y.x-R.x),c=L.height/Math.abs(Y.y-R.y)),ii.free(L),L=0,A!==null&&(L=A.strokeWidth*A.scale,o0(A)===Ge&&(n=c=Math.max(n,c))),n+=Math.abs(R.offsetX)+Math.abs(Y.offsetX)+L,c+=Math.abs(R.offsetY)+Math.abs(Y.offsetY)+L,A=f.stretch,A===Vi&&(A=Qs(f,!1)),A){case Yt:l=a=0;break;case ie:isFinite(e)&&(n=e),isFinite(i)&&(c=i);break;case si:isFinite(e)&&(n=e),l=0;break;case yi:a=0,isFinite(i)&&(c=i)}f.Uj(),f.measure(n,c,a,l),s.width=f.measuredBounds.width+C,s.height=f.measuredBounds.height+k}},Ng.prototype.arrange=function(t,e){var i=e.length,n=t.Pb(),s=n.measuredBounds,a=It.alloc();a.h(0,0,1,1);var l=n.margin,c=l.left;l=l.top;var f=t.padding,m=f.left;f=f.top,n.arrange(m+c,f+l,s.width,s.height);var v=Xv(n),w=Yv(n),C=v.y*s.height+v.offsetY,k=w.x*s.width+w.offsetX;for(w=w.y*s.height+w.offsetY,a.x=v.x*s.width+v.offsetX,a.y=C,vr(a,k,w,0,0),a.x+=c+m,a.y+=l+f,s=0;s<i;s++)c=e[s],c!==n&&(m=c.measuredBounds,l=c.margin,f=Math.max(m.width+l.right+l.left,0),v=Math.max(m.height+l.top+l.bottom,0),C=c.alignment,C.Xb()&&(C=t.defaultAlignment),C.sb()||(C=on),f=a.width*C.x+C.offsetX-f*C.x+l.left+a.x,l=a.height*C.y+C.offsetY-v*C.y+l.top+a.y,c.visible&&(jr(a.x,a.y,a.width,a.height,f,l,m.width,m.height)?c.arrange(f,l,m.width,m.height):c.arrange(f,l,m.width,m.height,new It(a.x,a.y,a.width,a.height))));It.free(a)};function Zd(){this.xa="Base",this.name="Table"}gi(Zd,So),Zd.prototype.measure=function(t,e,i,n,s){for(var a=n.length,l=Pe(),c=Pe(),f=0;f<a;f++){var m=n[f],v=m instanceof ne?m:null;if(v!==null&&bc(v)&&m.visible){c.push(v);for(var w=v.O.s,C=w.length,k=0;k<C;k++){var L=w[k];v.type===ne.TableRow?L.row=m.row:v.type===ne.TableColumn&&(L.column=m.column),l.push(L)}}else l.push(m)}a=l.length,a===0&&(t.Fb(0),t.Eb(0));for(var A=[],H=0;H<a;H++){var R=l[H];R.visible&&(Hr(R,!0),vs(R,!0),A[R.row]||(A[R.row]=[]),A[R.row][R.column]||(A[R.row][R.column]=[]),A[R.row][R.column].push(R))}qe(l);var X=Pe(),Y=Pe(),tt=Pe(),st={count:0},bt={count:0},Te=e,Ke=i,Oe=t.rowDefs,he=t.colDefs,Gt=null;a=Oe.length;for(var Wi=0;Wi<a;Wi++)Gt=Oe[Wi],Gt!==void 0&&(Gt.actual=0);a=he.length;for(var Di=0;Di<a;Di++)Gt=he[Di],Gt!==void 0&&(Gt.actual=0);for(var In=A.length,sr=0,is=0;is<In;is++)A[is]&&(sr=Math.max(sr,A[is].length));var cs=Math.min(t.topIndex,In-1),ma=Math.min(t.leftIndex,sr-1),ns=0;In=A.length;for(var yf=uu(t),xo=0;xo<In;xo++)if(A[xo]){sr=A[xo].length;var vh=t.Fb(xo);vh.actual=0;for(var ga=vh.oc=0;ga<sr;ga++)if(A[xo][ga]){var xf=t.Eb(ga);X[ga]===void 0&&(xf.actual=0,xf.oc=0,X[ga]=!0);for(var Dl=A[xo][ga],mu=Dl.length,xl=0;xl<mu;xl++){var nl=Dl[xl];if(nl.visible||nl===yf){var Cp=1<nl.rowSpan||1<nl.columnSpan;Cp&&(xo<cs||ga<ma||Y.push(nl));var yh=nl.margin,Ev=yh.right+yh.left,wl=yh.top+yh.bottom,va=La(nl,vh,xf,!1),jy=nl.desiredSize,ng=!isNaN(jy.height),Yh=!isNaN(jy.width)&&ng;if(Cp||va===Yt||Yh||xo<cs||ga<ma||(st[ga]!==void 0||va!==ie&&va!==si||(st[ga]=-1,st.count++),bt[xo]!==void 0||va!==ie&&va!==yi||(bt[xo]=-1,bt.count++),tt.push(nl)),nl.measure(1/0,1/0,0,0),!(xo<cs||ga<ma)){var rl=nl.measuredBounds,I0=Math.max(rl.width+Ev,0),bl=Math.max(rl.height+wl,0);if(nl.rowSpan===1&&(va===Yt||va===si)){Gt=t.Fb(xo);var kp=Gt.Wc();ns=Math.max(bl-Gt.actual,0),ns+kp>Ke&&(ns=Math.max(Ke-kp,0));var Q1=Gt.oa===0;Gt.oc=Gt.oc+ns,Gt.actual=Gt.oa+ns,Ke=Math.max(Ke-(ns+(Q1?kp:0)),0)}if(nl.columnSpan===1&&(va===Yt||va===yi)){Gt=t.Eb(ga);var $y=Gt.Wc();ns=Math.max(I0-Gt.actual,0),ns+$y>Te&&(ns=Math.max(Te-$y,0));var $x=Gt.oa===0;Gt.oc=Gt.oc+ns,Gt.actual=Gt.oa+ns,Te=Math.max(Te-(ns+($x?$y:0)),0)}Cp&&nl.Uj()}}}}}qe(X);var Ic=0,xd=0;a=t.columnCount;for(var rg=0;rg<a;rg++){var Lp=he[rg];Lp!==void 0&&(Ic+=isNaN(Lp.Hc)?Lp.oc:Lp.Hc,Lp.oc!==0&&(Ic+=Lp.Wc()))}a=t.rowCount;for(var _v=0;_v<a;_v++){var Ep=Oe[_v];Ep!==void 0&&(xd+=isNaN(Ep.Hc)?Ep.oc:Ep.Hc,Ep.oc!==0&&(xd+=Ep.Wc()))}Te=Math.max(e-Ic,0);var Oc=Ke=Math.max(i-xd,0),wf=Te;a=tt.length;for(var ol=0;ol<a;ol++){var Jh=tt[ol],tx=t.Fb(Jh.row),wd=t.Eb(Jh.column),Tv=Jh.measuredBounds,xh=Jh.margin,O0=xh.right+xh.left,qh=xh.top+xh.bottom;st[Jh.column]=wd.oc===0&&st[Jh.column]!==void 0?Math.max(Tv.width+O0,st[Jh.column]):null,bt[Jh.row]=tx.oc===0&&bt[Jh.row]!==void 0?Math.max(Tv.height+qh,bt[Jh.row]):null}var og=0,Pv=0,Ru;for(Ru in bt)Ru!=="count"&&(og+=bt[Ru]);for(Ru in st)Ru!=="count"&&(Pv+=st[Ru]);for(var Ss=ii.alloc(),Ky=0;Ky<a;Ky++){var Aa=tt[Ky];if(Aa.visible||Aa===yf){var wo=t.Fb(Aa.row),Da=t.Eb(Aa.column),bd=0;isFinite(Da.width)?bd=Da.width:(isFinite(Te)&&st[Aa.column]!==null?Pv===0?bd=Da.actual+Te:bd=st[Aa.column]/Pv*wf:st[Aa.column]!==null?bd=Te:bd=Da.actual||Te,bd=Math.max(0,bd-Da.Wc()));var bf=0;switch(isFinite(wo.height)?bf=wo.height:(isFinite(Ke)&&bt[Aa.row]!==null?og===0?bf=wo.actual+Ke:bf=bt[Aa.row]/og*Oc:bt[Aa.row]!==null?bf=Ke:bf=wo.actual||Ke,bf=Math.max(0,bf-wo.Wc())),Ss.h(Math.max(Da.minimum,Math.min(bd,Da.maximum)),Math.max(wo.minimum,Math.min(bf,wo.maximum))),va=La(Aa,wo,Da,!1),va){case si:Ss.height=Math.max(Ss.height,wo.actual+Ke);break;case yi:Ss.width=Math.max(Ss.width,Da.actual+Te)}var B0=Aa.margin,Kx=B0.right+B0.left,ex=B0.top+B0.bottom;Aa.Uj(),Aa.measure(Ss.width,Ss.height,Da.minimum,wo.minimum);var Nv=Aa.measuredBounds,F0=Math.max(Nv.width+Kx,0),sg=Math.max(Nv.height+ex,0);isFinite(Te)&&(F0=Math.min(F0,Ss.width)),isFinite(Ke)&&(sg=Math.min(sg,Ss.height));var sl=0;sl=wo.actual,wo.actual=Math.max(wo.actual,sg),wo.oc=Math.max(wo.oc,sg),ns=wo.actual-sl,Ke=Math.max(Ke-ns,0),bt[Aa.row]===null&&(Oc=Math.max(Oc-ns,0)),sl=Da.actual,Da.actual=Math.max(Da.actual,F0),Da.oc=Math.max(Da.oc,F0),ns=Da.actual-sl,Te=Math.max(Te-ns,0),st[Aa.column]===null&&(wf=Math.max(wf-ns,0))}}qe(tt);var Sd=ii.alloc(),wh=Pe(),tu=Pe();if(a=Y.length,a!==0){for(var _p=0;_p<In;_p++)if(A[_p]){sr=A[_p].length;var Av=t.Fb(_p);wh[_p]=Av.actual;for(var Tp=0;Tp<sr;Tp++)if(A[_p][Tp]){var ix=t.Eb(Tp);tu[Tp]=ix.actual}}}for(var Dv=0;Dv<a;Dv++){var io=Y[Dv];if(io.visible||io===yf){var zu=t.Fb(io.row),gu=t.Eb(io.column);switch(Ss.h(Math.max(gu.minimum,Math.min(e,gu.maximum)),Math.max(zu.minimum,Math.min(i,zu.maximum))),va=La(io,zu,gu,!1),va){case ie:tu[gu.index]!==0&&(Ss.width=Math.min(Ss.width,tu[gu.index])),wh[zu.index]!==0&&(Ss.height=Math.min(Ss.height,wh[zu.index]));break;case si:tu[gu.index]!==0&&(Ss.width=Math.min(Ss.width,tu[gu.index]));break;case yi:wh[zu.index]!==0&&(Ss.height=Math.min(Ss.height,wh[zu.index]))}isFinite(gu.width)&&(Ss.width=gu.width),isFinite(zu.height)&&(Ss.height=zu.height),Sd.h(0,0);for(var nx=gu.minimum,Sl=zu.minimum,Sf=1;Sf<io.rowSpan&&!(io.row+Sf>=t.rowCount);Sf++)Gt=t.Fb(io.row+Sf),ns=0,ns=va===ie||va===yi?Math.max(Gt.minimum,wh[io.row+Sf]===0?Gt.maximum:Math.min(wh[io.row+Sf],Gt.maximum)):Math.max(Gt.minimum,isNaN(Gt.Hc)?Gt.maximum:Math.min(Gt.Hc,Gt.maximum)),Sd.height+=ns,Sl+=Gt.minimum;for(var vu=1;vu<io.columnSpan&&!(io.column+vu>=t.columnCount);vu++)Gt=t.Eb(io.column+vu),ns=0,ns=va===ie||va===si?Math.max(Gt.minimum,tu[io.column+vu]===0?Gt.maximum:Math.min(tu[io.column+vu],Gt.maximum)):Math.max(Gt.minimum,isNaN(Gt.Hc)?Gt.maximum:Math.min(Gt.Hc,Gt.maximum)),Sd.width+=ns,nx+=Gt.minimum;Ss.width+=Sd.width,Ss.height+=Sd.height;var Iv=io.margin,Pp=Iv.right+Iv.left,Hy=Iv.top+Iv.bottom;io.measure(Ss.width,Ss.height,nx,Sl);for(var Ov=io.measuredBounds,Qh=Math.max(Ov.width+Pp,0),R0=Math.max(Ov.height+Hy,0),Np=0,Bv=0;Bv<io.rowSpan&&!(io.row+Bv>=t.rowCount);Bv++)Gt=t.Fb(io.row+Bv),Np+=Gt.total||0;if(Np<R0){var Mf=R0-Np,Bc=R0-Np;if(io.spanAllocation!==null)for(var Cf=io.spanAllocation,Md=0;Md<io.rowSpan&&!(0>=Mf)&&!(io.row+Md>=t.rowCount);Md++){Gt=t.Fb(io.row+Md);var kf=Gt.oa||0,z0=Cf(io,Gt,Bc);Gt.actual=Math.min(Gt.maximum,kf+z0),Gt.oa!==kf&&(Mf-=Gt.oa-kf)}for(;0<Mf;){var bh=Gt.oa||0;if(isNaN(Gt.height)&&Gt.maximum>bh&&(Gt.actual=Math.min(Gt.maximum,bh+Mf),Gt.oa!==bh&&(Mf-=Gt.oa-bh)),Gt.index===0)break;Gt=t.Fb(Gt.index-1)}}for(var ag=0,Lf=0;Lf<io.columnSpan&&!(io.column+Lf>=t.columnCount);Lf++)Gt=t.Eb(io.column+Lf),ag+=Gt.total||0;if(ag<Qh){var lg=Qh-ag,Hx=Qh-ag;if(io.spanAllocation!==null)for(var Cd=io.spanAllocation,j0=0;j0<io.columnSpan&&!(0>=lg)&&!(io.column+j0>=t.columnCount);j0++){Gt=t.Eb(io.column+j0);var Vy=Gt.oa||0,Vx=Cd(io,Gt,Hx);Gt.actual=Math.min(Gt.maximum,Vy+Vx),Gt.oa!==Vy&&(lg-=Gt.oa-Vy)}for(;0<lg;){var rx=Gt.oa||0;if(isNaN(Gt.width)&&Gt.maximum>rx&&(Gt.actual=Math.min(Gt.maximum,rx+lg),Gt.oa!==rx&&(lg-=Gt.oa-rx)),Gt.index===0)break;Gt=t.Eb(Gt.index-1)}}}}qe(Y),ii.free(Sd),ii.free(Ss),wh!==void 0&&qe(wh),tu!==void 0&&qe(tu);var ug=0,hg=0,ox=t.desiredSize,o2=t.maxSize;va=Qs(t,!0);var Wy=xd=Ic=0,Uy=0;a=t.columnCount;for(var sx=0;sx<a;sx++)he[sx]!==void 0&&(Gt=t.Eb(sx),isFinite(Gt.width)?(Wy+=Gt.width,Wy+=Gt.Wc()):wm(Gt)===rp?(Wy+=Gt.oa,Wy+=Gt.Wc()):Gt.oa!==0&&(Ic+=Gt.oa,Ic+=Gt.Wc()));isFinite(ox.width)?ug=Math.min(ox.width,o2.width):ug=va!==Yt&&isFinite(e)?e:Ic,ug=Math.max(ug,t.minSize.width),ug=Math.max(ug-Wy,0);for(var V2=Ic===0?1:Math.max(ug/Ic,1),ax=0;ax<a;ax++)he[ax]!==void 0&&(Gt=t.Eb(ax),isFinite(Gt.width)||wm(Gt)===rp||(Gt.actual=Gt.oa*V2),Gt.position=s.width,Gt.oa!==0&&(s.width+=Gt.oa,s.width+=Gt.Wc()));a=t.rowCount;for(var lx=0;lx<a;lx++)Oe[lx]!==void 0&&(Gt=t.Fb(lx),isFinite(Gt.height)?(Uy+=Gt.height,Uy+=Gt.Wc()):wm(Gt)===rp?(Uy+=Gt.oa,Uy+=Gt.Wc()):Gt.oa!==0&&(xd+=Gt.oa,xd+=Gt.Wc()));isFinite(ox.height)?hg=Math.min(ox.height,o2.height):hg=va!==Yt&&isFinite(i)?i:xd,hg=Math.max(hg,t.minSize.height),hg=Math.max(hg-Uy,0);for(var W2=xd===0?1:Math.max(hg/xd,1),ux=0;ux<a;ux++)Oe[ux]!==void 0&&(Gt=t.Fb(ux),isFinite(Gt.height)||wm(Gt)===rp||(Gt.actual=Gt.oa*W2),Gt.position=s.height,Gt.oa!==0&&(s.height+=Gt.oa,s.height+=Gt.Wc()));a=c.length;for(var Wx=0;Wx<a;Wx++){var Zy=c[Wx],Ux=0,Zx=0;Zy.type===ne.TableRow?(Ux=s.width,Gt=t.Fb(Zy.row),Zx=Gt.actual):(Gt=t.Eb(Zy.column),Ux=Gt.actual,Zx=s.height),Zy.measuredBounds.h(0,0,Ux,Zx),Hr(Zy,!1)}qe(c),t.inRowsCols=A},Zd.prototype.arrange=function(t,e,i){var n=e.length,s=t.padding,a=s.left;s=s.top;var l=t.inRowsCols;if(l!==null){for(var c,f,m=l.length,v=0,w=0;w<m;w++)l[w]&&(v=Math.max(v,l[w].length));f=t.rowDefs,c=t.colDefs;var C=w=0,k=Math.min(t.topIndex,m-1);if(0<f.length){for(;k!==m&&(f[k]===void 0||f[k].oa===0);)k++;k=Math.max(Math.min(k,m-1),0),w=-f[k].position}var L=Math.min(t.leftIndex,v-1);if(0<c.length){for(;L!==v&&(c[L]===void 0||c[L].oa===0);)L++;L=Math.max(Math.min(L,v-1),0),C=-c[L].position}for(var A=0,H=0;A!==m&&f[A]===void 0;)A++;for(;H!==m&&c[H]===void 0;)H++;v=t.part,t.Fb(A),t.Eb(H);for(var R=0;R<e.length;R++){var X=e[R];if(X instanceof ne&&X.visible&&bc(X)){if(X.type===ne.TableRow){c=t.Fb(X.row);var Y=t.Eb(H)}else c=t.Fb(A),Y=t.Eb(X.column);f=c.position+w+s,c.oa!==0&&(f+=c.Io(Math.max(A,k))),c=Y.position+C+a,Y.oa!==0&&(c+=Y.Io(Math.max(H,L))),Y=X.measuredBounds,X.Uk(),X.actualBounds.ka();var tt=X.actualBounds,st=It.allocAt(tt.x,tt.y,tt.width,tt.height);tt.x=X.type===ne.TableRow?a:c,tt.y=X.type===ne.TableColumn?s:f,tt.width=Y.width,tt.height=Y.height,X.actualBounds.freeze(),vs(X,!1),Xs(st,tt)||v===null||(v.oh(),X.Pn(v)),It.free(st)}}for(R=ii.alloc(),X=0;X<m;X++)if(l[X]){for(v=l[X].length,Y=t.Fb(X),f=Y.position+w+s,Y.oa!==0&&(f+=Y.Io(Math.max(A,k))),tt=0;tt<v;tt++)if(l[X][tt]){st=t.Eb(tt),c=st.position+C+a,st.oa!==0&&(c+=st.Io(Math.max(H,L)));for(var bt=l[X][tt],Te=bt.length,Ke=0;Ke<Te;Ke++){var Oe=bt[Ke],he=Oe.measuredBounds;R.h(0,0);for(var Gt=1;Gt<Oe.rowSpan&&!(X+Gt>=t.rowCount);Gt++){var Wi=t.Fb(X+Gt);Wi.oa!==0&&(R.height+=Wi.total)}for(Gt=1;Gt<Oe.columnSpan&&!(tt+Gt>=t.columnCount);Gt++)Wi=t.Eb(tt+Gt),Wi.oa!==0&&(R.width+=Wi.total);var Di=st.oa+R.width,In=Y.oa+R.height;Gt=c,Wi=f;var sr=Di,is=In,cs=c,ma=f,ns=Di,yf=In;c+Di>i.width&&(ns=Math.max(i.width-c,0)),f+In>i.height&&(yf=Math.max(i.height-f,0));var xo=Oe.alignment;if(xo.Xb()){xo=t.defaultAlignment,xo.sb()||(xo=on);var vh=xo.x,ga=xo.y,xf=xo.offsetX;xo=xo.offsetY;var Dl=st.alignment,mu=Y.alignment;Dl.sb()&&(vh=Dl.x,xf=Dl.offsetX),mu.sb()&&(ga=mu.y,xo=mu.offsetY)}else vh=xo.x,ga=xo.y,xf=xo.offsetX,xo=xo.offsetY;(isNaN(vh)||isNaN(ga))&&(ga=vh=.5,xo=xf=0),Dl=he.width,mu=he.height;var xl=Oe.margin,nl=xl.left+xl.right,Cp=xl.top+xl.bottom,yh=La(Oe,Y,st,!1);!isNaN(Oe.desiredSize.width)||yh!==ie&&yh!==si||(Dl=Math.max(Di-nl,0)),!isNaN(Oe.desiredSize.height)||yh!==ie&&yh!==yi||(mu=Math.max(In-Cp,0)),Di=Oe.maxSize,In=Oe.minSize,Dl=Math.min(Di.width,Dl),mu=Math.min(Di.height,mu),Dl=Math.max(In.width,Dl),mu=Math.max(In.height,mu),Di=mu+Cp,Gt+=sr*vh-(Dl+nl)*vh+xf+xl.left,Wi+=is*ga-Di*ga+xo+xl.top,Oe.visible&&(jr(cs,ma,ns,yf,Gt,Wi,he.width,he.height)?Oe.arrange(Gt,Wi,Dl,mu):Oe.arrange(Gt,Wi,Dl,mu,new It(cs,ma,ns,yf)))}}}for(ii.free(R),t=0;t<n;t++)i=e[t],a=i instanceof ne?i:null,a!==null&&bc(a)&&(a=i.actualBounds,i.naturalBounds.ka(),i.naturalBounds.h(0,0,a.width,a.height),i.naturalBounds.freeze())}};function Gd(){this.xa="Base"}gi(Gd,So),Gd.prototype.measure=function(){},Gd.prototype.arrange=function(){};function e0(){this.xa="Base"}gi(e0,So),e0.prototype.measure=function(){},e0.prototype.arrange=function(){};function Pl(){this.xa="Base"}gi(Pl,So),Pl.prototype.measure=function(t,e,i,n,s,a,l){1<n.length&&lt("Viewbox Panel cannot contain more than one GraphObject."),n=n[0],n.Ca=1,n.Uj(),n.measure(1/0,1/0,a,l);var c=n.measuredBounds,f=n.margin,m=f.right+f.left;if(f=f.top+f.bottom,isFinite(e)||isFinite(i)){var v=n.scale,w=c.width;c=c.height;var C=Math.max(e-m,0),k=Math.max(i-f,0),L=1;t.viewboxStretch===Ge?w!==0&&c!==0&&(L=Math.min(C/w,k/c)):w!==0&&c!==0&&(L=Math.max(C/w,k/c)),L===0&&(L=1e-4),n.Ca*=L,v!==n.scale&&(Hr(n,!0),n.measure(1/0,1/0,a,l))}c=n.measuredBounds,s.width=isFinite(e)?e:Math.max(c.width+m,0),s.height=isFinite(i)?i:Math.max(c.height+f,0)},Pl.prototype.arrange=function(t,e,i){e=e[0];var n=e.measuredBounds,s=e.margin,a=Math.max(n.width+(s.right+s.left),0);s=Math.max(n.height+(s.top+s.bottom),0);var l=e.alignment;l.Xb()&&(l=t.defaultAlignment),l.sb()||(l=on),e.arrange(i.width*l.x-a*l.x+l.offsetX,i.height*l.y-s*l.y+l.offsetY,n.width,n.height)};function fm(){this.xa="Base"}gi(fm,So),fm.prototype.measure=function(){},fm.prototype.arrange=function(){},fm.prototype.gc=function(t,e,i){i=t.Df()*i.scale,0>=i&&(i=1);var n=t.gridCellSize,s=n.width;n=n.height;var a=t.naturalBounds,l=t.actualBounds,c=a.width,f=a.height,m=Math.ceil(c/s),v=Math.ceil(f/n),w=t.gridOrigin,C=w.x;w=w.y,e.save(),e.beginPath(),e.rect(0,0,c,f),e.clip(),e.Se();for(var k=[],L=t.O.s,A=L.length,H=0;H<A;H++){var R=L[H],X=[];if(k.push(X),R.visible){var Y=R.interval;if(!(0>Y)){R=Zv(R.figure);for(var tt=0;tt<A;tt++)if(tt!==H){var st=L[tt];st.visible&&Zv(st.figure)===R&&(st=st.interval,st>Y&&X.push(st))}}}}for(L=t.O.s,A=L.length,H=0;H<A;H++){var bt=L[H];if(bt.visible&&(X=bt.interval||1,R=Math.abs(X),!(2>s*R*i))){if(Y=bt.segmentIndex,(!isFinite(Y)||isNaN(Y))&&(Y=0),0>Y&&(Y=R-Math.min(-Y,R)),Y=Math.round(Y%R),R=bt.opacity,tt=1,R!==1){if(R===0)continue;tt=e.globalAlpha,e.globalAlpha=tt*R}st=k[H];var Te=!1,Ke=bt.strokeDashArray;if(Ke!==null&&(Te=!0,e.js(Ke,bt.strokeDashOffset)),bt.figure==="LineV"&&bt.stroke!==null&&0<bt.strokeWidth){for(e.lineWidth=bt.strokeWidth,Br(t,e,bt.stroke,!1,!1,a,l),e.beginPath(),Ke=bt=Math.floor((C-s)/s);Ke<=bt+m;Ke++){var Oe=Ke*s+C;0<=Oe&&Oe<=c&&Ag(Ke,X,Y,st)&&(e.moveTo(Oe,0),e.lineTo(Oe,f))}e.stroke(),e.Se()}else if(bt.figure==="LineH"&&bt.stroke!==null&&0<bt.strokeWidth){for(e.lineWidth=bt.strokeWidth,Br(t,e,bt.stroke,!1,!1,a,l),e.beginPath(),Ke=bt=Math.floor((w-n)/n);Ke<=bt+v;Ke++)Oe=Ke*n+w,0<=Oe&&Oe<=f&&Ag(Ke,X,Y,st)&&(e.moveTo(0,Oe),e.lineTo(c,Oe));e.stroke(),e.Se()}else if(bt.figure==="BarV"&&bt.fill!==null)for(Br(t,e,bt.fill,!0,!1,a,l),bt=bt.width,isNaN(bt)&&(bt=s),Oe=Ke=Math.floor((C-s)/s);Oe<=Ke+m;Oe++){var he=Oe*s+C;0<=he+bt&&he<=c&&Ag(Oe,X,Y,st)&&e.fillRect(he,0,bt,f)}else if(bt.figure==="BarH"&&bt.fill!==null)for(Br(t,e,bt.fill,!0,!1,a,l),bt=bt.height,isNaN(bt)&&(bt=n),Oe=Ke=Math.floor((w-n)/n);Oe<=Ke+v;Oe++)he=Oe*n+w,0<=he+bt&&he<=f&&Ag(Oe,X,Y,st)&&e.fillRect(0,he,c,bt);Te&&e.fs(),R!==1&&(e.globalAlpha=tt)}}e.restore(),e.Vc(!1)};function Ag(t,e,i,n){if(0>e)return t%e===i;if(t%e!==i)return!1;e=n.length;for(var s=0;s<e;s++)if(t%n[s]===i)return!1;return!0}function Dg(){this.xa="Base"}gi(Dg,So),Dg.prototype.measure=function(t,e,i,n,s){var a=n.length;if(t instanceof Cn||t instanceof ue){var l=null,c=null;if(t instanceof ue&&(l=t),t instanceof Cn&&(c=t,l=c.adornedPart,t.j===null&&(t.j=[])),l instanceof ue){var f=l;if(a===0)Lo(t.naturalBounds,0,0),t.measuredBounds.h(0,0,0,0);else{var m=t instanceof Cn?null:l.path;e=l.routeBounds,i=t.jg,i.h(0,0,e.width,e.height);var v=f.points,w=l.pointsCount;c!==null?c.Ul(!1):l!==null&&l.Ul(!1),c=e.width;var C=e.height,k=t.j;if(k.length=0,m!==null){qy(t,c,C,m);var L=m.measuredBounds;i.ed(L),k.push(L)}L=nn.alloc();for(var A=z.alloc(),H=z.alloc(),R=0;R<a;R++){var X=n[R];if(X!==m)if(X.isPanelMain&&X instanceof Xi){qy(t,c,C,X);var Y=X.measuredBounds;i.ed(Y),k.push(Y)}else if(2>w)X.measure(1/0,1/0,0,0),Y=X.measuredBounds,i.ed(Y),k.push(Y);else{var tt=X.segmentIndex,st=X.segmentFraction,bt=X.alignmentFocus;bt.Mc()&&(bt=on);var Te=X.segmentOrientation,Ke=X.segmentOffset;if(isNaN(tt)){var Oe=f.ua;Y=Pe(),Oe.Qu(st,Y);var he=z.allocAt(Y[0],Y[1]);if(he.add(f.i(0)),Oe.type===fe.j?he.offset(-Oe.startX,-Oe.startY):(Oe=Oe.figures.first(),Oe!==null&&he.offset(-Oe.startX,-Oe.startY)),Oe=Y[2],Te!==ea){var Gt=f.computeAngle(X,Te,Oe);X.Kb=Gt}Gt=he.x-e.x;var Wi=he.y-e.y;z.free(he),qe(Y)}else if(tt<-w||tt>=w)Y=z.alloc(),f.vg(),f.computeMidPoint(Y),Oe=f.midAngle,Te!==ea&&(Gt=f.computeAngle(X,Te,Oe),X.Kb=Gt),Gt=Y.x-e.x,Wi=Y.y-e.y,z.free(Y);else{if(Gt=0,0<=tt?(Wi=v.M(tt),Y=tt<w-1?v.M(tt+1):Wi):(Gt=w+tt,Wi=v.M(Gt),Y=0<Gt?v.M(Gt-1):Wi),Wi.Xa(Y)){0<=tt?(Oe=0<tt?v.M(tt-1):Wi,Gt=tt<w-2?v.M(tt+2):Y):(Oe=Gt<w-1?v.M(Gt+1):Wi,Gt=1<Gt?v.M(Gt-2):Y),he=Oe.Bf(Wi);var Di=Y.Bf(Gt);Oe=he>Di+10?0<=tt?Oe.ab(Wi):Wi.ab(Oe):Di>he+10?0<=tt?Y.ab(Gt):Gt.ab(Y):0<=tt?Oe.ab(Gt):Gt.ab(Oe)}else Oe=0<=tt?Wi.ab(Y):Y.ab(Wi);Te!==ea&&(Gt=f.computeAngle(X,Te,Oe),X.Kb=Gt),Gt=Wi.x+(Y.x-Wi.x)*st-e.x,Wi=Wi.y+(Y.y-Wi.y)*st-e.y}X.measure(1/0,1/0,0,0),Y=X.measuredBounds,he=X.naturalBounds;var In=0;X instanceof Xi&&(In=X.strokeWidth),Di=he.width+In;var sr=he.height+In;L.reset(),L.translate(-Y.x,-Y.y),L.scale(X.scale,X.scale),L.rotate(Te===ea?X.angle:Oe,Di/2,sr/2),Te!==lf&&Te!==x0||L.rotate(90,Di/2,sr/2),Te!==zm&&Te!==jm||L.rotate(-90,Di/2,sr/2),Te===rv&&(45<Oe&&135>Oe||225<Oe&&315>Oe)&&L.rotate(-Oe,Di/2,sr/2),he=new It(0,0,Di,sr),A.xi(he,bt),L.Ga(A),bt=-A.x+In/2*X.scale,X=-A.y+In/2*X.scale,H.assign(Ke),In=isNaN(Ke.x);var is=isNaN(Ke.y);if(In||is){Di=Di/2+3,sr=sr/2+3;var cs=45<=Oe&&135>=Oe,ma=225<=Oe&&315>=Oe;Te===ea&&(cs||ma)?(H.x=is?Di:Ke.y,H.y=In?sr:Ke.x,cs?0<=tt||isNaN(tt)&&.5>st||!In||(H.y=-sr):ma&&((0<=tt||isNaN(tt)&&.5>st)&&In&&(H.y=-sr),is&&(H.x=-Di))):(In&&(H.x=0<=tt||isNaN(tt)&&.5>st?Di:-Di),is&&(H.y=-sr),H.rotate(Oe))}else H.rotate(Oe);Gt+=H.x,Wi+=H.y,he.set(Y),he.h(Gt+bt,Wi+X,Y.width,Y.height),k.push(he),i.ed(he)}}if(l!==null)for(n=l.labelNodes;n.next();)n.value.measure(1/0,1/0);t.jg=i,t.position.h(e.x+i.x,e.y+i.y),Lo(s,i.width||0,i.height||0),nn.free(L),z.free(A),z.free(H)}}}},Dg.prototype.arrange=function(t,e){var i=e.length;if(t instanceof Cn||t instanceof ue){var n=t,s=null;t instanceof Cn&&(s=t,n=s.adornedPart);var a=t instanceof Cn?null:n.path,l=t.j;if(l.length!==0){var c=0;if(a!==null&&c<l.length){var f=l[c];c++,a.arrange(f.x-t.jg.x,f.y-t.jg.y,f.width,f.height)}for(f=0;f<i;f++){var m=e[f];if(m!==a&&c<l.length){var v=l[c];c++,m.arrange(v.x-t.jg.x,v.y-t.jg.y,v.width,v.height)}}}if(e=n.points,i=e.count,2<=i&&t instanceof ue)for(a=t.labelNodes;a.next();){var w=t;l=a.value,c=l.segmentIndex,f=l.segmentFraction;var C=l.alignmentFocus;if(m=l.segmentOrientation,v=l.segmentOffset,isNaN(c)){var k=w.ua,L=Pe();k.Qu(f,L);var A=z.allocAt(L[0],L[1]);A.add(w.i(0)),k.type===fe.j||(k=k.figures.first()),A.offset(-k.startX,-k.startY),k=L[2],m!==ea&&(w=w.computeAngle(l,m,k),l.angle=w),w=A.x;var H=A.y;z.free(A),qe(L)}else if(c<-i||c>=i)L=z.alloc(),k=w,H=L,k.vg(),k.computeMidPoint(H),k=w.midAngle,m!==ea&&(w=w.computeAngle(l,m,k),l.angle=w),w=L.x,H=L.y,z.free(L);else{if(A=0,0<=c?(L=e.s[c],H=c<i-1?e.s[c+1]:L):(A=i+c,L=e.s[A],H=0<A?e.s[A-1]:L),L.Xa(H)){0<=c?(k=0<c?e.s[c-1]:L,A=c<i-2?e.s[c+2]:H):(k=A<i-1?e.s[A+1]:L,A=1<A?e.s[A-2]:H);var R=k.Bf(L),X=H.Bf(A);k=R>X+10?0<=c?k.ab(L):L.ab(k):X>R+10?0<=c?H.ab(A):A.ab(H):0<=c?k.ab(A):A.ab(k)}else k=0<=c?L.ab(H):H.ab(L);m!==ea&&(w=w.computeAngle(l,m,k),l.angle=w),w=L.x+(H.x-L.x)*f,H=L.y+(H.y-L.y)*f}if(C.ys())l.location=new z(w,H);else{C.Mc()&&(C=on),L=nn.alloc(),L.reset(),L.scale(l.scale,l.scale),L.rotate(l.angle,0,0);var Y=l.naturalBounds;A=It.allocAt(0,0,Y.width,Y.height),R=z.alloc(),R.xi(A,C),L.Ga(R),C=-R.x,X=-R.y;var tt=Y.width,st=Y.height;Y=z.alloc(),Y.assign(v);var bt=isNaN(v.x),Te=isNaN(v.y);if(bt||Te){tt=tt/2+3,st=st/2+3;var Ke=45<=k&&135>=k,Oe=225<=k&&315>=k;m===ea&&(Ke||Oe)?(Y.x=Te?tt:v.y,Y.y=bt?st:v.x,Ke?0<=c||isNaN(c)&&.5>f||!bt||(Y.y=-st):Oe&&((0<=c||isNaN(c)&&.5>f)&&bt&&(Y.y=-st),Te&&(Y.x=-tt))):(bt&&(Y.x=0<=c||isNaN(c)&&.5>f?tt:-tt),Te&&(Y.y=-st),Y.rotate(k))}else Y.rotate(k);w+=Y.x,H+=Y.y,L.pp(A),C+=A.x,X+=A.y,c=z.allocAt(w+C,H+X),l.move(c),z.free(c),z.free(Y),z.free(R),It.free(A),nn.free(L)}}s!==null?s.Ul(!1):n.Ul(!1),n=Tu(t),t.location.h(t.position.x+n.x,t.position.y+n.y),z.free(n)}};function qy(t,e,i,n){if(ha(n)!==!1){var s=n.strokeWidth;s===0&&t instanceof Cn&&t.type===ne.Link&&t.adornedObject instanceof Xi&&(s=t.adornedObject.strokeWidth),s*=n.Ca,t instanceof ue&&t.ua!==null?(t=t.geometry.bounds,n.Ge(t.x-s/2,t.y-s/2,t.width+s,t.height+s)):t instanceof Cn&&t.adornedPart.ua!==null?(t=t.adornedPart.ua.bounds,n.Ge(t.x-s/2,t.y-s/2,t.width+s,t.height+s)):n.Ge(-(s/2),-(s/2),e+s,i+s),s=n.desiredSize,s.w()||n.ua===null?n.dc.h(0,0,s.width,s.height):n.dc.assign(n.ua.bounds),Hr(n,!1)}}function rd(){this.xa="Base"}gi(rd,So),rd.prototype.measure=function(t,e,i,n,s,a,l){var c=t.Pb();t.graduatedBounds=[];var f=c.margin,m=f.right+f.left,v=f.top+f.bottom;c.measure(e,i,a,l);var w=c.measuredBounds,C=new It(-f.left,-f.top,Math.max(w.width+m,0),Math.max(w.height+v,0));t.graduatedBounds.push(C),s.assign(C);for(var k=c.geometry,L=c.strokeWidth,A=k.flattenedSegments,H=k.flattenedLengths,R=k.flattenedTotalLength,X=A.length,Y=0,tt=0,st=Pe(),bt=0;bt<X;bt++){var Te=A[bt],Ke=[];tt=Y=0;for(var Oe=Te.length,he=0;he<Oe;he+=2){var Gt=Te[he],Wi=Te[he+1];if(he!==0){var Di=180*Math.atan2(Wi-tt,Gt-Y)/Math.PI;0>Di&&(Di+=360),Ke.push(Di)}Y=Gt,tt=Wi}st.push(Ke)}if(t.graduatedIntervals===null){for(var In=[],sr=t.O.s,is=sr.length,cs=0;cs<is;cs++){var ma=sr[cs],ns=[];if(In.push(ns),ma.visible){var yf=ma.interval;if(!(0>yf)){for(var xo=0;xo<is;xo++)if(xo!==cs){var vh=sr[xo];if(vh.visible&&ma.constructor===vh.constructor){var ga=vh.interval;ga>yf&&ns.push(ga)}}}}}t.graduatedIntervals=In}var xf=t.graduatedIntervals,Dl=t.O.s,mu=Dl.length,xl=0,nl=0,Cp=R;t.graduatedMarks=[];for(var yh,Ev=0;Ev<mu;Ev++){var wl=Dl[Ev];if(yh=[],wl.visible&&wl!==c){var va=Math.abs(wl.interval),jy=t.graduatedTickUnit;if(!(2>jy*va*R/t.graduatedRange&&wl.graduatedSkip===null)){var ng=H[0][0],Yh=0,rl=0;nl=R*wl.graduatedStart-1e-4,Cp=R*wl.graduatedEnd+1e-4;var I0=jy*va,bl=t.graduatedTickBase;if(bl<t.graduatedMin){var kp=(t.graduatedMin-bl)/I0;kp=kp%1===0?kp:Math.floor(kp+1),bl+=kp*I0}else bl>t.graduatedMin+I0&&(bl-=Math.floor((bl-t.graduatedMin)/I0)*I0);for(var Q1=xf[Ev],$y=bl,$x=1e-6*t.graduatedMax,Ic=1;bl<=t.graduatedMax+$x;Ic++){t:{for(var xd=Q1.length,rg=0;rg<xd;rg++){var Lp=(bl-t.graduatedTickBase)%(Q1[rg]*t.graduatedTickUnit),_v=1e-6*t.graduatedTickUnit;if(Lp<_v&&Lp>-_v){var Ep=!1;break t}}Ep=!0}if(Ep&&(bl>t.graduatedMax&&(bl=t.graduatedMax),wl.graduatedSkip===null||wl instanceof Wn&&!wl.graduatedSkip(bl,wl)||wl instanceof Xi&&!wl.graduatedSkip(bl,wl))&&(xl=(bl-t.graduatedMin)*R/t.graduatedRange,xl>R&&(xl=R),nl<=xl&&xl<=Cp)){for(var Oc=st[Yh][rl],wf=H[Yh][rl];Yh<H.length;){for(;xl>ng&&rl<H[Yh].length-1;)rl++,Oc=st[Yh][rl],wf=H[Yh][rl],ng+=wf;if(xl<=ng)break;Yh++,rl=0,Oc=st[Yh][rl],wf=H[Yh][rl],ng+=wf}var ol=A[Yh],Jh=ol[2*rl],tx=ol[2*rl+1],wd=(xl-(ng-wf))/wf,Tv=new z(Jh+(ol[2*rl+2]-Jh)*wd+L/2-k.bounds.x,tx+(ol[2*rl+3]-tx)*wd+L/2-k.bounds.y);Tv.scale(c.scale,c.scale);t:{var xh=Oc,O0=st[Yh];if(!(.5005>wd&&.4995<wd)){var qh=xh;if(.5>wd?0<rl?qh=O0[rl-1]:ht.$(ol[0],ol[ol.length-2])&&ht.$(ol[1],ol[ol.length-1])&&(qh=O0[O0.length-1]):.5<wd&&(rl+1<O0.length?qh=O0[rl+1]:ht.$(ol[0],ol[ol.length-2])&&ht.$(ol[1],ol[ol.length-1])&&(qh=O0[0])),xh!==qh){var og=Math.abs(xh-qh);if(180<og&&(xh<qh?xh+=360:qh+=360,og=Math.abs(xh-qh)),5e-4>wd||.9995<wd){Oc=(xh+qh)/2%360;break t}if(10>og){var Pv=1-Math.abs(.5-wd);Oc=(xh*Pv+qh*(1-Pv))%360;break t}}}Oc=xh}if(wl instanceof Wn){var Ru="";wl.graduatedFunction!==null?(Ru=wl.graduatedFunction(bl,wl),Ru=Ru!=null?Ru.toString():""):Ru=(+bl.toFixed(2)).toString(),Ru!==""&&yh.push({$l:Tv,angle:Oc,text:Ru})}else yh.push({$l:Tv,angle:Oc})}bl=$y+Ic*I0}}}t.graduatedMarks.push(yh)}qe(st);var Ss=t.graduatedMarks;if(Ss!==null)for(var Ky=n.length,Aa=0;Aa<Ky;Aa++){var wo=n[Aa],Da=Ss[Aa];if(wo.visible&&wo!==c&&Da.length!==0){if(wo instanceof Xi){var bd=t,bf=s,B0=wo.alignmentFocus;B0.Mc()&&(B0=Rr);var Kx=wo.angle;wo.Kb=0,wo.measure(1/0,1/0,0,0),wo.Kb=Kx;var ex=wo.measuredBounds,Nv=ex.width,F0=ex.height,sg=It.allocAt(0,0,Nv,F0),sl=z.alloc();sl.xi(sg,B0),It.free(sg);for(var Sd=-sl.x,wh=-sl.y,tu=new It,_p=Da.length,Av=0;Av<_p;Av++)for(var Tp=Da[Av],ix=Tp.$l.x,Dv=Tp.$l.y,io=Tp.angle,zu=0;4>zu;zu++){switch(zu){case 0:sl.h(Sd,wh);break;case 1:sl.h(Sd+Nv,wh);break;case 2:sl.h(Sd,wh+F0);break;case 3:sl.h(Sd+Nv,wh+F0)}sl.rotate(io+wo.angle),sl.offset(ix,Dv),Av===0&&zu===0?tu.h(sl.x,sl.y,0,0):tu.Ye(sl),sl.offset(-ix,-Dv),sl.rotate(-io-wo.angle)}z.free(sl),bd.graduatedBounds!==null&&bd.graduatedBounds.push(tu),vr(bf,tu.x,tu.y,tu.width,tu.height)}else if(wo instanceof Wn){var gu=t,nx=s;gu.temporaryTextBlock===null&&(gu.temporaryTextBlock=new Wn);var Sl=gu.temporaryTextBlock;jg(Sl,wo);var Sf=wo.alignmentFocus;Sf.Mc()&&(Sf=Rr);for(var vu=wo.segmentOrientation,Iv=wo.segmentOffset,Pp=new It,Hy=0,Ov=0,Qh=0,R0=0,Np=0,Bv=Da.length,Mf=0;Mf<Bv;Mf++){var Bc=Da[Mf];Hy=Bc.$l.x,Ov=Bc.$l.y,Qh=Bc.angle,Np=R0=wo.angle,vu!==ea&&(Np=vu===y0||vu===nv?Qh+wo.angle:Qh,R0=ue.computeAngle(vu,Np)),Sl.Kb=R0,Sl.text=Bc.text||"",Sl.measure(1/0,1/0,0,0);var Cf=Sl.measuredBounds,Md=Sl.naturalBounds,kf=Md.width,z0=Md.height,bh=nn.alloc();bh.reset(),bh.translate(-Cf.x,-Cf.y),bh.scale(Sl.scale,Sl.scale),bh.rotate(Np,kf/2,z0/2),vu!==lf&&vu!==x0||bh.rotate(90,kf/2,z0/2),vu!==zm&&vu!==jm||bh.rotate(-90,kf/2,z0/2),vu===rv&&(45<Qh&&135>Qh||225<Qh&&315>Qh)&&bh.rotate(-Qh,kf/2,z0/2);var ag=It.allocAt(0,0,kf,z0),Lf=z.alloc();Lf.xi(ag,Sf),bh.Ga(Lf);var lg=-Lf.x,Hx=-Lf.y,Cd=z.alloc();Cd.assign(Iv),isNaN(Cd.x)&&(Cd.x=kf/2+3),isNaN(Cd.y)&&(Cd.y=-(z0/2+3)),Cd.rotate(Qh),Hy+=Cd.x+lg,Ov+=Cd.y+Hx;var j0=new It(Hy,Ov,Cf.width,Cf.height),Vy=new It(Cf.x,Cf.y,Cf.width,Cf.height),Vx=new It(Md.x,Md.y,Md.width,Md.height);Bc.Sz=R0,Bc.lineCount=Sl.lineCount,Bc.lines=[Sl.Cb,Sl.Ih,Sl.df,Sl.Le,Sl.Qc,Sl.Qb,Sl.ze],Bc.actualBounds=j0,Bc.measuredBounds=Vy,Bc.naturalBounds=Vx,Mf===0?Pp.assign(j0):Pp.ed(j0),z.free(Cd),z.free(Lf),It.free(ag),nn.free(bh)}gu.graduatedBounds!==null&&gu.graduatedBounds.push(Pp),vr(nx,Pp.x,Pp.y,Pp.width,Pp.height)}Hr(wo,!1)}}},rd.prototype.arrange=function(t,e,i){if(t.graduatedBounds!==null){var n=t.Pb(),s=t.graduatedMarks;if(s!==null){var a=t.graduatedBounds,l=0,c=a[l];l++,n!==null&&n.arrange(c.x-i.x,c.y-i.y,c.width,c.height);for(var f=e.length,m=0;m<f;m++){var v=e[m];c=s[m],v.visible&&v!==n&&c.length!==0&&(c=a[l],l++,v.arrange(c.x-i.x,c.y-i.y,c.width,c.height))}t.graduatedBounds=null}}},rd.prototype.gc=function(t,e,i){var n=i.$i;i.$i=!0;var s=t.naturalBounds,a=s.width,l=s.height;s=e instanceof Bs,e.save(),e.beginPath(),e.rect(-1,-1,a+1,l+1),e.clip(),e.Se(),a=t.Pb(),a.gc(e,i),l=t.Df()*i.scale,0>=l&&(l=1);for(var c=a.actualBounds,f=t.O.s,m=t.graduatedMarks,v=f.length,w=0;w<v;w++){var C=f[w],k=m[w],L=k.length;if(C.visible&&C!==a&&k.length!==0){if(C instanceof Xi){if(!(2>t.graduatedTickUnit*C.interval*a.geometry.flattenedTotalLength/t.graduatedRange*l&&C.graduatedSkip===null)){var A=C.measuredBounds,H=C.strokeWidth*C.scale,R=C.alignmentFocus;R.Mc()&&(R=Rr);for(var X=0;X<L;X++){var Y=k[X].$l,tt=k[X].angle,st=R,bt=C.Ab;bt.reset(),bt.translate(Y.x+c.x,Y.y+c.y),bt.rotate(tt+C.angle,0,0),bt.translate(-A.width*st.x+st.offsetX+H/2,-A.height*st.y+st.offsetY+H/2),bt.scale(C.scale,C.scale),_l(C,!1),C.wh.set(C.Ab),C.Kk=C.scale,Ja(C,!1),C.gc(e,i),s&&(t.svg.appendChild(C.svg),C.svg=null),C.Ab.reset()}}}else if(C instanceof Wn)for(t.temporaryTextBlock===null&&(t.temporaryTextBlock=new Wn),A=t.temporaryTextBlock,jg(A,C),H=0;H<L;H++)R=k[H],R.actualBounds&&R.measuredBounds&&R.naturalBounds&&(A.ec=R.text||"",A.Kb=R.Sz||0,A.Gc=R.lineCount||0,X=R.lines,X!==void 0&&(A.Cb=X[0],A.Ih=X[1],A.df=X[2],A.Le=X[3],A.Qc=X[4],A.Qb=X[5],A.ze=X[6]),R.naturalBounds&&(A.dc=R.naturalBounds),R.actualBounds&&(X=R.actualBounds,A.arrange(X.x,X.y,X.width,X.height)),X=R.actualBounds,A.arrange(X.x,X.y,X.width,X.height),Y=R.measuredBounds,R=R.naturalBounds,tt=A.Ab,tt.reset(),tt.translate(X.x+c.x,X.y+c.y),tt.translate(-Y.x,-Y.y),A.no(tt,R.x,R.y,R.width,R.height),_l(A,!1),A.wh.set(A.Ab),A.Kk=A.scale,Ja(A,!1),A.Ng=C.part,A.Me=C.panel,A.gc(e,i),A.Me=null,A.Ng=null,s&&(t.svg.appendChild(A.svg),A.svg=null))}}i.$i=n,e.restore(),e.Vc(!0)};function ne(t,e){if(at.call(this),this.na=null,t===void 0)this.na=ne.Position;else if(typeof t=="string"){var i=Ta.I(t);i!==null&&(this.na=i)}else t instanceof So?this.na=t:t&&(this.na=ne.Position,e=t);this.na===null&&lt("Panel type not specified or PanelLayout not loaded: "+t),this.l=this.l|4194304|(this.na===ne.Grid?1048576:0),this.O=new Kt,this.yb=ro,this.Tm=zn,this.Uf=Vi,this.$g=null,this.$e="",this.jg=new It(NaN,NaN,NaN,NaN),this.T=this.F=null,this.xo=Ge,this.jn=po,this.kn=fn,this.ub=this.ra=null,this.zn=NaN,this.ge=this.Hh=null,e&&Object.assign(this,e)}gi(ne,at),ne.prototype.cloneProtected=function(t){at.prototype.cloneProtected.call(this,t),t.na=this.na,t.yb=this.yb.J(),t.Tm=this.Tm.J(),t.Uf=this.Uf,t.$e=this.$e,t.jg.assign(this.jg),this.T!==null&&(t.T=this.T.copy(t)),t.xo=this.xo,t.jn=this.jn.J(),t.kn=this.kn.J(),this.ra!==null&&(t.ra=this.ra.copy()),t.ub=this.ub,t.zn=this.zn,t.Hh=this.Hh},ne.prototype.Af=function(t){at.prototype.Af.call(this,t),t.O=this.O;for(var e=t.O.s,i=e.length,n=0;n<i;n++)e[n].Me=t;t.$g=null},ne.prototype.copy=function(){var t=at.prototype.copy.call(this);if(t!==null){for(var e=this.O.s,i=e.length,n=0;n<i;n++){var s=e[n].copy();s.wi(t),s.Ng=null;var a=t.O,l=a.count;if(a.Gb(l,s),a=t.part,a!==null){a.Rh=null,s.portId!==null&&a instanceof Le&&(a.Te=!0);var c=t.diagram;c!==null&&c.undoManager.isUndoingRedoing||a.cb(Yr,"elements",t,null,s,null,l)}}return t}return null},T=ne.prototype,T.toString=function(){return"Panel("+this.type.name+")#"+Ti(this)},T.Pn=function(t){at.prototype.Pn.call(this,t);for(var e=this.O.s,i=e.length,n=0;n<i;n++)e[n].Pn(t)},T.hh=function(t,e){if(this.na===ne.Grid)t.yc(),this.na.gc(this,t,e);else if(this.na===ne.Graduated)t.yc(),this.na.gc(this,t,e);else{if(this.na===ne.Table)if(t.yc(),t instanceof Bs){var i=t.yd;t.yd=Mg(t,"gojs-ts"),pm(this,t),t.nh.pop(),t.yd=i}else pm(this,t);(i=this.isClipping&&this.na===ne.Spot)&&t.save();for(var n=this.Pb(),s=this.O.s,a=s.length,l=0;l<a;l++){var c=s[l];i&&c===n&&(t.clipInsteadOfFill=!0),c.gc(t,e),i&&c===n&&(t.clipInsteadOfFill=!1)}i&&(t.restore(),t.Vc(!0))}};function pm(t,e){e.lineCap="butt";var i=0<t.rowCount?t.rowDefs:null,n=0<t.columnCount?t.colDefs:null;i!==null&&wc(t,e,!0,i,!0),n!==null&&wc(t,e,!1,n,!0),i!==null&&mm(t,e,!0,i),n!==null&&mm(t,e,!1,n),i!==null&&wc(t,e,!0,i,!1),n!==null&&wc(t,e,!1,n,!1)}function mm(t,e,i,n){for(var s=n.length,a=t.actualBounds,l=t.naturalBounds,c=!0,f=0;f<s;f++){var m=n[f];if(m!==void 0&&m.actual!==0)if(c)c=!1;else{if(i){if(m.position>l.height)continue}else if(m.position>l.width)continue;var v=m.separatorStrokeWidth;isNaN(v)&&(v=i?t.defaultRowSeparatorStrokeWidth:t.defaultColumnSeparatorStrokeWidth);var w=m.separatorStroke;if(w===null&&(w=i?t.defaultRowSeparatorStroke:t.defaultColumnSeparatorStroke),v!==0&&w!==null){Br(t,e,w,!1,!1,l,a),w=!1;var C=m.separatorDashArray;C===null&&(C=i?t.defaultRowSeparatorDashArray:t.defaultColumnSeparatorDashArray),C!==null&&(w=!0,e.js(C,0)),e.beginPath(),C=m.position+v,i?C>l.height&&(v-=C-l.height):C>l.width&&(v-=C-l.width),m=m.position+v/2,e.lineWidth=v,v=t.yb,i?(m+=v.top,C=l.width-v.right,e.moveTo(v.left,m),e.lineTo(C,m)):(m+=v.left,C=l.height-v.bottom,e.moveTo(m,v.top),e.lineTo(m,C)),e.stroke(),e.Se(),w&&e.fs()}}}}function wc(t,e,i,n,s){for(var a=n.length,l=t.actualBounds,c=t.naturalBounds,f=Qy(t,!0),m=Qy(t,!1),v=0;v<a;v++){var w=n[v];if(w!==void 0&&w.background!==null&&w.coversSeparators!==s&&w.actual!==0){var C=i?l.height:l.width;if(!(w.position>C)){var k=w.Wc(),L=w.separatorStrokeWidth;isNaN(L)&&(L=i?t.defaultRowSeparatorStrokeWidth:t.defaultColumnSeparatorStrokeWidth);var A=w.separatorStroke;A===null&&(A=i?t.defaultRowSeparatorStroke:t.defaultColumnSeparatorStroke),(A===null||w.index===(i?f:m))&&(L=0),k-=L,L=w.position+L,k+=w.actual,L+k>C&&(k=C-L),0>=k||(C=t.yb,Br(t,e,w.background,!0,!1,c,l),i?e.fillRect(C.left,L+C.top,l.width-(C.left+C.right),k):e.fillRect(L+C.left,C.top,k,l.height-(C.top+C.bottom)))}}}}function Qy(t,e){for(var i=e?t.rowCount:t.columnCount,n=0;n<i;n++){var s=e?t.rowDefs[n]:t.colDefs[n];if(s!==void 0)return s.index}return 0}function Zv(t){return t==="LineV"||t==="BarV"}T.lv=function(){for(var t=this.O.s,e=t.length,i=0;i<e;i++)t[i].lv();this.Uc=!0},T.kk=function(t,e,i){if(!at.prototype.kk.call(this,t,e,i))return!1;if(this.type===ne.Table)i=this.svg.getElementsByClassName("gojs-ts"),i=i.length!==0?i[0]:null,i!==null&&(i.innerHTML=""),t.yd=i,pm(this,t),t.yd=null;else if(this.na===ne.Grid||this.na===ne.Graduated)return this.svg.innerHTML="",this.svg.remove(),!1;i=this.O.s;for(var n=i.length,s=0;s<n;s++)i[s].gc(t,e);return!0},T.nk=function(){return!0},T.$o=function(t,e,i,n){if(!this.isClipping)if(this.Dd()&&t.bk!==null){t=t.bk,e=this.O.s;for(var s=0,a=0,l=0;l<e.length;l++)if(e[l].Ed()){var c=e[l].actualBounds;s=l===0?c.x:Math.min(c.x,s),a=l===0?c.y:Math.min(c.y,a)}n.setAttributeNS(null,"clip-path","path('M "+(t.x-i.x-s)+","+(t.y-i.y-a)+" l "+t.width+" 0 l 0 "+t.height+" l -"+t.width+" 0 z')")}else at.prototype.$o.call(this,t,e,i,n)},T.Sj=function(t,e,i,n,s){var a=this.se(),l=this.transform,c=1/(l.m11*l.m22-l.m12*l.m21),f=l.m22*c,m=-l.m12*c,v=-l.m21*c,w=l.m11*c,C=c*(l.m21*l.dy-l.m22*l.dx),k=c*(l.m12*l.dx-l.m11*l.dy);if(this.areaBackground!==null)return l=this.actualBounds,ht.Ff(l.left,l.top,l.right,l.bottom,t,e,i,n,s);if(this.background!==null)return a=t*f+e*v+C,c=t*m+e*w+k,t=i*f+n*v+C,f=i*m+n*w+k,s.h(0,0),i=this.naturalBounds,a=ht.Ff(0,0,i.width,i.height,a,c,t,f,s),s.transform(l),a;a||(f=1,v=m=0,w=1,k=C=0),c=t*f+e*v+C,t=t*m+e*w+k,f=i*f+n*v+C,i=i*m+n*w+k,s.h(f,i),n=(f-c)*(f-c)+(i-t)*(i-t),m=!1,w=this.O.s,k=w.length,v=z.alloc(),C=null,e=1/0;var L=null,A=this.isClipping&&this.na===ne.Spot;A&&(L=z.alloc(),C=this.Pb(),(m=C.Sj(c,t,f,i,L))&&(e=(c-L.x)*(c-L.x)+(t-L.y)*(t-L.y)));for(var H=0;H<k;H++){var R=w[H];R.visible&&R!==C&&R.Sj(c,t,f,i,v)&&(m=!0,R=(c-v.x)*(c-v.x)+(t-v.y)*(t-v.y),R<n&&(n=R,s.set(v)))}return A&&(e>n&&s.set(L),z.free(L)),z.free(v),a&&s.transform(l),m},T.Gj=function(){for(var t=this.O.s,e=t.length,i=0;i<e;i++)t[i].Gj();at.prototype.Gj.call(this)},T.v=function(t){if(!ha(this)){at.prototype.v.call(this,t),t=null,(this.na===ne.Auto||this.na===ne.Link)&&(t=this.Pb());for(var e=this.O.s,i=e.length,n=0;n<i;n++){var s=e[n];if((s===t||s.isPanelMain)&&s.v(!0),!s.desiredSize.w()){var a=Qs(s,!1);(s instanceof Zs||s instanceof ne||s instanceof Wn||a!==Yt)&&s.v(!0)}}}},T.Uj=function(){if(!ha(this)){Hr(this,!0),vs(this,!0);for(var t=this.O.s,e=t.length,i=0;i<e;i++)t[i].Uj()}},T.Uk=function(){if(!(this.l&2048)){_l(this,!0),Ja(this,!0);for(var t=this.O.s,e=t.length,i=0;i<e;i++)t[i].Wu()}},T.Wu=function(){Ja(this,!0);for(var t=this.O.s,e=t.length,i=0;i<e;i++)t[i].Wu()},T.Wl=function(t,e,i,n){var s=this.jg;s.h(0,0,0,0);var a=this.desiredSize,l=this.minSize;i===void 0&&(i=l.width,n=l.height),i=Math.max(i,l.width),n=Math.max(n,l.height);var c=this.maxSize;isNaN(a.width)||(t=Math.min(a.width,c.width)),isNaN(a.height)||(e=Math.min(a.height,c.height)),t=Math.max(i,t),e=Math.max(n,e);var f=this.yb;t=Math.max(t-f.left-f.right,0),e=Math.max(e-f.top-f.bottom,0);var m=this.O.s;m.length!==0&&this.na.measure(this,t,e,m,s,i,n),t=s.width+f.left+f.right,f=s.height+f.top+f.bottom,isFinite(a.width)&&(t=a.width),isFinite(a.height)&&(f=a.height),t=Math.min(c.width,t),f=Math.min(c.height,f),t=Math.max(l.width,t),f=Math.max(l.height,f),t=Math.max(i,t),f=Math.max(n,f),Lo(s,t,f),Lo(this.naturalBounds,t,f),this.Ge(0,0,t,f)},T.Pb=function(){if(this.$g===null){var t=this.O.s,e=t.length;if(e===0)return null;for(var i=0;i<e;i++){var n=t[i];if(n.isPanelMain===!0)return this.$g=n}this.$g=t[0]}return this.$g};function uu(t){return t.part!==null?t.part.locationObject:null}T.eh=function(t,e,i,n){var s=this.O.s;if(this.actualBounds.h(t,e,i,n),s.length!==0){if(!this.desiredSize.w()){t=Qs(this,!0);var a=this.measuredBounds;e=a.width,a=a.height;var l=this.Kg,c=l.left+l.right;switch(l=l.top+l.bottom,e===i&&a===n&&(t=Yt),t){case Yt:(e>i||a>n)&&(this.v(),this.measure(e>i?i:e,a>n?n:a,0,0));break;case ie:this.v(!0),this.measure(i+c,n+l,0,0);break;case si:this.v(!0),this.measure(i+c,a+l,0,0);break;case yi:this.v(!0),this.measure(e+c,n+l,0,0)}}this.na.arrange(this,s,this.jg)}},T.gh=function(t){var e=this.naturalBounds,i=uu(this);if(jr(0,0,e.width,e.height,t.x,t.y)){e=this.O.s;for(var n=e.length,s=z.allocAt(0,0);n--;){var a=e[n];if((a.visible||a===i)&&(Ji(s.set(t),a.transform),a.ca(s)))return z.free(s),!0}return z.free(s),!(this.Ma===null&&this.areaBackground===null)}return!1},T.ks=function(t){if(this.bindingId===t)return this;for(var e=this.O.s,i=e.length,n=0;n<i;n++){var s=e[n].ks(t);if(s!==null)return s}return null},T.qm=function(t,e){if(e(this,t),t instanceof ne){t=t.O.s;for(var i=t.length,n=0;n<i;n++)this.qm(t[n],e)}};function Hh(t,e){Vh(t,t,e)}function Vh(t,e,i){i(e),e=e.O.s;for(var n=e.length,s=0;s<n;s++){var a=e[s];a instanceof ne&&Vh(t,a,i)}}function cx(t,e){ip(t,t,e)}function ip(t,e,i){if(i(e),e instanceof ne){e=e.O.s;for(var n=e.length,s=0;s<n;s++)ip(t,e[s],i)}}T.Nl=function(t){return Gv(this,this,t)};function Gv(t,e,i){if(i(e))return e;if(e instanceof ne){e=e.O.s;for(var n=e.length,s=0;s<n;s++){var a=Gv(t,e[s],i);if(a!==null)return a}}return null}T.fb=function(t){if(this.name===t)return this;var e=this.O.s,i=e.length;this.Hh===null&&this.itemTemplateMap===null||(i=Xd(this));for(var n=0;n<i;n++){var s=e[n];if(s instanceof ne){var a=s.fb(t);if(a!==null)return a}if(s.name===t)return s}return null};function t1(t){t=t.O.s;for(var e=t.length,i=0,n=0;n<e;n++){var s=t[n];s instanceof ne?i=Math.max(i,t1(s)):s instanceof Xi&&(i=Math.max(i,s.ig/2*s.strokeMiterLimit*s.Df()))}return i}T.se=function(){return!(this.type===ne.TableRow||this.type===ne.TableColumn)};function bc(t){return t.type===ne.TableRow||t.type===ne.TableColumn}T.ic=function(t,e,i){if(this.pickable===!1||(e===void 0&&(e=null),i===void 0&&(i=null),Us(this)))return null;var n=this.naturalBounds,s=1/this.Df(),a=this.se(),l=a?t:Ji(z.allocAt(t.x,t.y),this.transform),c=this.diagram,f=10,m=5;if(c!==null&&(f=c.Ql("extraTouchArea"),m=f/2),jr(-(m*s),-(m*s),n.width+f*s,n.height+f*s,l.x,l.y)){if(!this.isAtomic){s=this.O.s;var v=s.length;if(c=z.alloc(),m=(f=this.isClipping&&this.na===ne.Spot)?this.Pb():null,f&&(m.se()?Ji(c.set(t),m.transform):c.set(t),!m.ca(c)))return z.free(c),a||z.free(l),null;for(var w=uu(this);v--;){var C=s[v];if((C.visible||C===w)&&(C.se()?Ji(c.set(t),C.transform):c.set(t),!f||C!==m)){var k=null;if(C instanceof ne?k=C.ic(c,e,i):C.pickable===!0&&C.ca(c)&&(k=C),k!==null&&(e!==null&&(k=e(k)),k!==null&&(i===null||i(k))))return z.free(c),a||z.free(l),k}}z.free(c)}return this.background===null&&this.areaBackground===null?(a||z.free(l),null):(t=jr(0,0,n.width,n.height,l.x,l.y)?this:null,a||z.free(l),t)}return a||z.free(l),null},T.ji=function(t,e,i,n){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);var s=this.naturalBounds,a=this.se(),l=a?t:Ji(z.allocAt(t.x,t.y),this.transform);if(s=jr(0,0,s.width,s.height,l.x,l.y),bc(this)||s){if(!this.isAtomic){for(var c=this.O.s,f=c.length,m=z.alloc(),v=uu(this);f--;){var w=c[f];if(w.visible||w===v){w.se()?Ji(m.set(t),w.transform):m.set(t);var C=w;w=w instanceof ne?w:null,(w!==null?w.ji(m,e,i,n):C.ca(m))&&C.pickable!==!1&&(e!==null&&(C=e(C)),C===null||i!==null&&!i(C)||n.add(C))}}z.free(m)}return a||z.free(l),s&&(this.background!==null||this.areaBackground!==null)}return a||z.free(l),!1},T.Cf=function(t,e,i,n,s,a){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);var l=a;if(a===void 0&&(l=nn.alloc(),l.reset()),l.multiply(this.transform),this.fh(t,l))return Ig(this,e,i,s),a===void 0&&nn.free(l),!0;if(this.Yc(t,l)){if(!this.isAtomic)for(var c=uu(this),f=this.O.s,m=f.length;m--;){var v=f[m];if(v.visible||v===c){var w=v.actualBounds,C=this.naturalBounds;w.x>C.width||w.y>C.height||0>w.x+w.width||0>w.y+w.height||(w=v,v=v instanceof ne?v:null,C=nn.alloc(),C.set(l),(v!==null?v.Cf(t,e,i,n,s,C):To(w,t,n,C))&&(e!==null&&(w=e(w)),w===null||i!==null&&!i(w)||s.add(w)),nn.free(C))}}return a===void 0&&nn.free(l),n}return a===void 0&&nn.free(l),!1};function Ig(t,e,i,n){for(var s=t.O.s,a=s.length;a--;){var l=s[a];if(l.visible){var c=l.actualBounds,f=t.naturalBounds;c.x>f.width||c.y>f.height||0>c.x+c.width||0>c.y+c.height||(l instanceof ne&&Ig(l,e,i,n),e!==null&&(l=e(l)),l===null||i!==null&&!i(l)||n.add(l))}}}T.og=function(t,e,i,n,s,a){if(this.pickable===!1)return!1;i===void 0&&(i=null),n===void 0&&(n=null);var l=this.naturalBounds,c=this.se(),f=c?t:Ji(z.allocAt(t.x,t.y),this.transform),m=c?e:Ji(z.allocAt(e.x,e.y),this.transform),v=f.Bf(m),w=0<f.x&&f.x<l.width&&0<f.y&&f.y<l.height||Fn(f.x,f.y,0,0,0,l.height)<=v||Fn(f.x,f.y,0,l.height,l.width,l.height)<=v||Fn(f.x,f.y,l.width,l.height,l.width,0)<=v||Fn(f.x,f.y,l.width,0,0,0)<=v;if(l=f.zd(0,0)<=v&&f.zd(0,l.height)<=v&&f.zd(l.width,0)<=v&&f.zd(l.width,l.height)<=v,c||(z.free(f),z.free(m)),w){if(!this.isAtomic){f=z.alloc(),m=z.alloc(),v=uu(this);for(var C=this.O.s,k=C.length;k--;){var L=C[k];if(L.visible||L===v){var A=L.actualBounds,H=this.naturalBounds;(!c||!(A.x>H.width||A.y>H.height||0>A.x+A.width||0>A.y+A.height))&&(L.se()?(A=L.transform,Ji(f.set(t),A),Ji(m.set(e),A)):(f.set(t),m.set(e)),A=L,L=L instanceof ne?L:null,(L!==null?L.og(f,m,i,n,s,a):A.tx(f,m,s))&&(i!==null&&(A=i(A)),A===null||n!==null&&!n(A)||a.add(A)))}}z.free(f),z.free(m)}return s?w:l}return!1};function Xv(t){var e=null;return t instanceof Xi&&(e=t.spot1,e===zn&&(e=null),t=t.geometry,t!==null&&e===null&&(e=t.spot1)),e===null&&(e=An),e}function Yv(t){var e=null;return t instanceof Xi&&(e=t.spot2,e===zn&&(e=null),t=t.geometry,t!==null&&e===null&&(e=t.spot2)),e===null&&(e=Go),e}T.add=function(t){for(var e=[],i=0;i<arguments.length;++i)e[i]=arguments[i];for(i=0;i<e.length;i++)this.Gb(this.O.count,e[i]);return this},T.M=function(t){return this.O.M(t)},T.Gb=function(t,e){e instanceof ui&&lt("Cannot add a Part to a Panel: "+e+"; use a Panel instead"),(this===e||this.rg(e))&&(this===e&&lt("Cannot make a Panel contain itself: "+this.toString()),lt("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+e.toString()));var i=e.panel;if(i!==null&&i!==this&&lt("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+e.toString()+", already contained by "+i.toString()+", cannot be shared by this Panel: "+this.toString()),this.na!==ne.Grid||e instanceof Xi||lt("Can only add Shapes to a Grid Panel, not: "+e),this.na!==ne.Graduated||e instanceof Xi||e instanceof Wn||lt("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+e),e.wi(this),e.Ng=null,this.itemArray!==null){var n=e.data;n!==null&&typeof n=="object"&&(this.ge===null&&(this.ge=new pe),this.ge.add(n,e))}var s=this.O;if(n=-1,i===this){for(var a=-1,l=this.O.s,c=l.length,f=0;f<c;f++)if(l[f]===e){a=f;break}if(a!==-1){if(a===t||a+1>=s.count&&t>=s.count)return;s.mb(a),n=a}else lt("element "+e.toString()+" has panel "+i.toString()+" but is not contained by it.")}(0>t||t>s.count)&&(t=s.count),s.Gb(t,e),(t===0||e.isPanelMain)&&(this.$g=null),ha(this)||this.v(),e.v(!1),e.portId!==null?this.Te=!0:e instanceof ne&&e.Te===!0&&(this.Te=!0),this.graduatedIntervals=null,this.If()||Og(this,e,!1),i=this.part,i!==null&&(i.Rh=null,i.ag=NaN,this.Te&&i instanceof Le&&(i.Te=!0),i.Te&&i instanceof Le&&(i.wc=null),s=this.diagram,s!==null&&s.undoManager.isUndoingRedoing||(n!==-1&&i.cb(Jr,"elements",this,e,null,n,null),i.cb(Yr,"elements",this,null,e,null,t)))};function gm(t,e){t.l=e?t.l|16777216:t.l&-16777217}T.remove=function(t){for(var e=this.O.s,i=e.length,n=-1,s=0;s<i;s++)if(e[s]===t){n=s;break}n!==-1&&this.pc(n,!0)},T.mb=function(t){0<=t&&this.pc(t,!0)},T.pc=function(t,e){var i=this.O,n=i.M(t);if(n.Ng=null,n.wi(null),this.ge!==null){var s=n.data;typeof s=="object"&&this.ge.remove(s)}i.mb(t),Hr(this,!1),this.v(),this.$g===n&&(this.$g=null),this.graduatedIntervals=null;var a=this.part;a!==null&&(a.Rh=null,a.ag=NaN,a.Wb(),a instanceof Le&&(n instanceof ne?n.qm(n,function(l,c){uy(a,c,e)}):uy(a,n,e)),i=this.diagram,i!==null&&i.undoManager.isUndoingRedoing||a.cb(Jr,"elements",this,n,null,t,null))},T.Fb=function(t){0>t&&me(t,">= 0",ne,"getRowDefinition:idx"),t=Math.round(t);var e=this.rowDefs;if(e[t]===void 0){var i=new vo;i.wi(this),i.isRow=!0,i.index=t,e[t]=i,this.cb(Yr,"rowdefs",this,null,i,null,t)}return e[t]},T.oA=function(t){if(0>t&&me(t,">= 0",ne,"removeRowDefinition:idx"),this.rowCount!==0){t=Math.round(t);var e=this.rowDefs,i=e[t];if(i){e[t]=void 0;for(var n=e.length-1;0<=n&&e[n--]===void 0;)e.length--;this.cb(Jr,"rowdefs",this,i,null,t,null),this.v()}}};function e1(t,e,i){var n=t.rowDefs;if(!(0>e)){if(n[e]=i instanceof vo?i:void 0,!i)for(e=n.length-1;0<=e&&n[e--]===void 0;)n.length--;t.v()}}T.Eb=function(t){0>t&&me(t,">= 0",ne,"getColumnDefinition:idx"),t=Math.round(t);var e=this.colDefs;if(e[t]===void 0){var i=new vo;i.wi(this),i.isRow=!1,i.index=t,e[t]=i,this.cb(Yr,"coldefs",this,null,i,null,t)}return e[t]},T.jA=function(t){if(0>t&&me(t,">= 0",ne,"removeColumnDefinition:idx"),this.columnCount!==0){t=Math.round(t);var e=this.colDefs,i=e[t];if(i){e[t]=void 0;for(var n=e.length-1;0<=n&&e[n--]===void 0;)e.length--;this.cb(Jr,"coldefs",this,i,null,t,null),this.v()}}};function i1(t,e,i){var n=t.colDefs;if(!(0>e)){if(n[e]=i instanceof vo?i:void 0,!i)for(e=n.length-1;0<=e&&n[e--]===void 0;)n.length--;t.v()}}T.Gy=function(t){var e=null;return t.isRow?e=this.Fb(t.index):t.isRow||(e=this.Eb(t.index)),e&&np(e,t),this},T.Hy=function(t,e){return(t=this.Fb(t))&&np(t,new vo(e)),this},T.By=function(t,e){return(t=this.Eb(t))&&np(t,new vo(e)),this},T.nz=function(t){if(0>t||this.type!==ne.Table||this.rowCount===0)return-1;for(var e=0,i=this.rowDefs,n=i.length,s=this.topIndex;s<n;s++){var a=i[s];if(a!==void 0&&(e+=a.total,t<e))break}return s},T.fz=function(t){if(0>t||this.type!==ne.Table||this.columnCount===0)return-1;for(var e=0,i=this.colDefs,n=i.length,s=this.leftIndex;s<n;s++){var a=i[s];if(a!==void 0&&(e+=a.total,t<e))break}return s},T.Fz=function(t,e){if(e===void 0&&(e=new z(NaN,NaN)),this.type!==ne.Graduated)return e.h(NaN,NaN),e;t=Math.min(Math.max(t,this.graduatedMin),this.graduatedMax);var i=this.Pb();return i.geometry.Pu((t-this.graduatedMin)/this.graduatedRange,e),i.transform.Ga(e)},T.Gz=function(t){if(this.type!==ne.Graduated)return NaN;var e=this.Pb();return e.transform.Cd(t),e.geometry.xx(t)*this.graduatedRange+this.graduatedMin};function n1(t){return t=t.allBindings,t!==null&&t._isFrozen}function _a(t){var e=t.allBindings;if(e===null)t.data!==null&&lt("Template cannot have .data be non-null: "+t),t.allBindings=e=new Kt;else if(e._isFrozen)return;var i=new Kt;gm(t,!1),t.qm(t,function(m,v){v.th();var w=v.localBindings;if(w!==null)for($d(v,!1),w=w.iterator;w.next();){var C=w.value;C.mode===Um&&$d(v,!0);var k=C.sourceName;k!==null&&(k==="/"&&gm(m,!0),k=Ty(C,m,v),k!==null&&(i.add(k),k.srcBindings===null&&(k.srcBindings=new Kt),k.srcBindings.add(C))),e.add(C)}if(v instanceof ne&&v.type===ne.Table){if(0<v.rowCount){for(m=v.rowDefs,w=m.length,C=0;C<w;C++)if(k=m[C],k!==void 0&&k.be!==null)for(var L=k.be.iterator;L.next();){var A=L.value;A.xd=k,A.to=2,A.wl=k.index,e.add(A)}}if(0<v.columnCount){for(v=v.colDefs,m=v.length,w=0;w<m;w++)if(C=v[w],C!==void 0&&C.be!==null)for(k=C.be.iterator;k.next();)L=k.value,L.xd=C,L.to=1,L.wl=C.index,e.add(L)}}});for(var n=i.iterator;n.next();){var s=n.value;if(s.srcBindings!==null){$d(s,!0);for(var a=s.srcBindings.iterator;a.next();){var l=a.value;s.localBindings===null&&(s.localBindings=new Kt),s.localBindings.add(l)}}s.srcBindings=null}for(n=e.iterator;n.next();)if(s=n.value,a=s.xd,a!==null){s.xd=null;var c=s.targetProperty,f=c.indexOf(".");0<f&&a instanceof ne&&(l=c.substring(0,f),c=c.substr(f+1),f=a.fb(l),f!==null?(a=f,s.targetProperty=c):Fe('Warning: unable to find GraphObject named "'+l+'" for Binding: '+s.toString())),a instanceof vo?(l=Ti(a.panel),s.Ai=l===void 0?-1:l,a.panel.bindingId=s.Ai):a instanceof at?(l=Ti(a),s.Ai=l===void 0?-1:l,a.bindingId=s.Ai):lt("Unknown type of binding target: "+a)}e.freeze(),t instanceof ui&&t.Zc()&&t.Va()}T.Uy=function(t){t===void 0&&(t=!1);var e=this.copy();return cx(e,function(i){i instanceof ne&&(i.allBindings=null,i.ub=null);var n=i.localBindings;n!==null&&(i.localBindings=null,n.each(function(s){i.bind(s.copy())})),n=i.animationTriggers,n!==null&&(i.animationTriggers=null,n.each(function(s){i.Jv(s.value.copy())}))}),t&&_a(e),e},T.La=function(t){var e=this.allBindings;if(e!==null)for(t===void 0&&(t=""),e=e.iterator;e.next();){var i=e.value,n=i.sourceProperty;if((t===""||n===""||n===t)&&(n=i.targetProperty,i.converter!==null||n!=="")){n=this.data;var s=i.sourceName;if(s!==null){if(s==="")n=this;else if(s==="/")n=this;else if(s===".")n=this;else if(s==="..")n=this;else if(n=this.fb(s),n===null)continue}else if(i.isToModel)if(n=this.diagram,n!==null)n=n.model.modelData;else continue;var a=this,l=i.Ai;if(l!==-1){if(a=this.ks(l),a===null)continue}else i.xd!==null&&(a=i.xd);if(s==="/"?n=a.part:s==="."?n=a:s===".."&&(n=a.panel),s=i.to,s!==0){if(!(a instanceof ne))continue;s===1?a=a.Eb(i.wl):s===2&&(a=a.Fb(i.wl))}a!==void 0&&i.Mv(a,n)}}},T.sx=function(t){return t==null||this.ge===null?null:this.ge.I(t)};function r1(t,e){t=t.O.s;for(var i=t.length,n=e.length,s=0,a=null;s<i&&(a=t[s],!(a instanceof ne&&a.data!==null));)s++,a=t[s];if(i-s!==n)return!0;if(a===null)return 0<n;for(var l=0;s<i&&l<n;){if(a=t[s],!(a instanceof ne)||a.data!==e[l])return!0;s++,l++}return!1}function Xd(t){if(t.type===ne.Spot||t.type===ne.Auto)return Math.min(t.O.length,1);if(t.type===ne.Link){t=t.O;for(var e=t.length,i=0;i<e;i++){var n=t.M(i);if(!(n instanceof Xi&&n.isPanelMain))break}return i}return t.type===ne.Table&&0<t.O.length&&(t=t.O.M(0),t.isPanelMain&&t instanceof ne&&bc(t))?1:0}T.mv=function(){for(var t=Xd(this);this.O.length>t;)this.pc(this.O.length-1,!1);i0(this,this.itemArray)};function i0(t,e){var i=Xd(t);if(e===null||e.length===0)for(;t.O.length>i;)t.pc(t.O.length-1,!1);else if(t.O.length<=i){i=e.length;for(var n=0;n<i;n++)vm(t,e[n],n,!0)}else{n=i;for(var s=0;s<e.length;s++,n++){var a=e[s],l=n<t.O.length?t.O.M(n):null;if(l instanceof ne){if(l.data!==a){var c=n0(t,l.data),f=n0(t,a),m=f!==c;m||(c=ym(t,c),m=ym(t,f)!==c),m?(t.pc(n,!1),vm(t,a,s,!1)):l.data=a}}else vm(t,a,s,!1)}for(;n<t.O.length;)t.pc(n,!1);t.$g=null,Yd(t,i,0),ha(t)||t.v(),t.graduatedIntervals=null,t.If()||Og(t,t,!1),e=t.part,e!==null&&(e.Rh=null,e.ag=NaN,t.Te&&e instanceof Le&&(e.Te=!0),e.Te&&e instanceof Le&&(e.wc=null))}}function vm(t,e,i,n){if(!(e==null||0>i)){var s=n0(t,e);if(s=ym(t,s),s!==null){if(_a(s),s=s.copy(),s.l&16777216){var a=t.ih();a!==null&&gm(a,!0)}typeof e=="object"&&(t.ge===null&&(t.ge=new pe),t.ge.add(e,s)),a=i+Xd(t),t.Gb(a,s),n&&(s.ub=e,Yd(t,a,i),s.ub=null),s.data=e}}}function Yd(t,e,i){for(t=t.O;e<t.length;){var n=t.M(e);if(n instanceof ne){var s=e,a=i;n.type===ne.TableRow?n.row=s:n.type===ne.TableColumn&&(n.column=s),n.itemIndex=a}e++,i++}}function n0(t,e){if(e===null)return"";if(t=t.itemCategoryProperty,typeof t=="function")t=t(e);else if(typeof t=="string"&&typeof e=="object"){if(t==="")return"";t=eo(e,t)}else return"";if(t===void 0)return"";if(typeof t=="string")return t;lt("Panel.getCategoryForItemData found a non-string category for "+e+": "+t)}function ym(t,e){var i=t.itemTemplateMap,n=null;return i!==null&&(n=i.I(e)),n===null&&(i!==null&&(n=i.I("")),n===null&&(Bg||(Bg=!0,Fe('No item template Panel found for category "'+e+'" on '+t),Fe(" Using default item template."),t=new ne,e=new Wn,e.bind(new Un("text","",ni)),t.add(e),xm=t),n=xm)),n}function Og(t,e,i){var n=e.enabledChanged;if(n!==null&&n(e,i),e instanceof ne){e=e.O.s,n=e.length;for(var s=0;s<n;s++){var a=e[s];i&&a instanceof ne&&!a.isEnabled||Og(t,a,i)}}}function _u(t,e){e.name=t,Ta.add(t,e)}ct.Object.defineProperties(ne.prototype,{type:{get:function(){return this.na},set:function(t){var e=this.na;e!==t&&(this.na=t,this.isAtomic=this.na===ne.Grid,this.v(),this.g("type",e,t))}},elements:{get:function(){return this.O.iterator}},naturalBounds:{get:function(){return this.dc}},padding:{get:function(){return this.yb},set:function(t){typeof t=="number"?(0>t&&me(t,">= 0",ne,"padding"),t=new ai(t)):(0>t.left&&me(t.left,">= 0",ne,"padding:value.left"),0>t.right&&me(t.right,">= 0",ne,"padding:value.right"),0>t.top&&me(t.top,">= 0",ne,"padding:value.top"),0>t.bottom&&me(t.bottom,">= 0",ne,"padding:value.bottom"));var e=this.yb;e.D(t)||(this.yb=t=t.J(),this.v(),this.g("padding",e,t))}},defaultAlignment:{get:function(){return this.Tm},set:function(t){var e=this.Tm;e.D(t)||(this.Tm=t=t.J(),this.v(),this.g("defaultAlignment",e,t))}},defaultStretch:{get:function(){return this.Uf},set:function(t){var e=this.Uf;e!==t&&(this.Uf=t,this.v(),this.g("defaultStretch",e,t))}},defaultSeparatorPadding:{get:function(){return this.T!==null?this.T.Qp:ro},set:function(t){typeof t=="number"&&(t=new ai(t));var e=this.defaultSeparatorPadding;e.D(t)||(t=t.J(),this.T===null&&(this.T=new pl),this.T.Qp=t,this.v(),this.g("defaultSeparatorPadding",e,t))}},defaultRowSeparatorStroke:{get:function(){return this.T!==null?this.T.ia:null},set:function(t){var e=this.defaultRowSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof Tn)&&(t instanceof Tn&&t.freeze(),this.T===null&&(this.T=new pl),this.T.ia=t,this.N(),this.g("defaultRowSeparatorStroke",e,t))}},defaultRowSeparatorStrokeWidth:{get:function(){return this.T!==null?this.T.Ha:1},set:function(t){var e=this.defaultRowSeparatorStrokeWidth;e!==t&&isFinite(t)&&0<=t&&(this.T===null&&(this.T=new pl),this.T.Ha=t,this.v(),this.g("defaultRowSeparatorStrokeWidth",e,t))}},defaultRowSeparatorDashArray:{get:function(){return this.T!==null?this.T.V:null},set:function(t){var e=this.defaultRowSeparatorDashArray;if(e!==t){if(t!==null){for(var i=t.length,n=0,s=0;s<i;s++){var a=t[s];typeof a=="number"&&0<=a&&isFinite(a)||lt("defaultRowSeparatorDashArray value "+a+" at index "+s+" must be a positive number or zero."),n+=a}if(n===0){if(e===null)return;t=null}}this.T===null&&(this.T=new pl),this.T.V=t,this.N(),this.g("defaultRowSeparatorDashArray",e,t)}}},defaultColumnSeparatorStroke:{get:function(){return this.T!==null?this.T.u:null},set:function(t){var e=this.defaultColumnSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof Tn)&&(t instanceof Tn&&t.freeze(),this.T===null&&(this.T=new pl),this.T.u=t,this.N(),this.g("defaultColumnSeparatorStroke",e,t))}},defaultColumnSeparatorStrokeWidth:{get:function(){return this.T!==null?this.T.F:1},set:function(t){var e=this.defaultColumnSeparatorStrokeWidth;e!==t&&isFinite(t)&&0<=t&&(this.T===null&&(this.T=new pl),this.T.F=t,this.v(),this.g("defaultColumnSeparatorStrokeWidth",e,t))}},defaultColumnSeparatorDashArray:{get:function(){return this.T!==null?this.T.o:null},set:function(t){var e=this.defaultColumnSeparatorDashArray;if(e!==t){if(t!==null){for(var i=t.length,n=0,s=0;s<i;s++){var a=t[s];typeof a=="number"&&0<=a&&isFinite(a)||lt("defaultColumnSeparatorDashArray value "+a+" at index "+s+" must be a positive number or zero."),n+=a}if(n===0){if(e===null)return;t=null}}this.T===null&&(this.T=new pl),this.T.o=t,this.N(),this.g("defaultColumnSeparatorDashArray",e,t)}}},inRowsCols:{get:function(){return this.T!==null?this.T.nb:null},set:function(t){this.T===null&&(this.T=new pl),this.T.nb=t}},viewboxStretch:{get:function(){return this.xo},set:function(t){var e=this.xo;e!==t&&(this.xo=t,this.v(),this.g("viewboxStretch",e,t))}},gridCellSize:{get:function(){return this.jn},set:function(t){var e=this.jn;if(!e.D(t)){t.w()&&t.width!==0&&t.height!==0||lt("Invalid Panel.gridCellSize: "+t),this.jn=t.J();var i=this.diagram;i!==null&&this===i.grid&&Cu(i),this.N(),this.g("gridCellSize",e,t)}}},gridOrigin:{get:function(){return this.kn},set:function(t){var e=this.kn;if(!e.D(t)){t.w()||lt("Invalid Panel.gridOrigin: "+t),this.kn=t.J();var i=this.diagram;i!==null&&this===i.grid&&Cu(i),this.N(),this.g("gridOrigin",e,t)}}},graduatedMin:{get:function(){return this.ra!==null?this.ra.lq:0},set:function(t){var e=this.graduatedMin;e!==t&&(this.ra===null&&(this.ra=new Wh),this.ra.lq=t,this.v(),this.g("graduatedMin",e,t),as(this)&&(t=this.part,t!==null&&lr(this,t,"graduatedRange")))}},graduatedMax:{get:function(){return this.ra!==null?this.ra.F:100},set:function(t){var e=this.graduatedMax;e!==t&&(this.ra===null&&(this.ra=new Wh),this.ra.F=t,this.v(),this.g("graduatedMax",e,t),as(this)&&(t=this.part,t!==null&&lr(this,t,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return this.ra!==null?this.ra.ia:10},set:function(t){var e=this.graduatedTickUnit;e!==t&&0<t&&(this.ra===null&&(this.ra=new Wh),this.ra.ia=t,this.v(),this.g("graduatedTickUnit",e,t))}},graduatedTickBase:{get:function(){return this.ra!==null?this.ra.V:0},set:function(t){var e=this.graduatedTickBase;e!==t&&(this.ra===null&&(this.ra=new Wh),this.ra.V=t,this.v(),this.g("graduatedTickBase",e,t))}},graduatedMarks:{get:function(){return this.ra!==null?this.ra.u:null},set:function(t){this.ra!==null?this.ra.u=t:t!==null&&(this.ra=new Wh,this.ra.u=t)}},graduatedBounds:{get:function(){return this.ra!==null?this.ra.j:null},set:function(t){this.ra!==null?this.ra.j=t:t!==null&&(this.ra=new Wh,this.ra.j=t)}},graduatedIntervals:{get:function(){return this.ra!==null?this.ra.o:null},set:function(t){this.ra!==null?this.ra.o=t:t!==null&&(this.ra=new Wh,this.ra.o=t)}},temporaryTextBlock:{get:function(){return this.ra!==null?this.ra.Zh:null},set:function(t){this.ra!==null?this.ra.Zh=t:t!==null&&(this.ra=new Wh,this.ra.Zh=t)}},panelLayoutState:{get:function(){return this.F},set:function(t){this.F=t}},Te:{get:function(){return(this.l&8388608)!==0},set:function(t){(this.l&8388608)!==0!==t&&(this.l^=8388608)}},rowDefs:{get:function(){return this.T===null&&(this.T=new pl),this.T.Pc}},rowCount:{get:function(){return this.T===null?0:this.rowDefs.length}},colDefs:{get:function(){return this.T===null&&(this.T=new pl),this.T.Oc}},columnCount:{get:function(){return this.T===null?0:this.colDefs.length}},rowSizing:{get:function(){return this.T!==null?this.T.ob:bm},set:function(t){var e=this.rowSizing;e!==t&&(this.T===null&&(this.T=new pl),this.T.ob=t,this.v(),this.g("rowSizing",e,t))}},columnSizing:{get:function(){return this.T!==null?this.T.j:bm},set:function(t){var e=this.columnSizing;e!==t&&(this.T===null&&(this.T=new pl),this.T.j=t,this.v(),this.g("columnSizing",e,t))}},topIndex:{get:function(){return this.T!==null?this.T.Hb:0},set:function(t){var e=this.topIndex;e!==t&&((!isFinite(t)||0>t)&&lt("Panel.topIndex must be greater than zero and a real number, not: "+t),this.T===null&&(this.T=new pl),this.T.Hb=t,this.v(),this.g("topIndex",e,t))}},leftIndex:{get:function(){return this.T!==null?this.T.hb:0},set:function(t){var e=this.leftIndex;e!==t&&((!isFinite(t)||0>t)&&lt("Panel.leftIndex must be greater than zero and a real number, not: "+t),this.T===null&&(this.T=new pl),this.T.hb=t,this.v(),this.g("leftIndex",e,t))}},data:{get:function(){return this.ub},set:function(t){var e=this.ub;if(e!==t){var i=this instanceof ui&&!(this instanceof Cn);_a(this),this.ub=t;var n=this.diagram;n!==null&&(i?(i=n.partManager,this instanceof ue?(e!==null&&i.bf.remove(e),t!==null&&i.bf.add(t,this)):this instanceof ui&&(e!==null&&i.cf.remove(e),t!==null&&i.cf.add(t,this))):(i=this.panel,i!==null&&i.ge!==null&&(e!==null&&i.ge.remove(e),t!==null&&i.ge.add(t,this)))),this.g("data",e,t),n!==null&&n.undoManager.isUndoingRedoing||t!==null&&this.La()}}},itemIndex:{get:function(){return this.zn},set:function(t){var e=this.zn;e!==t&&(this.zn=t,this.g("itemIndex",e,t))}},allBindings:{get:function(){return this.A!==null?this.A.nb:null},set:function(t){this.localBindings!==t&&(this.A===null&&(this.A=new Kd),this.A.nb=t)}},itemArray:{get:function(){return this.Hh},set:function(t){var e=this.Hh;if(e!==t||t!==null&&r1(this,t)){var i=this.diagram;e!==t&&(i!==null&&e!==null&&dd(i.partManager,this,i),this.Hh=t,i!==null&&t!==null&&Gr(i.partManager,this)),this.g("itemArray",e,t),i!==null&&i.undoManager.isUndoingRedoing||i0(this,t)}}},itemTemplate:{get:function(){return this.itemTemplateMap===null?null:this.itemTemplateMap.I("")},set:function(t){if(this.itemTemplateMap===null){if(t===null)return;this.itemTemplateMap=new pe}var e=this.itemTemplateMap.I("");e!==t&&((t instanceof ui||t.isPanelMain)&&lt("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+t),this.itemTemplateMap.add("",t),this.g("itemTemplate",e,t),t=this.diagram,t!==null&&t.undoManager.isUndoingRedoing||this.mv())}},itemTemplateMap:{get:function(){return this.A!==null?this.A.Pc:null},set:function(t){var e=this.itemTemplateMap;if(e!==t){for(var i=t.iterator;i.next(););en(this),this.A.Pc=t,this.g("itemTemplateMap",e,t),t=this.diagram,t!==null&&t.undoManager.isUndoingRedoing||this.mv()}}},itemCategoryProperty:{get:function(){return this.A!==null?this.A.Oc:"category"},set:function(t){var e=this.itemCategoryProperty;e!==t&&(en(this),this.A.Oc=t,this.g("itemCategoryProperty",e,t))}},isAtomic:{get:function(){return(this.l&1048576)!==0},set:function(t){var e=(this.l&1048576)!==0;e!==t&&(this.l^=1048576,this.g("isAtomic",e,t))}},isClipping:{get:function(){return(this.l&2097152)!==0},set:function(t){var e=(this.l&2097152)!==0;e!==t&&(this.l^=2097152,this instanceof ji&&(this.tb=null),this.v(),this.g("isClipping",e,t))}},isOpposite:{get:function(){return(this.l&33554432)!==0},set:function(t){var e=(this.l&33554432)!==0;e!==t&&(this.l^=33554432,this.v(),this.g("isOpposite",e,t))}},isEnabled:{get:function(){return(this.l&4194304)!==0},set:function(t){var e=(this.l&4194304)!==0;if(e!==t){var i=this.panel===null||this.panel.If();this.l^=4194304,this.g("isEnabled",e,t),e=this.diagram,e!==null&&e.undoManager.isUndoingRedoing||i&&Og(this,this,t)}}},alignmentFocusName:{get:function(){return this.$e},set:function(t){var e=this.$e;e!==t&&(this.$e=t,this.v(),this.g("alignmentFocusName",e,t))}}}),ct.Object.defineProperties(ne,{Position:{get:function(){return Ta.I("Position")}},Horizontal:{get:function(){return Ta.I("Horizontal")}},Vertical:{get:function(){return Ta.I("Vertical")}},Spot:{get:function(){return Ta.I("Spot")}},Auto:{get:function(){return Ta.I("Auto")}},Table:{get:function(){return Ta.I("Table")}},Viewbox:{get:function(){return Ta.I("Viewbox")}},TableRow:{get:function(){return Ta.I("TableRow")}},TableColumn:{get:function(){return Ta.I("TableColumn")}},Link:{get:function(){return Ta.I("Link")}},Grid:{get:function(){return Ta.I("Grid")}},Graduated:{get:function(){return Ta.I("Graduated")}}}),ne.prototype.rebuildItemElements=ne.prototype.mv,ne.prototype.findItemPanelForData=ne.prototype.sx,ne.prototype.updateTargetBindings=ne.prototype.La,ne.prototype.copyTemplate=ne.prototype.Uy,ne.prototype.graduatedValueForPoint=ne.prototype.Gz,ne.prototype.graduatedPointForValue=ne.prototype.Fz,ne.prototype.findColumnForLocalX=ne.prototype.fz,ne.prototype.findRowForLocalY=ne.prototype.nz,ne.prototype.addColumnDefinition=ne.prototype.By,ne.prototype.addRowDefinition=ne.prototype.Hy,ne.prototype.addRowColumnDefinition=ne.prototype.Gy,ne.prototype.removeColumnDefinition=ne.prototype.jA,ne.prototype.getColumnDefinition=ne.prototype.Eb,ne.prototype.removeRowDefinition=ne.prototype.oA,ne.prototype.getRowDefinition=ne.prototype.Fb,ne.prototype.removeAt=ne.prototype.mb,ne.prototype.remove=ne.prototype.remove,ne.prototype.insertAt=ne.prototype.Gb,ne.prototype.elt=ne.prototype.M,ne.prototype.add=ne.prototype.add,ne.prototype.findObject=ne.prototype.fb,ne.prototype.findInVisualTree=ne.prototype.Nl,ne.prototype.walkVisualTreeFrom=ne.prototype.qm,ne.prototype.findMainElement=ne.prototype.Pb;var Bg=!1,xm=null,Ta=new pe;ne.className="Panel",ne.definePanelLayout=_u,_u("Position",new _g),_u("Vertical",new Pg),_u("Auto",new Ng),_u("Link",new Dg);function Wh(){this.lq=0,this.F=100,this.ia=10,this.V=0,this.Zh=this.o=this.j=this.u=null}Wh.prototype.copy=function(){var t=new Wh;return t.lq=this.lq,t.F=this.F,t.ia=this.ia,t.V=this.V,t.u=this.u,t.j=this.j,t.o=this.o,t.Zh=this.Zh,t},Wh.className="GradPanelSettings";function pl(){this.Pc=[],this.Oc=[],this.j=this.ob=bm,this.hb=this.Hb=0,this.Qp=ro,this.Ha=1,this.V=this.ia=null,this.F=1,this.nb=this.o=this.u=null}pl.prototype.copy=function(t){for(var e=new pl,i=this.Pc,n=i.length,s=e.Pc,a=0;a<n;a++)if(i[a]!==void 0){var l=i[a].copy();l.wi(t),s[a]=l}for(i=this.Oc,n=i.length,s=e.Oc,a=0;a<n;a++)i[a]!==void 0&&(l=i[a].copy(),l.wi(t),s[a]=l);return e.ob=this.ob,e.j=this.j,e.Hb=this.Hb,e.hb=this.hb,e.Qp=this.Qp.J(),e.Ha=this.Ha,e.ia=this.ia,e.V=this.V,e.F=this.F,e.u=this.u,e.o=this.o,e.nb=this.nb,e},pl.className="TablePanelSettings";function vo(t){vi(this),this.Me=null,this.uq=!0,this.Za=0,this.Hc=NaN,this.jj=0,this.hj=1/0,this.Jb=zn,this.pa=this.oc=this.oa=0,this.be=null,this.oo=Fg,this.hg=Vi,this.lo=this.dg=null,this.mo=NaN,this.Ma=this.tj=null,this.Pm=!1,t&&(Object.assign(this,t),t.column!==void 0?(this.isRow=!1,this.index=t.column):t.row!==void 0&&(this.isRow=!0,this.index=t.row))}vo.prototype.copy=function(){var t=new vo;return t.uq=this.uq,t.Za=this.Za,t.Hc=this.Hc,t.jj=this.jj,t.hj=this.hj,t.Jb=this.Jb,t.oa=this.oa,t.oc=this.oc,t.pa=this.pa,t.hg=this.hg,t.oo=this.oo,this.dg===null?t.dg=null:t.dg=this.dg.J(),t.lo=this.lo,t.mo=this.mo,t.tj=null,this.tj!==null&&(t.separatorDashArray=bi(this.separatorDashArray)),t.Ma=this.Ma,t.Pm=this.Pm,t.be=this.be,t};function np(t,e){e.isRow?t.height=e.height:t.width=e.width,t.minimum=e.minimum,t.maximum=e.maximum,t.alignment=e.alignment,t.stretch=e.stretch,t.sizing=e.sizing,t.dg=e.separatorPadding===null?null:e.separatorPadding.J(),t.separatorStroke=e.separatorStroke,t.separatorStrokeWidth=e.separatorStrokeWidth,t.tj=null,e.separatorDashArray&&(t.tj=bi(e.separatorDashArray)),t.background=e.background,t.coversSeparators=e.coversSeparators,t.be=e.be}T=vo.prototype,T.qb=function(t){t.classType===vo&&(this.sizing=t)},T.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+Ti(this)},T.wi=function(t){this.Me=t},T.Io=function(t){var e=0,i=this.Me;if(this.index!==t&&(t=this.separatorStroke,t===null&&i!==null&&(t=this.isRow?i.defaultRowSeparatorStroke:i.defaultColumnSeparatorStroke),t!==null&&(e=this.separatorStrokeWidth,isNaN(e)&&(i!==null?e=this.isRow?i.defaultRowSeparatorStrokeWidth:i.defaultColumnSeparatorStrokeWidth:e=0))),t=this.dg,t===null)if(i!==null)t=i.defaultSeparatorPadding;else return e;return e+(this.isRow?t.top:t.left)},T.Wc=function(){var t=0,e=this.Me,i=0,n=this.isRow;if(e!==null&&e.type===ne.Table)for(var s=n?e.rowDefs.length:e.colDefs.length,a=0;a<s;a++){var l=n?e.rowDefs[a]:e.colDefs[a];if(l!==void 0&&l.oa!==0){i=l.index;break}}if(this.index!==i&&(i=this.separatorStroke,i===null&&e!==null&&(i=n?e.defaultRowSeparatorStroke:e.defaultColumnSeparatorStroke),i!==null&&(t=this.separatorStrokeWidth,isNaN(t)&&(e!==null?t=n?e.defaultRowSeparatorStrokeWidth:e.defaultColumnSeparatorStrokeWidth:t=0))),n=this.dg,n===null)if(e!==null)n=e.defaultSeparatorPadding;else return t;return t+(this.isRow?n.top+n.bottom:n.left+n.right)},T.Ob=function(t,e,i){var n=this.Me;if(n!==null&&(n.cb(Sr,t,this,e,i,void 0,void 0),this.be!==null&&(e=n.diagram,e!==null&&!e.skipsModelSourceBindings&&(n=n.ih(),n!==null&&(e=n.data,e!==null)))))for(i=this.be.iterator;i.next();)i.value.sp(this,e,t,n)};function wm(t){if(t.sizing===Fg){var e=t.Me;return t.isRow?e.rowSizing:e.columnSizing}return t.sizing}T.bind=function(t,e,i,n){var s=null;return typeof t=="string"?s=new Un(t,e,i,n):s=t,s.xd=this,t=this.panel,t!==null&&(e=t.ih(),e!==null&&n1(e)&&lt("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+s+" on "+t)),this.be===null&&(this.be=new Kt),this.be.add(s),this},ct.Object.defineProperties(vo.prototype,{panel:{get:function(){return this.Me}},isRow:{get:function(){return this.uq},set:function(t){this.uq=t}},index:{get:function(){return this.Za},set:function(t){this.Za=t}},height:{get:function(){return this.Hc},set:function(t){var e=this.Hc;e!==t&&(0>t&&me(t,">= 0",vo,"height"),this.Hc=t,this.actual=this.oa,this.panel!==null&&this.panel.v(),this.Ob("height",e,t))}},width:{get:function(){return this.Hc},set:function(t){var e=this.Hc;e!==t&&(0>t&&me(t,">= 0",vo,"width"),this.Hc=t,this.actual=this.oa,this.panel!==null&&this.panel.v(),this.Ob("width",e,t))}},minimum:{get:function(){return this.jj},set:function(t){var e=this.jj;e!==t&&((0>t||!isFinite(t))&&me(t,">= 0",vo,"minimum"),this.jj=t,this.actual=this.oa,this.panel!==null&&this.panel.v(),this.Ob("minimum",e,t))}},maximum:{get:function(){return this.hj},set:function(t){var e=this.hj;e!==t&&(0>t&&me(t,">= 0",vo,"maximum"),this.hj=t,this.actual=this.oa,this.panel!==null&&this.panel.v(),this.Ob("maximum",e,t))}},alignment:{get:function(){return this.Jb},set:function(t){var e=this.Jb;e.D(t)||(this.Jb=t.J(),this.panel!==null&&this.panel.v(),this.Ob("alignment",e,t))}},stretch:{get:function(){return this.hg},set:function(t){var e=this.hg;e!==t&&(this.hg=t,this.panel!==null&&this.panel.v(),this.Ob("stretch",e,t))}},separatorPadding:{get:function(){return this.dg},set:function(t){typeof t=="number"&&(t=new ai(t));var e=this.dg;t!==null&&e!==null&&e.D(t)||(t!==null&&(t=t.J()),this.dg=t,this.panel!==null&&this.panel.v(),this.Ob("separatorPadding",e,t))}},separatorStroke:{get:function(){return this.lo},set:function(t){var e=this.lo;e!==t&&(t!==null&&tp(t,"RowColumnDefinition.separatorStroke"),t instanceof Tn&&t.freeze(),this.lo=t,this.panel!==null&&this.panel.v(),this.Ob("separatorStroke",e,t))}},separatorStrokeWidth:{get:function(){return this.mo},set:function(t){var e=this.mo;e!==t&&(this.mo=t,this.panel!==null&&this.panel.v(),this.Ob("separatorStrokeWidth",e,t))}},separatorDashArray:{get:function(){return this.tj},set:function(t){var e=this.tj;if(e!==t){if(t!==null){for(var i=t.length,n=0,s=0;s<i;s++){var a=t[s];typeof a=="number"&&0<=a&&isFinite(a)||lt("separatorDashArray value "+a+" at index "+s+" must be a positive number or zero."),n+=a}if(n===0){if(e===null)return;t=null}}this.tj=t,this.panel!==null&&this.panel.N(),this.Ob("separatorDashArray",e,t)}}},background:{get:function(){return this.Ma},set:function(t){var e=this.Ma;e!==t&&(t!==null&&tp(t,"RowColumnDefinition.background"),t instanceof Tn&&t.freeze(),this.Ma=t,this.panel!==null&&this.panel.N(),this.Ob("background",e,t))}},coversSeparators:{get:function(){return this.Pm},set:function(t){var e=this.Pm;e!==t&&(this.Pm=t,this.panel!==null&&this.panel.N(),this.Ob("coversSeparators",e,t))}},sizing:{get:function(){return this.oo},set:function(t){var e=this.oo;e!==t&&(this.oo=t,this.panel!==null&&this.panel.v(),this.Ob("sizing",e,t))}},actual:{get:function(){return this.oa},set:function(t){this.oa=isNaN(this.Hc)?Math.max(Math.min(this.hj,t),this.jj):Math.max(Math.min(this.hj,this.Hc),this.jj)}},measured:{get:function(){return this.oc},set:function(t){this.oc=t}},total:{get:function(){return this.oa+this.Wc()}},position:{get:function(){return this.pa},set:function(t){this.pa=t}}}),vo.prototype.computeEffectiveSpacing=vo.prototype.Wc,vo.prototype.computeEffectiveSpacingTop=vo.prototype.Io;var Fg=new mt(vo,"Default",0),rp=new mt(vo,"None",1),bm=new mt(vo,"ProportionalExtra",2);vo.className="RowColumnDefinition",vo.Default=Fg,vo.None=rp,vo.ProportionalExtra=bm;function Xi(t,e){at.call(this),this.Rd=this.ua=null,this.an="None",this.xc=this.Ui="black",this.ig=1,this.Na=this.Yg=null,this.Vn=this.Un=NaN,this.fa=null,typeof t=="string"?this.figure=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}gi(Xi,at),Xi.prototype.cloneProtected=function(t){at.prototype.cloneProtected.call(this,t),t.ua=this.ua,t.Rd=this.Rd,t.an=this.an,t.Ui=this.Ui,t.xc=this.xc,t.ig=this.ig,this.Yg!==null&&(t.Yg=bi(this.Yg)),this.Na!==null&&(t.Na=this.Na.nc?this.Na:this.Na.copy()),t.Un=this.Un,t.Vn=this.Vn,this.fa!==null&&(t.fa=this.fa.copy())};function Pa(t){t.Na===null?t.Na=new zg:t.Na.nc&&(t.Na=t.Na.copy())}T=Xi.prototype,T.th=function(){at.prototype.th.call(this),this.Na!==null&&(this.Na.nc=!0)},T.qb=function(t){t===Yt||t===Ge||t===un||t===Vi?this.geometryStretch=t:at.prototype.qb.call(this,t)},T.toString=function(){return"Shape("+(this.figure!=="None"?this.figure:this.toArrow!=="None"?this.toArrow:this.fromArrow)+")#"+Ti(this)};function r0(t,e,i,n){var s=i.length;if(!(4>s)){var a=n.measuredBounds,l=Math.max(1,a.width);a=a.height;for(var c=i[0],f=i[1],m,v,w,C,k,L,A=0,H=Pe(),R=2;R<s;R+=2)m=i[R],v=i[R+1],w=m-c,c=v-f,w===0&&(w=.001),C=c/w,k=Math.atan2(c,w),L=Math.sqrt(w*w+c*c),H.push([w,k,C,L]),A+=L,c=m,f=v;c=i[0],f=i[1],w=n.measuredBounds.width,n instanceof Xi&&(w-=n.strokeWidth),1>w&&(w=1),s=i=w,m=l/2,v=m!==0,R=0,L=H[R],w=L[0],k=L[1],C=L[2],L=L[3];for(var X=0;.1<=A;){if(X===0&&(v?(s=i,s-=m,A-=m,v=!1):s=i,s===0&&(s=1)),s>A){qe(H);return}s>L?(X=s-L,s=L):X=0;var Y=Math.sqrt(s*s/(1+C*C));if(0>w&&(Y=-Y),c+=Y,f+=C*Y,t.translate(c,f),t.rotate(k),t.translate(-(l/2),-(a/2)),X===0&&n.hh(t,e),t.translate(l/2,a/2),t.rotate(-k),t.translate(-c,-f),A-=s,L-=s,X!==0){if(R++,R===H.length){qe(H);return}L=H[R],w=L[0],k=L[1],C=L[2],L=L[3],s=X}}qe(H)}}T.hh=function(t,e){var i=this.xc,n=this.Ui;if(i!==null||n!==null){var s=this.ua;if(s!==null){t.yc();var a=this.actualBounds,l=this.naturalBounds;n!==null&&Br(this,t,n,!0,!1,l,a);var c=this.part,f=this.ig;if(i===null||f!==0||c===null||!this.isPanelMain&&c.Pb()!==this||(f=c.type===ne.Link&&c instanceof Cn&&c.category==="Selection"&&c.adornedObject instanceof Xi&&c.adornedPart.Pb()===c.adornedObject?c.adornedObject.strokeWidth:0),f===0&&(i=null),i!==null&&f!==0&&(Br(this,t,i,!1,!1,l,a),t.lineWidth=f,t.lineJoin=this.strokeJoin,t.lineCap=this.strokeCap,t.miterLimit=this.strokeMiterLimit),a=!1,c&&e.Gf("drawShadows")&&(a=c.isShadowed),t.Il===!1&&(a=!1),c=!0,i===null||n!==null&&n!=="transparent"||(c=!1),l=!1,f=this.strokeDashArray,f!==null&&(l=!0,t.js(f,this.strokeDashOffset)),s.type===fe.j)t.beginPath(),t.moveTo(s.startX,s.startY),t.lineTo(s.endX,s.endY),i!==null&&t.jk(),t.Se();else if(s.type===fe.u){var m=s.startX;f=s.startY;var v=s.endX,w=s.endY;s=Math.min(m,v);var C=Math.min(f,w);m=Math.abs(v-m),f=Math.abs(w-f),t.beginPath(),t.rect(s,C,m,f),n!==null&&t.ng(n),i!==null&&(c&&a&&Vl(t),t.jk(),c&&a&&zh(t)),t.Se()}else if(s.type===fe.F)m=s.startX,f=s.startY,v=s.endX,w=s.endY,s=Math.abs(v-m)/2,C=Math.abs(w-f)/2,m=Math.min(m,v)+s,f=Math.min(f,w)+C,t.beginPath(),t.moveTo(m,f-C),t.bezierCurveTo(m+ht.wg*s,f-C,m+s,f-ht.wg*C,m+s,f),t.bezierCurveTo(m+s,f+ht.wg*C,m+ht.wg*s,f+C,m,f+C),t.bezierCurveTo(m-ht.wg*s,f+C,m-s,f+ht.wg*C,m-s,f),t.bezierCurveTo(m-s,f-ht.wg*C,m-ht.wg*s,f-C,m,f-C),t.closePath(),n!==null&&t.ng(n),i!==null&&(c&&a&&Vl(t),t.jk(),c&&a&&zh(t)),t.Se();else if(s.type===fe.o)for(s=s.figures,f=s.length,C=0;C<f;C++){m=s.s[C],t.beginPath(),t.moveTo(m.startX,m.startY),v=m.segments.s,w=v.length;for(var k=null,L=0;L<w;L++){var A=v[L];switch(A.type){case mo:t.moveTo(A.endX,A.endY);break;case er:t.lineTo(A.endX,A.endY);break;case $o:t.bezierCurveTo(A.point1X,A.point1Y,A.point2X,A.point2Y,A.endX,A.endY);break;case ps:t.quadraticCurveTo(A.point1X,A.point1Y,A.endX,A.endY);break;case Or:if(A.radiusX===A.radiusY){var H=Math.PI/180;t.arc(A.point1X,A.point1Y,A.radiusX,A.startAngle*H,(A.startAngle+A.sweepAngle)*H,0>A.sweepAngle,k!==null?k.endX:m.startX,k!==null?k.endY:m.startY)}else if(k=Cs(A,m),H=k.length,H===0)t.lineTo(A.centerX,A.centerY);else for(var R=0;R<H;R++){var X=k[R];R===0&&t.lineTo(X[0],X[1]),t.bezierCurveTo(X[2],X[3],X[4],X[5],X[6],X[7])}break;case xa:if(R=H=0,k!==null&&k.type===Or){if(k=Cs(k,m),X=k.length,X===0){t.lineTo(A.endX,A.endY);break}k=k[X-1]||null,k!==null&&(H=k[6],R=k[7])}else H=k!==null?k.endX:m.startX,R=k!==null?k.endY:m.startY;if(k=js(A,m,H,R),H=k.length,H===0){t.lineTo(A.endX,A.endY);break}for(R=0;R<H;R++)X=k[R],t.bezierCurveTo(X[2],X[3],X[4],X[5],X[6],X[7]);break;default:lt("Segment not of valid type: "+A.type)}A.isClosed&&t.closePath(),k=A}v=m.isFilled,a?m.isShadowed?(v===!0&&n!=="transparent"&&n!==null&&t.ng(n,m.isEvenOdd),i!==null&&(v&&c&&Vl(t),t.jk(),v&&c&&zh(t))):(Vl(t),v&&n!=="transparent"&&n!==null&&t.ng(n,m.isEvenOdd),i!==null&&t.jk(),zh(t)):(v&&n!==null&&t.ng(n,m.isEvenOdd),i!==null&&t.jk()),t.Se(C)}if(l&&t.fs(),this.pathPattern!==null){if(i=this.pathPattern,i.measure(1/0,1/0),n=i.measuredBounds,i.arrange(0,0,n.width,n.height),a=this.geometry,t.save(),t.beginPath(),n=Pe(),a.type===fe.j)n.push(a.startX),n.push(a.startY),n.push(a.endX),n.push(a.endY),r0(t,e,n,i);else if(a.type===fe.o)for(a=a.figures.iterator;a.next();){for(c=a.value,n.length=0,n.push(c.startX),n.push(c.startY),l=c.startX,s=c.startY,f=l,C=s,m=c.segments.s,v=m.length,w=0;w<v;w++){switch(L=m[w],L.type){case mo:r0(t,e,n,i),n.length=0,n.push(L.endX),n.push(L.endY),l=L.endX,s=L.endY,f=l,C=s;break;case er:n.push(L.endX),n.push(L.endY),l=L.endX,s=L.endY;break;case $o:ht.Qe(l,s,L.point1X,L.point1Y,L.point2X,L.point2Y,L.endX,L.endY,.5,n),l=L.endX,s=L.endY;break;case ps:ht.ep(l,s,L.point1X,L.point1Y,L.endX,L.endY,.5,n),l=L.endX,s=L.endY;break;case Or:if(A=Cs(L,c),k=A.length,k===0){n.push(L.centerX),n.push(L.centerY),l=L.centerX,s=L.centerY;break}for(H=0;H<k;H++)R=A[H],ht.Qe(l,s,R[2],R[3],R[4],R[5],R[6],R[7],.5,n),l=R[6],s=R[7];break;case xa:if(A=js(L,c,l,s),k=A.length,k===0){n.push(L.endX),n.push(L.endY),l=L.endX,s=L.endY;break}for(H=0;H<k;H++)R=A[H],ht.Qe(l,s,R[2],R[3],R[4],R[5],R[6],R[7],.5,n),l=R[6],s=R[7];break;default:lt("Segment not of valid type: "+L.type)}L.isClosed&&(n.push(f),n.push(C),r0(t,e,n,i))}r0(t,e,n,i)}else if(a.type===fe.u)n.push(a.startX),n.push(a.startY),n.push(a.endX),n.push(a.startY),n.push(a.endX),n.push(a.endY),n.push(a.startX),n.push(a.endY),n.push(a.startX),n.push(a.startY),r0(t,e,n,i);else if(a.type===fe.F){if(s=new Mr,s.startX=a.endX,s.startY=(a.startY+a.endY)/2,l=new an(Or),l.startAngle=0,l.sweepAngle=360,l.centerX=(a.startX+a.endX)/2,l.centerY=(a.startY+a.endY)/2,l.radiusX=Math.abs(a.startX-a.endX)/2,l.radiusY=Math.abs(a.startY-a.endY)/2,s.add(l),a=Cs(l,s),c=a.length,c===0)n.push(l.centerX),n.push(l.centerY);else for(l=s.startX,s=s.startY,f=0;f<c;f++)C=a[f],ht.Qe(l,s,C[2],C[3],C[4],C[5],C[6],C[7],.5,n),l=C[6],s=C[7];r0(t,e,n,i)}qe(n),t.restore(),t.Vc(!1)}}}},T.kk=function(t,e,i){return!at.prototype.kk.call(this,t,e,i)||this.xc===null&&this.Ui===null||this.ua===null||this.pathPattern!==null||this.geometry.figures.length!==this.svg.getElementsByTagName("path").length?!1:(t.Hl=this.svg,this.hh(t,e),t.Hl=null,!0)},T.nk=function(t){return this.geometry!==null&&1<this.geometry.figures.length||this.pathPattern!==null?!0:at.prototype.nk.call(this,t)},T.Dv=function(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{t=t.getElementsByTagName("path");for(var i=0;i<t.length;i++)t[i].setAttributeNS(null,"filter",e)}},T.ga=function(t,e){if(e===void 0&&(e=new z),t instanceof Ze){t.Mc()&&lt("getDocumentPoint Spot must be a real, specific Spot, not: "+t.toString());var i=this.naturalBounds,n=this.strokeWidth;e.h(t.x*(i.width+n)-n/2+i.x+t.offsetX,t.y*(i.height+n)-n/2+i.y+t.offsetY)}else e.set(t);return this.oe.Ga(e),e},T.mi=function(t){t===void 0&&(t=new It);var e=this.naturalBounds,i=this.oe;e=It.allocAt(e.x,e.y,e.width,e.height);var n=this.strokeWidth;return e.Bc(n/2,n/2),n=z.allocAt(e.x,e.y).transform(i),t.h(n.x,n.y,0,0),n.h(e.right,e.y).transform(i),vr(t,n.x,n.y,0,0),n.h(e.right,e.bottom).transform(i),vr(t,n.x,n.y,0,0),n.h(e.x,e.bottom).transform(i),vr(t,n.x,n.y,0,0),It.free(e),z.free(n),t},T.gh=function(t,e){var i=this.geometry;if(i===null||this.fill===null&&this.stroke===null)return!1;var n=i.bounds,s=this.strokeWidth/2;i.type!==fe.j||e||(s+=2);var a=It.alloc();if(a.assign(n),a.Bc(s+2,s+2),!a.ca(t))return It.free(a),!1;if(n=s+1e-4,i.type===fe.j)return this.stroke===null||(n=(i.endX-i.startX)*(t.x-i.startX)+(i.endY-i.startY)*(t.y-i.startY),0>(i.startX-i.endX)*(t.x-i.endX)+(i.startY-i.endY)*(t.y-i.endY)||0>n)?!1:(It.free(a),ht.Yb(i.startX,i.startY,i.endX,i.endY,s,t.x,t.y));if(i.type===fe.u){e=i.startX;var l=i.startY,c=i.endX;if(i=i.endY,a.x=Math.min(e,c),a.y=Math.min(l,i),a.width=Math.abs(c-e),a.height=Math.abs(i-l),this.fill===null){if(a.Bc(-n,-n),a.ca(t))return It.free(a),!1;a.Bc(n,n)}return this.stroke!==null&&a.Bc(s,s),t=a.ca(t),It.free(a),t}if(i.type===fe.F){l=i.startX,s=i.startY,c=i.endX;var f=i.endY;if(i=Math.min(l,c),e=Math.min(s,f),l=Math.abs(c-l)/2,s=Math.abs(f-s)/2,i=t.x-(i+l),e=t.y-(e+s),this.fill===null){if(l-=n,s-=n,0>=l||0>=s||1>=i*i/(l*l)+e*e/(s*s))return It.free(a),!1;l+=n,s+=n}return this.stroke!==null&&(l+=n,s+=n),It.free(a),0>=l||0>=s?!1:1>=i*i/(l*l)+e*e/(s*s)}if(i.type===fe.o)return It.free(a),this.fill===null?$r(i,t.x,t.y,s):eu(i,t,s,1<this.strokeWidth,e);lt("Unknown Geometry type: "+i.type)},T.Wl=function(t,e,i,n){var s=this.desiredSize,a=this.ig;if(t=Math.max(t,0),e=Math.max(e,0),this.Rd!==null)var l=this.geometry.bounds;else{var c=this.figure,f=qv[c];if(f===void 0){var m=ht.Ze[c];typeof m=="string"&&(m=ht.Ze[m]),typeof m=="function"?(f=m(null,100,100),qv[c]=f):lt("Unsupported Figure: "+c)}l=f.bounds}c=l.width,f=l.height,m=l.width;var v=l.height;switch(Qs(this,!0)){case Yt:n=i=0;break;case ie:m=Math.max(t-a,0),v=Math.max(e-a,0);break;case si:m=Math.max(t-a,0),n=0;break;case yi:i=0,v=Math.max(e-a,0)}isFinite(s.width)&&(m=s.width),isFinite(s.height)&&(v=s.height);var w=this.maxSize,C=this.minSize;switch(i=Math.max(i-a,C.width),n=Math.max(n-a,C.height),m=Math.min(w.width,m),v=Math.min(w.height,v),m=isFinite(m)?Math.max(i,m):Math.max(c,i),v=isFinite(v)?Math.max(n,v):Math.max(f,n),i=o0(this),i){case Yt:break;case ie:c=m,f=v;break;case Ge:i=Math.min(m/c,v/f),isFinite(i)||(i=1),c*=i,f*=i;break;default:lt(i+" is not a valid geometryStretch.")}this.Rd!==null?(c===0&&(c=.001),f===0&&(f=.001),i=this.Rd!==null?this.Rd:this.ua,l=i.bounds,n=c/l.width,l=f/l.height,isFinite(n)||(n=1),isFinite(l)||(l=1),this.ua=n===1&&l===1?i:i.copy().scale(n,l)):this.ua!==null&&ht.$(this.ua.Sk,t-a)&&ht.$(this.ua.Rk,e-a)||(this.ua=Xi.makeGeometry(this,c,f)),l=this.ua.bounds,t===1/0||e===1/0?this.Ge(l.x-a/2,l.y-a/2,t===0&&c===0?0:l.width+a,e===0&&f===0?0:l.height+a):this.Ge(-(a/2),-(a/2),m+a,v+a),s.w()?(m=s.width,v=s.height,m=Math.min(w.width,m),v=Math.min(w.height,v),m=Math.max(C.width,m),v=Math.max(C.height,v),this.dc.h(0,0,m,v)):this.dc.assign(l)};function o0(t){var e=t.geometryStretch;return t.Rd!==null?e===Vi?ie:e:e===Vi?qv[t.figure].defaultStretch:e}T.eh=function(t,e,i,n){Ws(this,t,e,i,n)},T.rs=function(t,e,i){return this.Sj(t.x,t.y,e.x,e.y,i)},T.Sj=function(t,e,i,n,s){var a=this.transform,l=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*l,f=-a.m12*l,m=-a.m21*l,v=a.m11*l,w=l*(a.m21*a.dy-a.m22*a.dx),C=l*(a.m12*a.dx-a.m11*a.dy);a=t*c+e*m+w,l=t*f+e*v+C,c=i*c+n*m+w,f=i*f+n*v+C,w=this.ig/2,m=this.ua,m===null&&(this.measure(1/0,1/0),m=this.ua);var k=m.bounds;if(v=!1,m.type===fe.j)if(1.5>=this.strokeWidth)v=ht.Ve(m.startX,m.startY,m.endX,m.endY,a,l,c,f,s);else{if(m.startX===m.endX?(n=w,v=0):(e=(m.endY-m.startY)/(m.endX-m.startX),v=w/Math.sqrt(1+e*e),n=v*e),e=Pe(),t=new z,ht.Ve(m.startX+n,m.startY+v,m.endX+n,m.endY+v,a,l,c,f,t)&&e.push(t),t=new z,ht.Ve(m.startX-n,m.startY-v,m.endX-n,m.endY-v,a,l,c,f,t)&&e.push(t),t=new z,ht.Ve(m.startX+n,m.startY+v,m.startX-n,m.startY-v,a,l,c,f,t)&&e.push(t),t=new z,ht.Ve(m.endX+n,m.endY+v,m.endX-n,m.endY-v,a,l,c,f,t)&&e.push(t),c=e.length,c===0)return qe(e),!1;for(v=!0,f=1/0,n=0;n<c;n++)t=e[n],i=(t.x-a)*(t.x-a)+(t.y-l)*(t.y-l),i<f&&(f=i,s.x=t.x,s.y=t.y);qe(e)}else if(m.type===fe.u)v=ht.Ff(k.x-w,k.y-w,k.x+k.width+w,k.y+k.height+w,a,l,c,f,s);else if(m.type===fe.F){e=It.allocAt(k.x,k.y,k.width,k.height).Bc(w,w);t:if(e.width===0)v=ht.Ve(e.x,e.y,e.x,e.y+e.height,a,l,c,f,s);else if(e.height===0)v=ht.Ve(e.x,e.y,e.x+e.width,e.y,a,l,c,f,s);else{if(t=e.width/2,m=e.height/2,n=e.x+t,v=e.y+m,i=9999,a!==c&&(i=(l-f)/(a-c)),9999>Math.abs(i)){if(f=l-v-i*(a-n),0>t*t*i*i+m*m-f*f){s.x=NaN,s.y=NaN,v=!1;break t}w=Math.sqrt(t*t*i*i+m*m-f*f),c=(-(t*t*i*f)+t*m*w)/(m*m+t*t*i*i)+n,t=(-(t*t*i*f)-t*m*w)/(m*m+t*t*i*i)+n,m=i*(c-n)+f+v,f=i*(t-n)+f+v,Math.abs((a-c)*(a-c))+Math.abs((l-m)*(l-m))<Math.abs((a-t)*(a-t))+Math.abs((l-f)*(l-f))?(s.x=c,s.y=m):(s.x=t,s.y=f)}else{if(c=m*m,f=a-n,c-=c/(t*t)*f*f,0>c){s.x=NaN,s.y=NaN,v=!1;break t}f=Math.sqrt(c),c=v+f,f=v-f,Math.abs(c-l)<Math.abs(f-l)?(s.x=a,s.y=c):(s.x=a,s.y=f)}v=!0}It.free(e)}else if(m.type===fe.o){C=z.alloc();var L=c-a,A=f-l,H=L*L+A*A,R=a,X=l;if(0<H&&k.contains(R,X)&&(C.x=R,C.y=X,this.ca(C)))for(L!==0&&.5>Math.abs(L)?(A*=.5/L,L=.5):A!==0&&.5>Math.abs(A)&&(L*=.5/A,A=.5),R-=L,X-=A;k.contains(R,X);)R-=L,X-=A;for(s.x=c,s.y=f,A=0;A<m.figures.count;A++){var Y=m.figures.s[A],tt=Y.isFilled?R:a,st=Y.isFilled?X:l,bt=Y.segments;k=Y.startX,L=Y.startY;for(var Te=k,Ke=L,Oe=0;Oe<bt.count;Oe++){var he=bt.s[Oe],Gt=he.type,Wi=he.endX,Di=he.endY,In=!1;switch(Gt){case mo:Te=Wi,Ke=Di;break;case er:In=ls(k,L,Wi,Di,tt,st,c,f,C);break;case $o:In=ht.Eo(k,L,he.point1X,he.point1Y,he.point2X,he.point2Y,Wi,Di,tt,st,c,f,.6,C);break;case ps:In=ht.Eo(k,L,k+2/3*(he.point1X-k),L+2/3*(he.point1Y-L),Wi+2/3*(he.point1X-Wi),Di+2/3*(he.point1Y-Di),Wi,Di,tt,st,c,f,.6,C);break;case Or:case xa:Gt=he.type===Or?Cs(he,Y):js(he,Y,k,L);var sr=Gt.length;if(sr===0){In=ls(k,L,he.type===Or?he.centerX:he.endX,he.type===Or?he.centerY:he.endY,tt,st,c,f,C);break}for(Di=null,Wi=0;Wi<sr;Wi++){if(Di=Gt[Wi],Wi===0&&ls(k,L,Di[0],Di[1],tt,st,c,f,C)){var is=Rg(tt,st,C,H,s);is<H&&(H=is,v=!0)}ht.Eo(Di[0],Di[1],Di[2],Di[3],Di[4],Di[5],Di[6],Di[7],tt,st,c,f,.6,C)&&(is=Rg(tt,st,C,H,s),is<H&&(H=is,v=!0))}Wi=Di[6],Di=Di[7];break;default:lt("Unknown Segment type: "+Gt)}k=Wi,L=Di,In&&(In=Rg(tt,st,C,H,s),In<H&&(H=In,v=!0)),he.isClosed&&(Wi=Te,Di=Ke,ls(k,L,Wi,Di,tt,st,c,f,C)&&(he=Rg(tt,st,C,H,s),he<H&&(H=he,v=!0)))}}a=i-t,l=n-e,c=Math.sqrt(a*a+l*l),c!==0&&(a/=c,l/=c),s.x-=a*w,s.y-=l*w,z.free(C)}else lt("Unknown Geometry type: "+m.type);return v?(this.transform.Ga(s),!0):!1};function Rg(t,e,i,n,s){return t=i.x-t,e=i.y-e,e=t*t+e*e,e<n?(s.x=i.x,s.y=i.y,e):n}function ls(t,e,i,n,s,a,l,c,f){if(ht.$(t,i)&&ht.$(e,n)||ht.$(s,l)&&ht.$(a,c))return!1;var m=!1,v=(s-l)*(e-n)-(a-c)*(t-i);return v===0?!1:(f.x=((s*c-a*l)*(t-i)-(s-l)*(t*n-e*i))/v,f.y=((s*c-a*l)*(e-n)-(a-c)*(t*n-e*i))/v,(t>i?t-i:i-t)<(e>n?e-n:n-e)?(t=e<n?e:n,e=e<n?n:e,(f.y>t||ht.$(f.y,t))&&(f.y<e||ht.$(f.y,e))&&(m=!0)):(e=t<i?t:i,t=t<i?i:t,(f.x>e||ht.$(f.x,e))&&(f.x<t||ht.$(f.x,t))&&(m=!0)),m)}T.fh=function(t,e){if(e===void 0)return t.Re(this.actualBounds);var i=this.ua;i===null&&(this.measure(1/0,1/0),i=this.ua),i=i.bounds;var n=this.strokeWidth/2,s=!1,a=z.alloc();return a.h(i.x-n,i.y-n),t.ca(e.Ga(a))&&(a.h(i.x-n,i.bottom+n),t.ca(e.Ga(a))&&(a.h(i.right+n,i.bottom+n),t.ca(e.Ga(a))&&(a.h(i.right+n,i.y-n),t.ca(e.Ga(a))&&(s=!0)))),z.free(a),s},T.Yc=function(t,e){if(this.fh(t,e)||e===void 0&&(e=this.transform,t.Re(this.actualBounds)))return!0;var i=nn.alloc();i.set(e),i.Vj();var n=t.left,s=t.right,a=t.top;t=t.bottom;var l=z.alloc();if(l.h(n,a),i.Ga(l),this.gh(l,!0)||(l.h(s,a),i.Ga(l),this.gh(l,!0))||(l.h(n,t),i.Ga(l),this.gh(l,!0))||(l.h(s,t),i.Ga(l),this.gh(l,!0)))return z.free(l),!0;var c=z.alloc(),f=z.alloc();return i.set(e),i.bv(this.transform),i.Vj(),c.x=s,c.y=a,c.transform(i),l.x=n,l.y=a,l.transform(i),e=!1,Jd(this,l,c,f)?e=!0:(l.x=s,l.y=t,l.transform(i),Jd(this,l,c,f)?e=!0:(c.x=n,c.y=t,c.transform(i),Jd(this,l,c,f)?e=!0:(l.x=n,l.y=a,l.transform(i),Jd(this,l,c,f)&&(e=!0)))),z.free(l),nn.free(i),z.free(c),z.free(f),e};function Jd(t,e,i,n){if(!t.rs(e,i,n))return!1;t=e.x,e=e.y;var s=i.x,a=i.y;return i=n.x,n=n.y,t===s?(e<a?(t=e,e=a):t=a,n>=t&&n<=e):(t<s?(n=t,t=s):n=s,i>=n&&i<=t)}T.tx=function(t,e,i){function n(H,R){for(var X=H.length,Y=0;Y<X;Y+=2)if(R.zd(H[Y],H[Y+1])>s)return!0;return!1}if(i&&this.fill!==null&&this.gh(t,!0))return!0;var s=t.Bf(e),a=s;if(1.5<this.strokeWidth&&(s=this.strokeWidth/2+Math.sqrt(s),s*=s),e=this.ua,e===null&&(this.measure(1/0,1/0),e=this.ua,e===null))return!1;if(!i){var l=e.bounds,c=l.x,f=l.y,m=l.x+l.width;if(l=l.y+l.height,Xr(t.x,t.y,c,f)<=s&&Xr(t.x,t.y,m,f)<=s&&Xr(t.x,t.y,c,l)<=s&&Xr(t.x,t.y,m,l)<=s)return!0}if(c=e.startX,f=e.startY,m=e.endX,l=e.endY,e.type===fe.j){if(i=(c-m)*(t.x-m)+(f-l)*(t.y-l),Fn(t.x,t.y,c,f,m,l)<=(0<=(m-c)*(t.x-c)+(l-f)*(t.y-f)&&0<=i?s:a))return!0}else{if(e.type===fe.u)return e=!1,i&&(e=Fn(t.x,t.y,c,f,c,l)<=s||Fn(t.x,t.y,c,f,m,f)<=s||Fn(t.x,t.y,m,f,m,l)<=s||Fn(t.x,t.y,c,l,m,l)<=s),e;if(e.type===fe.F){e=t.x-(c+m)/2,a=t.y-(f+l)/2;var v=Math.abs(m-c)/2,w=Math.abs(l-f)/2;if(v===0||w===0)return Fn(t.x,t.y,c,f,m,l)<=s;if(i){if(t=ht.$y(v,w,e,a),t*t<=s)return!0}else return!(Xr(e,a,-v,0)>=s||Xr(e,a,0,-w)>=s||Xr(e,a,0,w)>=s||Xr(e,a,v,0)>=s)}else if(e.type===fe.o){if(m=e.bounds,a=m.x,c=m.y,f=m.x+m.width,m=m.y+m.height,t.x>f&&t.x<a&&t.y>m&&t.y<c&&Fn(t.x,t.y,a,c,a,m)>s&&Fn(t.x,t.y,a,c,f,c)>s&&Fn(t.x,t.y,f,m,a,m)>s&&Fn(t.x,t.y,f,m,f,c)>s)return!1;if(a=Math.sqrt(s),i){if(this.fill===null?$r(e,t.x,t.y,a):eu(e,t,a,!0,!1))return!0}else{for(i=e.figures,e=0;e<i.count;e++){if(a=i.s[e],l=a.startX,v=a.startY,t.zd(l,v)>s)return!1;for(c=a.segments.s,f=c.length,m=0;m<f;m++)switch(w=c[m],w.type){case mo:case er:if(l=w.endX,v=w.endY,t.zd(l,v)>s)return!1;break;case $o:var C=Pe();if(ht.Qe(l,v,w.point1X,w.point1Y,w.point2X,w.point2Y,w.endX,w.endY,.8,C),l=n(C,t),qe(C),l||(l=w.endX,v=w.endY,t.zd(l,v)>s))return!1;break;case ps:if(C=Pe(),ht.ep(l,v,w.point1X,w.point1Y,w.endX,w.endY,.8,C),l=n(C,t),qe(C),l||(l=w.endX,v=w.endY,t.zd(l,v)>s))return!1;break;case Or:case xa:C=w.type===Or?Cs(w,a):js(w,a,l,v);var k=C.length;if(k===0){if(l=w.type===Or?w.centerX:w.endX,v=w.type===Or?w.centerY:w.endY,t.zd(l,v)>s)return!1;break}w=null;for(var L=Pe(),A=0;A<k;A++)if(w=C[A],L.length=0,ht.Qe(w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7],.8,L),n(L,t))return qe(L),!1;qe(L),w!==null&&(l=w[6],v=w[7]);break;default:lt("Unknown Segment type: "+w.type)}}return!0}}}return!1},T.qc=function(){this.ua=null},T.kq=function(){return this.ig};function Jv(t){var e=t.diagram;e!==null&&e.undoManager.isUndoingRedoing||(t.segmentOrientation=y0,t.toArrow!=="None"?(t.segmentIndex=-1,t.alignmentFocus=so):t.fromArrow!=="None"&&(t.segmentIndex=0,t.alignmentFocus=new Ze(1-so.x,so.y)))}Xi.makeGeometry=function(t,e,i){if(t.toArrow!=="None")var n=Wl[t.toArrow];else t.fromArrow!=="None"?n=Wl[t.fromArrow]:(n=ht.Ze[t.figure],typeof n=="string"&&(n=ht.Ze[n]),n===void 0&&lt("Unknown Shape.figure: "+t.figure),n=n(t,e,i),n.Sk=e,n.Rk=i);if(n===null){var s=ht.Ze.Rectangle;typeof s=="function"&&(n=s(t,e,i))}return n};function qd(t){var e=Wl[t];if(e===void 0){var i=t.toLowerCase();if(i==="none")return"None";if(e=Wl[i],e===void 0){var n=null,s;for(s in ht.um)if(s.toLowerCase()===i){n=s;break}if(n!==null)return t=fe.parse(ht.um[n],!1),Wl[n]=t,i!==n&&(Wl[i]=n),n}}return typeof e=="string"?e:e instanceof fe?t:null}ct.Object.defineProperties(Xi.prototype,{geometry:{get:function(){return this.ua!==null?this.ua:this.Rd},set:function(t){var e=this.ua,i=this.Rd;if(e!==t){t!==null?this.Rd=this.ua=t.freeze():this.Rd=this.ua=null;var n=this.part;n!==null&&(n.ag=NaN),this.v(),this.g("geometry",e||i,t),as(this)&&(t=this.part,t!==null&&lr(this,t,"geometryString"))}}},geometryString:{get:function(){return this.geometry===null?"":this.geometry.toString()},set:function(t){t=fe.parse(t);var e=t.normalize();this.geometry=t,this.position=t=z.allocAt(-e.x,-e.y),z.free(t)}},isGeometryPositioned:{get:function(){return(this.l&1048576)!==0},set:function(t){var e=(this.l&1048576)!==0;e!==t&&(this.l^=1048576,this.v(),this.g("isGeometryPositioned",e,t))}},fill:{get:function(){return this.Ui},set:function(t){var e=this.Ui;e!==t&&(t!==null&&tp(t,"Shape.fill"),t instanceof Tn&&t.freeze(),this.Ui=t,this.N(),this.g("fill",e,t))}},stroke:{get:function(){return this.xc},set:function(t){var e=this.xc;e!==t&&(t!==null&&tp(t,"Shape.stroke"),t instanceof Tn&&t.freeze(),this.xc=t,this.N(),this.g("stroke",e,t))}},strokeWidth:{get:function(){return this.ig},set:function(t){var e=this.ig;if(e!==t)if(0<=t){this.ig=t,this.v();var i=this.part;i!==null&&(i.ag=NaN),this.g("strokeWidth",e,t)}else me(t,"value >= 0",Xi,"strokeWidth:value")}},strokeCap:{get:function(){return this.Na!==null?this.Na.Hr:"butt"},set:function(t){var e=this.strokeCap;e!==t&&(typeof t!="string"||t!=="butt"&&t!=="round"&&t!=="square"?me(t,'"butt", "round", or "square"',Xi,"strokeCap"):(Pa(this),this.Na.Hr=t,this.N(),this.g("strokeCap",e,t)))}},strokeJoin:{get:function(){return this.Na!==null?this.Na.Ir:"miter"},set:function(t){var e=this.strokeJoin;e!==t&&(typeof t!="string"||t!=="miter"&&t!=="bevel"&&t!=="round"?me(t,'"miter", "bevel", or "round"',Xi,"strokeJoin"):(Pa(this),this.Na.Ir=t,this.N(),this.g("strokeJoin",e,t)))}},strokeMiterLimit:{get:function(){return this.Na!==null?this.Na.Jr:10},set:function(t){var e=this.strokeMiterLimit;if(e!==t&&1<=t){Pa(this),this.Na.Jr=t,this.N();var i=this.part;i!==null&&(i.ag=NaN),this.g("strokeMiterLimit",e,t)}}},strokeDashArray:{get:function(){return this.Yg},set:function(t){var e=this.Yg;if(e!==t){if(t!==null){for(var i=t.length,n=0,s=0;s<i;s++){var a=t[s];0<=a&&isFinite(a)||lt("strokeDashArray:value "+a+" at index "+s+" must be a positive number or zero."),n+=a}if(n===0){if(e===null)return;t=null}}this.Yg=t,this.N(),this.g("strokeDashArray",e,t)}}},strokeDashOffset:{get:function(){return this.Na!==null?this.Na.uj:0},set:function(t){var e=this.strokeDashOffset;e!==t&&0<=t&&(Pa(this),this.Na.uj=t,this.N(),this.g("strokeDashOffset",e,t))}},figure:{get:function(){return this.an},set:function(t){var e=this.an;if(e!==t){var i=ht.Ze[t];typeof i=="function"?i=t:(i=ht.Ze[t.toLowerCase()])||lt("Unknown Shape.figure: "+t),e!==i&&(t=this.part,t!==null&&(t.ag=NaN),this.an=i,this.Rd=null,this.qc(),this.v(),this.g("figure",e,i))}}},toArrow:{get:function(){return this.Ua!==null?this.Ua.V:"None"},set:function(t){var e=this.toArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){var i=qd(t);i===null?lt("Unknown Shape.toArrow: "+t):e!==i&&(this.Ua===null&&(this.Ua=new Eu),this.Ua.V=i,this.Rd=null,this.qc(),this.v(),Jv(this),this.g("toArrow",e,i))}}},fromArrow:{get:function(){return this.Ua!==null?this.Ua.j:"None"},set:function(t){var e=this.fromArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){var i=qd(t);i===null?lt("Unknown Shape.fromArrow: "+t):e!==i&&(this.Ua===null&&(this.Ua=new Eu),this.Ua.j=i,this.Rd=null,this.qc(),this.v(),Jv(this),this.g("fromArrow",e,i))}}},spot1:{get:function(){return this.Na!==null?this.Na.fg:zn},set:function(t){var e=this.spot1;e.D(t)||(t=t.J(),Pa(this),this.Na.fg=t,this.v(),this.g("spot1",e,t))}},spot2:{get:function(){return this.Na!==null?this.Na.gg:zn},set:function(t){var e=this.spot2;e.D(t)||(t=t.J(),Pa(this),this.Na.gg=t,this.v(),this.g("spot2",e,t))}},parameter1:{get:function(){return this.Un},set:function(t){var e=this.Un;e!==t&&(this.Un=t,this.qc(),this.v(),this.g("parameter1",e,t))}},parameter2:{get:function(){return this.Vn},set:function(t){var e=this.Vn;e!==t&&(this.Vn=t,this.qc(),this.v(),this.g("parameter2",e,t))}},naturalBounds:{get:function(){return this.dc}},pathPattern:{get:function(){return this.Na!==null?this.Na.br:null},set:function(t){var e=this.pathPattern;e!==t&&(Pa(this),this.Na.br=t,this.N(),this.g("pathPattern",e,t))}},geometryStretch:{get:function(){return this.Na!==null?this.Na.jq:Vi},set:function(t){var e=this.geometryStretch;e!==t&&(Pa(this),this.Na.jq=t,this.v(),this.g("geometryStretch",e,t))}},interval:{get:function(){return this.fa!==null?this.fa.Tk:1},set:function(t){var e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.fa===null&&(this.fa=new hh),this.fa.Tk=t;var i=this.diagram;i!==null&&this.panel===i.grid&&Cu(i),this.v(),i=this.panel,i!==null&&(i.graduatedIntervals=null),this.g("interval",e,t)}}},graduatedStart:{get:function(){return this.fa!==null?this.fa.u:0},set:function(t){var e=this.graduatedStart;e!==t&&(0>t?t=0:1<t&&(t=1),this.fa===null&&(this.fa=new hh),this.fa.u=t,this.v(),this.g("graduatedStart",e,t))}},graduatedEnd:{get:function(){return this.fa!==null?this.fa.j:1},set:function(t){var e=this.graduatedEnd;e!==t&&(0>t?t=0:1<t&&(t=1),this.fa===null&&(this.fa=new hh),this.fa.j=t,this.v(),this.g("graduatedEnd",e,t))}},graduatedSkip:{get:function(){return this.fa!==null?this.fa.o:null},set:function(t){var e=this.graduatedSkip;e!==t&&(this.fa===null&&(this.fa=new hh),this.fa.o=t,this.v(),this.g("graduatedSkip",e,t))}}}),Xi.prototype.intersectsRect=Xi.prototype.Yc,Xi.prototype.containedInRect=Xi.prototype.fh,Xi.prototype.getNearestIntersectionPoint=Xi.prototype.rs,Xi.prototype.getDocumentBounds=Xi.prototype.mi,Xi.prototype.getDocumentPoint=Xi.prototype.ga;var Wl=new ci,qv=new ci;Xi.className="Shape",Xi.getFigureGenerators=function(){var t=new pe,e;for(e in ht.Ze)e!==e.toLowerCase()&&t.add(e,ht.Ze[e]);return t.freeze(),t},Xi.defineFigureGenerator=function(t,e){var i=t.toLowerCase(),n=ht.Ze;n[t]=e,n[i]=t},Xi.getArrowheadGeometries=function(){var t=new pe;for(n in ht.um)if(Wl[n]===void 0){var e=fe.parse(ht.um[n],!1);Wl[n]=e,e=n.toLowerCase(),e!==n&&(Wl[e]=n)}for(var i in Wl)if(i!==i.toLowerCase()){var n=Wl[i];n instanceof fe&&t.add(i,n)}return t.freeze(),t},Xi.defineArrowheadGeometry=function(t,e){var i=null;typeof e=="string"?i=fe.parse(e,!1):i=e,e=t.toLowerCase(),e!=="none"&&t!==e||lt("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+t);var n=Wl;n[t]=i,n[e]=t};function zg(){this.nc=!1,this.Hr="butt",this.Ir="miter",this.Jr=10,this.uj=0,this.br=null,this.jq=Vi,this.gg=this.fg=zn}zg.prototype.copy=function(){var t=new zg;return t.Hr=this.Hr,t.Ir=this.Ir,t.Jr=this.Jr,t.uj=this.uj,t.br=this.br,t.jq=this.jq,t.fg=this.fg.J(),t.gg=this.gg.J(),t};function Wn(t,e){return at.call(this),Ug||(ca=Bn?new Tl(null).context:null,Ug=!0),this.l|=2097152,this.ec="",this.xc="black",this.Ae="13px sans-serif",this.Lq=this.Cb=this.Gc=0,this.da=this.fa=this.Gm=null,this.Ih=0,this.df=null,this.Le=0,this.ze=this.Qb=this.Qc=null,typeof t=="string"?this.text=t:t&&Object.assign(this,t),e&&Object.assign(this,e),this}gi(Wn,at),Wn.prototype.cloneProtected=function(t){at.prototype.cloneProtected.call(this,t),t.ec=this.ec,t.xc=this.xc,t.Ae=this.Ae,t.Gc=this.Gc,t.Cb=this.Cb,t.Lq=this.Lq,t.Gm=this.Gm,this.fa!==null&&(t.fa=this.fa.copy()),this.da!==null&&(t.da=this.da.nc?this.da:this.da.copy()),t.Ih=this.Ih,t.df=this.df,t.Le=this.Le,t.Qc=this.Qc,t.Qb=this.Qb,t.ze=this.ze};function bs(t){t.da===null?t.da=new ey:t.da.nc&&(t.da=t.da.copy())}T=Wn.prototype,T.th=function(){at.prototype.th.call(this),this.da!==null&&(this.da.nc=!0)};function jg(t,e){t.l=e.l|6144,t.pb=e.opacity,t.Ma=e.background,t.areaBackground=e.areaBackground,t.jd=e.desiredSize.J(),t.minSize=e.minSize.J(),t.maxSize=e.maxSize.J(),e.Lb!==null?t.Lb=e.Lb.copy():t.Lb=null,t.Ca=e.scale,t.Kb=e.angle,t.stretch=e.stretch,t.Kg=e.margin.J(),t.Jb=e.alignment.J(),t.sk=e.alignmentFocus.J(),t.segmentFraction=e.segmentFraction,t.segmentOffset=e.segmentOffset.J(),t.segmentOrientation=e.segmentOrientation,e.tb!==null&&(t.tb=e.tb.copy()),t.shadowVisible=e.shadowVisible,t.ec=e.ec,t.xc=e.xc,t.Ae=e.Ae,t.fa!==null&&(t.fa=e.fa.copy()),e.da!==null&&(t.da=e.da.nc?e.da:e.da.copy()),t.Ih=e.Ih}T.qb=function(t){t.classType===Wn?this.wrap=t:at.prototype.qb.call(this,t)},T.toString=function(){return 22<this.ec.length?'TextBlock("'+this.ec.substring(0,20)+'"...)':'TextBlock("'+this.ec+'")'},T.v=function(){at.prototype.v.call(this)},T.hh=function(t,e){if(this.xc!==null&&this.ec.length!==0&&this.Ae!==null){var i=this.naturalBounds,n=this.actualBounds,s=i.width,a=i.height,l=Sm(this),c=t.textAlign=this.textAlign,f=e.tn;c==="start"?c=f?"right":"left":c==="end"&&(c=f?"left":"right"),f=this.isUnderline;var m=this.isStrikethrough;Br(this,t,this.xc,!0,!1,i,n),(f||m)&&Br(this,t,this.xc,!1,!1,i,n),n=0,i=!1;var v=this.oe,w=v.dx-(l*v.m21+v.dx);v=v.dy-(l*v.m22+v.dy);var C=e.scale;switch(8>(w*w+v*v)*C*C&&(i=!0),e.ib!==t&&(i=!1),e.ib instanceof Bs&&(i=!1),e.Gf("textGreeking")===!1&&(i=!1),e=this.spacingAbove,w=this.spacingBelow,this.flip){case dn:t.translate(s,0),t.scale(-1,1);break;case qi:t.translate(0,a),t.scale(1,-1);break;case Dn:t.translate(s,a),t.scale(-1,-1)}if(t.yc(),v=this.Gc,C=(e+l+w)*v,a>C&&(n=this.verticalAlignment,n=n.y*a-n.y*C+n.offsetY),v===1&&this.ze!==null)w=this.Cb,w>s&&(w=s),this.Oj(this.ze,t,0,n+e,s,l,w,i,c,f,m);else if(this.Qc!==null&&this.Qb!==null)for(C=0;C<v;C++){var k=this.Qc[C];k>s&&(k=s),n+=e,this.Oj(this.Qb[C],t,0,n,s,l,k,i,c,f,m),n+=l+w}switch(this.flip){case dn:t.scale(-1,1),t.translate(-s,0);break;case qi:t.scale(1,-1),t.translate(0,-a);break;case Dn:t.scale(-1,-1),t.translate(-s,-a)}}},T.Oj=function(t,e,i,n,s,a,l,c,f,m,v){var w=0;if(c)f==="left"?w=0:f==="right"?w=s-l:f==="center"&&(w=(s-l)/2),e.fillRect(i+w,n+.25*a,l,1);else{if(f==="left"?w=0:f==="right"?w=s:f==="center"&&(w=s/2),s=Kg!==null?Kg(this,a):.75*a,e.fillText(t,i+w,n+s),t=a/20|0,t===0&&(t=1),f==="right"?w-=l:f==="center"&&(w-=l/2),m){c=Cm!==null?Cm(this,a):.8*a,f=i+w,m=n+c,s=i+w+l,c=n+c;var C=t;e.beginPath(),e.lineWidth=C,e.moveTo(f,m),e.lineTo(s,c),e.stroke(),e.Se(),e instanceof Bs&&e.ad.classList.add("gojs-td")}v&&(v=n+a-a/2.2|0,t%2!==0&&(v+=.5),n=i+w,a=v,i=i+w+l,l=v,w=t,e.beginPath(),e.lineWidth=w,e.moveTo(n,a),e.lineTo(i,l),e.stroke(),e.Se(),e instanceof Bs&&e.ad.classList.add("gojs-td"))}},T.kk=function(t,e,i){if(!at.prototype.kk.call(this,t,e,i))return!1;if(Br(this,t,this.xc,!0,!1,this.naturalBounds,this.actualBounds),i){if(this.svg.getElementsByTagName("text").length===0)return!0;for(e=this.svg.getElementsByClassName("gojs-td"),i=0;i<e.length;i++)Xy(t,e[i],!1)}else e=this.svg,e.innerHTML=this.text,Xy(t,e,!0);return!0},T.nk=function(t){return 1<this.lineCount||this.isUnderline||this.isStrikethrough?!0:at.prototype.nk.call(this,t)},T.Dv=function(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{t=t.getElementsByTagName("text");for(var i=0;i<t.length;i++)t[i].setAttributeNS(null,"filter",e)}},T.Wl=function(t,e,i,n){var s=this.Gc;this.Ih=t,this.l&=-16777217;var a=this.Ae;ca!==null&&s1!==a&&(s1=ca.font=a),this.Cb=this.Le=0,this.ze=this.Qb=this.Qc=this.df=null;var l;if(isNaN(this.desiredSize.width)){if(a=this.ec.replace(/\r\n/g,`
`).replace(/\r/g,`
`),a.length===0)a=8;else if(this.isMultiline){for(var c=l=0,f=!1;!f;){var m=a.indexOf(`
`,c);m===-1&&(m=a.length,f=!0),c=a.substr(c,m-c),this.formatting===Lm&&(c=c.trim()),l=Math.max(l,Ul(c)),c=m+1}a=l}else l=a.indexOf(`
`,0),0<=l&&(a=a.substr(0,l)),a=Ul(a);a=Math.min(a,t/this.scale)}else a=this.desiredSize.width;if(this.panel!==null&&(a=Math.min(a,this.panel.maxSize.width)),l=$g(this,a),isNaN(this.desiredSize.height)?l=Math.min(l,e/this.scale):l=this.desiredSize.height,f=l,this.Cb!==0&&this.Qc!==null&&this.Qb!==null&&this.overflow===km&&(e=this.Ae,e=this.overflow===km?Mm(e):0,m=this.spacingAbove+this.spacingBelow,m=Math.max(0,Sm(this)+m),f=Math.min(this.maxLines-1,Math.max(Math.floor(f/m+.01)-1,0)),!(f+1>=this.Qb.length))){for(this.l|=16777216,m=this.Qb[f],e=Math.max(1,t-e);Ul(m)>e&&1<m.length;)m=m.substr(0,m.length-1);m+=Em,e=Ul(m),this.Qb[f]=m,this.Qb=this.Qb.slice(0,f+1),this.Qc[f]=e,this.Qc=this.Qc.slice(0,f+1),this.Le=this.Qb.length,this.Cb=Math.max(this.Cb,e),this.Gc=this.Le,this.Gc===1&&(this.ze=this.Qb[0])}(this.wrap===l0||isNaN(this.desiredSize.width))&&(a=isNaN(t)?this.Cb:Math.min(t,this.Cb)),a=Math.max(i,a),l=Math.max(n,l),Lo(this.dc,a,l),this.Ge(0,0,a,l),this.svg!==null&&s!==this.Gc&&(this.Uc=!0)},T.eh=function(t,e,i,n){Ws(this,t,e,i,n)};function Sc(t,e,i){t.ze===null?(t.ze=e,t.Cb=i):((t.Qb===null||t.Qc===null)&&(t.Qb=[],t.Qc=[],t.Qb.push(t.ze),t.Qc.push(t.Cb)),t.Qb.push(e),t.Qc.push(i),t.Qb.length>t.maxLines&&(t.l|=16777216))}function Qv(t,e,i,n){var s=t.formatting===Lm;s&&(e=e.trim());var a=0,l=t.Ae,c=t.spacingAbove+t.spacingBelow;c=Math.max(0,Sm(t)+c);var f=t.overflow===km?Mm(l):0;if(t.Gc>=t.maxLines)n!==null&&n.h(0,c);else if(l=e,t.wrap===a0){t.Le=1;var m=Ul(e);if(f===0||m<=i)t.Cb=Math.max(t.Cb,m),Sc(t,e,t.Cb),n!==null&&n.h(m,c);else{for(a=s0(t,l),l=l.substr(a.length),e=s0(t,l),m=Ul(a+e);0<e.length&&m<=i;)a+=e,l=l.substr(e.length),e=s0(t,l),m=a+e,s&&(m=m.trim()),m=Ul(m);for(s&&(e=e.trim()),a+=e,i=Math.max(1,i-f);Ul(a)>i&&1<a.length;)a=a.substr(0,a.length-1);t.l|=16777216,a+=Em;var v=Ul(a);t.Cb=v,Sc(t,a,v),n!==null&&n.h(v,c)}}else{for(f=0,l.length===0&&(f=1,Sc(t,l,0));0<l.length;){for(e=s0(t,l),l=l.substr(e.length);Ul(e)>i;){var w=1;for(m=Ul(e.substr(0,w)),v=0;m<=i;)w++,v=m,m=Ul(e.substr(0,w));if(w===1){var C=m;a=Math.max(a,m)}else C=v,a=Math.max(a,v);if(w--,1>w&&(w=1),Sc(t,e.substr(0,w),C),f++,e=e.substr(w),t.Gc+f>t.maxLines)break}for(v=s0(t,l),m=Ul(e+v);0<v.length&&m<=i;)e+=v,l=l.substr(v.length),v=s0(t,l),m=e+v,s&&(m=m.trim()),m=Ul(m);if(s&&(e=e.trim()),e!==""&&(e[e.length-1]==="\xAD"&&(e=e.substring(0,e.length-1)+"\u2010"),v.length===0?(w=m,a=Math.max(a,m)):(w=v=Ul(e),a=Math.max(a,v)),Sc(t,e,w),f++,t.Gc+f>t.maxLines))break}t.Le=Math.min(t.maxLines,f),t.Cb=Math.max(t.Cb,a),n!==null&&n.h(t.Cb,c*t.Le)}}function s0(t,e){if(t.wrap===u0)return e.substr(0,1);for(var i=e.length,n=0,s=dx;n<i&&!s.test(e.charAt(n));)n++;for(t.formatting===o1&&(i=Math.min(i,n+1));n<i&&s.test(e.charAt(n));)n++;return n>=e.length?e:e.substr(0,n)}function Ul(t){return ca===null?8*t.length:ca.measureText(t).width}function Sm(t){if(t.df!==null)return t.df;var e=t.Ae;if(ca===null){var i=16;return t.df=i}return op[e]!==void 0&&5e3>h0?i=op[e]:(i=1.3*ca.measureText("M").width,op[e]=i,h0++),t.df=i}function Mm(t){if(ca===null)return 6;if(Vg[t]!==void 0&&5e3>Wg)var e=Vg[t];else e=ca.measureText(Em).width,Vg[t]=e,Wg++;return e}function $g(t,e){var i=t.ec.replace(/\r\n/g,`
`).replace(/\r/g,`
`),n=t.spacingAbove+t.spacingBelow;if(n=Math.max(0,Sm(t)+n),i.length===0)return t.Cb=0,t.Gc=1,n;if(!t.isMultiline){var s=i.indexOf(`
`,0);0<=s&&(i=i.substr(0,s))}s=0;for(var a=t.Gc=0,l,c=!1;!c;){if(l=i.indexOf(`
`,a),l===-1&&(l=i.length,c=!0),a<=l){if(a=i.substr(a,l-a),t.wrap!==a0){t.Le=0;var f=ii.alloc();Qv(t,a,e,f),s+=f.height,ii.free(f),t.Gc+=t.Le}else Qv(t,a,e,null),s+=n,t.Gc++;t.Gc===t.maxLines&&(c=!0)}a=l+1}return t.Lq=s}ct.Object.defineProperties(Wn.prototype,{font:{get:function(){return this.Ae},set:function(t){var e=this.Ae;e!==t&&(this.Ae=t,this.df=null,this.v(),this.g("font",e,t))}},text:{get:function(){return this.ec},set:function(t){var e=this.ec;t!=null?t=t.toString():t="",e!==t&&(this.ec=t,this.v(),this.g("text",e,t),this.Uc=!0)}},textAlign:{get:function(){return this.da!==null?this.da.Or:"start"},set:function(t){var e=this.textAlign;e===t||t!=="start"&&t!=="end"&&t!=="left"&&t!=="right"&&t!=="center"||(bs(this),this.da.Or=t,this.N(),this.g("textAlign",e,t))}},flip:{get:function(){return this.da!==null?this.da.Xf:Yt},set:function(t){var e=this.flip;e!==t&&(bs(this),this.da.Xf=t,this.N(),this.g("flip",e,t))}},verticalAlignment:{get:function(){return this.da!==null?this.da.Yr:Ms},set:function(t){var e=this.verticalAlignment;e.D(t)||(t=t.J(),bs(this),this.da.Yr=t,Qo(this),this.g("verticalAlignment",e,t))}},naturalBounds:{get:function(){if(!this.dc.w()){var t=ii.alloc();Qv(this,this.ec,999999,t);var e=t.width;ii.free(t),t=$g(this,e);var i=this.desiredSize;isNaN(i.width)||(e=i.width),isNaN(i.height)||(t=i.height),Lo(this.dc,e,t)}return this.dc}},isMultiline:{get:function(){return(this.l&2097152)!==0},set:function(t){var e=(this.l&2097152)!==0;e!==t&&(this.l^=2097152,this.v(),this.g("isMultiline",e,t))}},isUnderline:{get:function(){return(this.l&4194304)!==0},set:function(t){var e=(this.l&4194304)!==0;e!==t&&(this.l^=4194304,this.Uc=!0,this.N(),this.g("isUnderline",e,t))}},isStrikethrough:{get:function(){return(this.l&8388608)!==0},set:function(t){var e=(this.l&8388608)!==0;e!==t&&(this.l^=8388608,this.Uc=!0,this.N(),this.g("isStrikethrough",e,t))}},wrap:{get:function(){return this.da!==null?this.da.$r:Hg},set:function(t){var e=this.wrap;e!==t&&(bs(this),this.da.$r=t,this.v(),this.g("wrap",e,t))}},overflow:{get:function(){return this.da!==null?this.da.$q:ty},set:function(t){var e=this.overflow;e!==t&&(bs(this),this.da.$q=t,this.v(),this.g("overflow",e,t))}},isOverflowed:{get:function(){return(this.l&16777216)!==0}},stroke:{get:function(){return this.xc},set:function(t){var e=this.xc;e!==t&&(t!==null&&tp(t,"TextBlock.stroke"),t instanceof Tn&&t.freeze(),this.xc=t,this.N(),this.g("stroke",e,t))}},lineCount:{get:function(){return this.Gc}},lineHeight:{get:function(){return Sm(this)}},editable:{get:function(){return(this.l&1048576)!==0},set:function(t){var e=(this.l&1048576)!==0;e!==t&&(this.l^=1048576,this.g("editable",e,t))}},textEditor:{get:function(){return this.da!==null?this.da.Qr:null},set:function(t){var e=this.textEditor;e!==t&&(bs(this),this.da.Qr=t,this.g("textEditor",e,t))}},errorFunction:{get:function(){return this.da!==null?this.da.Hd:null},set:function(t){var e=this.errorFunction;e!==t&&(bs(this),this.da.Hd=t,this.g("errorFunction",e,t))}},interval:{get:function(){return this.fa!==null?this.fa.Tk:1},set:function(t){var e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.fa===null&&(this.fa=new hh),this.fa.Tk=t,this.v();var i=this.panel;i!==null&&(i.graduatedIntervals=null),this.g("interval",e,t)}}},graduatedStart:{get:function(){return this.fa!==null?this.fa.u:0},set:function(t){var e=this.graduatedStart;e!==t&&(0>t?t=0:1<t&&(t=1),this.fa===null&&(this.fa=new hh),this.fa.u=t,this.v(),this.g("graduatedStart",e,t))}},graduatedEnd:{get:function(){return this.fa!==null?this.fa.j:1},set:function(t){var e=this.graduatedEnd;e!==t&&(0>t?t=0:1<t&&(t=1),this.fa===null&&(this.fa=new hh),this.fa.j=t,this.v(),this.g("graduatedEnd",e,t))}},graduatedFunction:{get:function(){return this.fa!==null?this.fa.F:null},set:function(t){var e=this.graduatedFunction;e!==t&&(this.fa===null&&(this.fa=new hh),this.fa.F=t,this.v(),this.g("graduatedFunction",e,t))}},graduatedSkip:{get:function(){return this.fa!==null?this.fa.o:null},set:function(t){var e=this.graduatedSkip;e!==t&&(this.fa===null&&(this.fa=new hh),this.fa.o=t,this.v(),this.g("graduatedSkip",e,t))}},textValidation:{get:function(){return this.da!==null?this.da.vj:null},set:function(t){var e=this.textValidation;e!==t&&(bs(this),this.da.vj=t,this.g("textValidation",e,t))}},textEdited:{get:function(){return this.da!==null?this.da.Pr:null},set:function(t){var e=this.textEdited;e!==t&&(bs(this),this.da.Pr=t,this.g("textEdited",e,t))}},spacingAbove:{get:function(){return this.da!==null?this.da.Dr:0},set:function(t){var e=this.spacingAbove;e!==t&&(bs(this),this.da.Dr=t,this.v(),this.g("spacingAbove",e,t))}},spacingBelow:{get:function(){return this.da!==null?this.da.Er:0},set:function(t){var e=this.spacingBelow;e!==t&&(bs(this),this.da.Er=t,this.v(),this.g("spacingBelow",e,t))}},formatting:{get:function(){return this.da!==null?this.da.gq:Lm},set:function(t){var e=this.formatting;e!==t&&(bs(this),this.da.gq=t,this.v(),this.g("formatting",e,t))}},maxLines:{get:function(){return this.da!==null?this.da.Jq:1/0},set:function(t){var e=this.maxLines;e!==t&&(t=Math.floor(t),0>=t&&me(t,"> 0",Wn,"maxLines"),bs(this),this.da.Jq=t,this.v(),this.g("maxLines",e,t))}},metrics:{get:function(){return{arrSize:this.Qc!==null?this.Qc:[this.Cb],arrText:this.Qb!==null?this.Qb:[this.ze],maxLineWidth:this.Cb,fontHeight:this.df}}},choices:{get:function(){return this.Gm},set:function(t){var e=this.Gm;e!==t&&(this.Gm=t,this.g("choices",e,t))}}});var Kg=null,Cm=null,a0=new mt(Wn,"None",0),l0=new mt(Wn,"WrapFit",1),Hg=new mt(Wn,"WrapDesiredSize",2),u0=new mt(Wn,"WrapBreakAll",3),ty=new mt(Wn,"OverflowClip",0),km=new mt(Wn,"OverflowEllipsis",1),Lm=new mt(Wn,"FormatTrim",0),o1=new mt(Wn,"FormatNone",0),dx=/[ \u200b\u00ad]/,op=new ci,h0=0,Vg=new ci,Wg=0,Em="...",s1="",ca=null,Ug=!1;Wn.className="TextBlock";function ey(){this.nc=!1,this.Hd=null,this.Xf=Yt,this.gq=Lm,this.Jq=1/0,this.$q=ty,this.Er=this.Dr=0,this.Or="start",this.vj=this.Qr=this.Pr=null,this.Yr=Ms,this.$r=Hg}ey.prototype.copy=function(){var t=new ey;return t.Hd=this.Hd,t.Xf=this.Xf,t.gq=this.gq,t.Jq=this.Jq,t.$q=this.$q,t.Dr=this.Dr,t.Er=this.Er,t.Or=this.Or,t.Pr=this.Pr,t.Qr=this.Qr,t.vj=this.vj,t.Yr=this.Yr,t.$r=this.$r,t},Wn.getEllipsis=function(){return Em},Wn.setEllipsis=function(t){Em=t,Vg=new ci,Wg=0},Wn.getBaseline=function(){return Kg},Wn.setBaseline=function(t){Kg=t},Wn.getUnderline=function(){return Cm},Wn.setUnderline=function(t){Cm=t},Wn.isValidFont=function(t){if(Ug||(ca=Bn?new Tl(null).context:null,Ug=!0),ca===null)return!0;var e=ca.font;if(t===e||t==="10px sans-serif")return!0;ca.font="10px sans-serif",ca.font=t;var i=ca.font;if(i!=="10px sans-serif")return ca.font=e,!0;ca.font="19px serif";var n=ca.font;return ca.font=t,i=ca.font,ca.font=e,i!==n},Wn.FormatNone=o1,Wn.FormatTrim=Lm,Wn.None=a0,Wn.OverflowClip=ty,Wn.OverflowEllipsis=km,Wn.WrapBreakAll=u0,Wn.WrapDesiredSize=Hg,Wn.WrapFit=l0;function hh(){this.Tk=1,this.u=0,this.j=1,this.o=this.F=null}hh.prototype.copy=function(){var t=new hh;return t.Tk=this.Tk,t.u=this.u,t.j=this.j,t.F=this.F,t.o=this.o,t},hh.className="GradElementSettings";function da(t,e){at.call(this),this.Eg=null,this.qo="",this.Xg=Xn,this.Nk=ie,this.Zg=this.Hd=null,this.Mk=on,this.Xf=Yt,this.vl=null,this.qn=!1,this.en=!0,this.al=!1,this.bt=this.rl=null,typeof t=="string"?this.source=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}var c0;gi(da,at),da.prototype.cloneProtected=function(t){at.prototype.cloneProtected.call(this,t),t.qo=this.qo,t.element=this.Eg,t.Xg=this.Xg.J(),t.Nk=this.Nk,t.Xf=this.Xf,t.Hd=this.Hd,t.Zg=this.Zg,t.Mk=this.Mk.J(),t.en=this.en,t.rl=this.rl},da.prototype.qb=function(t){t===Yt||t===Ge||t===un?this.imageStretch=t:at.prototype.qb.call(this,t)},da.prototype.toString=function(){return"Picture("+this.source+")#"+Ti(this)};function d0(t){t===void 0&&(t=""),t!==""?c0[t]&&(delete c0[t],sp--):(c0=new ci,sp=0)}function a1(t,e){e.qy||(e.Fq=function(i){e.sq=!0,e.ln=!1;var n=e.Bg.copy();if(n!=null){for(n=n.iterator;n.next();){var s=n.value;s.N();var a=e.getAttribute("src")||"",l=s.Og.I(a);if(l!==null)for(var c=l.length,f=0;f<c;f++)a=l[f],s.Xn.add(a),a.Uc=!0,s.$b(),e.hn&&(e.eu===void 0&&(e.eu=i),a.Zg!==null&&a.Zg(a,i))}e.Bg.clear()}t.desiredSize.w()||(Hr(t,!1),t.v())},e.Yp=function(i){e.ln=i;var n=e.Bg.copy();if(n!=null){for(n=n.iterator;n.next();){var s=n.value,a=e.getAttribute("src")||"",l=s.Og.I(a);if(l!==null){s=l.length,a=Pe();for(var c=0;c<s;c++)a.push(l[c]);if(e.hn)for(c=0;c<s;c++)l=a[c],l.Hd!==null&&l.Hd(l,i);qe(a)}}e.Bg.clear()}},e.addEventListener("load",e.Fq),e.addEventListener("error",e.Yp),e.qy=!0)}da.prototype.hA=function(){if(this.source!==""){d0(this.source);var t=this.source;this.source="",this.source=t}},da.prototype.redraw=function(){this.N(),this.Uc=!0},da.prototype.hh=function(t,e){var i=this.Eg;if(i!==null){var n=i.getAttribute("src");if(!(i instanceof HTMLImageElement&&(n===null||n==="")||i.ln instanceof Event&&t instanceof uh)){var s=t instanceof Bs;n=this.naturalBounds;var a=0,l=0,c=this.qn,f=c?+i.width:i.naturalWidth;if(c=c?+i.height:i.naturalHeight,f===void 0&&i.videoWidth&&(f=i.videoWidth),c===void 0&&i.videoHeight&&(c=i.videoHeight),f=f||n.width,c=c||n.height,f!==0&&c!==0){var m=f,v=c;this.sourceRect.w()&&(a=this.Xg.x,l=this.Xg.y,f=this.Xg.width,c=this.Xg.height);var w=f,C=c,k=this.Nk,L=this.Mk;switch(k){case Yt:if(this.sourceRect.w())break;w>=n.width&&(a=a+L.offsetX+(w*L.x-n.width*L.x)),C>=n.height&&(l=l+L.offsetY+(C*L.y-n.height*L.y)),f=Math.min(n.width,w),c=Math.min(n.height,C);break;case ie:w=n.width,C=n.height;break;case Ge:case un:k===Ge?(k=Math.min(n.height/C,n.width/w),w*=k,C*=k):k===un&&(k=Math.max(n.height/C,n.width/w),w*=k,C*=k,w>=n.width&&(a=(a+L.offsetX+(w*L.x-n.width*L.x)/w)*f),C>=n.height&&(l=(l+L.offsetY+(C*L.y-n.height*L.y)/C)*c),f*=1/(w/n.width),c*=1/(C/n.height),w=n.width,C=n.height)}k=this.Df()*e.scale;var A=w*k*C*k,H=f*c/A,R=i.__goCache;k=null;var X=ap;if(!s){if(i.sq&&R!==void 0&&4<A&&H>X*X)for(R.gi===null&&(f0(R,4,m,v,i),f0(R,16,m,v,i)),s=R.gi,m=s.length,v=0;v<m&&s[v].ratio*s[v].ratio<H;v++)k=s[v];if(!e.Xm){if(this.vl===null)if(this.Eg===null)this.vl=!1;else{s=new Tl(null).context;try{s.drawImage(this.Eg,0,0)}catch(Y){this.en=!1}try{s.getImageData(0,0,1,1).data[3]&&(this.vl=!1),this.vl=!1}catch(Y){this.vl=!0}}if(this.vl)return}}switch(s=w<n.width?L.offsetX+(n.width*L.x-w*L.x):0,L=C<n.height?L.offsetY+(n.height*L.y-C*L.y):0,this.flip){case dn:t.translate(Math.min(n.width,w),0),t.scale(-1,1);break;case qi:t.translate(0,Math.min(n.height,C)),t.scale(1,-1);break;case Dn:t.translate(Math.min(n.width,w),Math.min(n.height,C)),t.scale(-1,-1)}if(t.yc(),e.Gf("pictureRatioOptimization")&&!e.$i&&R!==void 0&&k!==null&&k.ratio!==1){t.save(),e=k.ratio;try{t.drawImage(k.source,a/e,l/e,Math.min(k.source.width,f/e),Math.min(k.source.height,c/e),s,L,Math.min(n.width,w),Math.min(n.height,C)),t instanceof Bs&&(this.bt=[a/e,l/e,Math.min(k.source.width,f/e),Math.min(k.source.height,c/e),s,L,Math.min(n.width,w),Math.min(n.height,C)])}catch(Y){this.en=!1}t.restore()}else try{t.drawImage(i,a,l,f,c,s,L,Math.min(n.width,w),Math.min(n.height,C)),t instanceof Bs&&(this.bt=[a,l,f,c,s,L,Math.min(n.width,w),Math.min(n.height,C)])}catch(Y){this.en=!1}switch(this.flip){case dn:t.scale(-1,1),t.translate(-Math.min(n.width,w),0);break;case qi:t.scale(1,-1),t.translate(0,-Math.min(n.height,C));break;case Dn:t.scale(-1,-1),t.translate(-Math.min(n.width,w),-Math.min(n.height,C))}}}}},da.prototype.Wl=function(t,e,i,n){var s=this.desiredSize,a=Qs(this,!0),l=this.Eg,c=this.qn,f=0,m=0;(c||!this.al&&l&&l.complete)&&(this.al=!0),l===null?(isFinite(s.width)||(t=0),isFinite(s.height)||(e=0)):(f=c?+l.width:l.naturalWidth,m=c?+l.height:l.naturalHeight),isFinite(s.width)||a===ie||a===si?(isFinite(t)||(this.sourceRect.w()?t=this.sourceRect.width:l!==null&&(t=f)),i=0):l!==null&&this.al!==!1&&(t=this.sourceRect.w()?this.sourceRect.width:f),isFinite(s.height)||a===ie||a===yi?(isFinite(e)||(this.sourceRect.w()?e=this.sourceRect.height:l!==null&&(e=m)),n=0):l!==null&&this.al!==!1&&(e=this.sourceRect.w()?this.sourceRect.height:m),isFinite(s.width)&&(t=s.width),isFinite(s.height)&&(e=s.height),s=this.maxSize,a=this.minSize,i=Math.max(i||0,a.width),n=Math.max(n||0,a.height),t=Math.min(s.width,t),e=Math.min(s.height,e),t=Math.max(i,t),e=Math.max(n,e),l===null||l.complete||(isFinite(t)||(t=0),isFinite(e)||(e=0)),Lo(this.dc,t,e),this.Ge(0,0,t,e)},da.prototype.eh=function(t,e,i,n){Ws(this,t,e,i,n)},ct.Object.defineProperties(da.prototype,{element:{get:function(){return this.Eg},set:function(t){var e=this.Eg;if(this.Uc=!0,e!==t){this.qn=t instanceof HTMLCanvasElement;var i=t instanceof HTMLImageElement;t===null||i||t instanceof HTMLVideoElement||this.qn||lt("Picture.element must be an instance of Image, Canvas, or Video, not: "+t);var n=this.diagram;n!==null&&em(n,this),this.Eg=t,t!==null&&i&&t.Bg===void 0&&(t.Bg=new At),n!==null&&i&&Yc(n,this),t!==null&&(this.qn||t.complete===!0?(t.hn&&(t.ln instanceof Event&&this.Hd!==null?this.Hd(this,t.ln):t.sq===!0&&!t.ln&&this.Zg!==null&&t.eu&&this.Zg(this,t.eu)),t.sq=!0,this.desiredSize.w()||(Hr(this,!1),this.v())):i&&a1(this,t)),this.g("element",e,t),this.N()}}},source:{get:function(){return this.qo},set:function(t){var e=this.qo;if(e!==t){this.Uc=!0,this.qo=t;var i=c0;if(Bn){var n=null;if(i[t]!==void 0)n=i[t];else if(t!==""){30<sp&&(d0(),i=c0),n=te("img"),n.hn=!0,a1(this,n);var s=this.rl;s!==null&&(n.crossOrigin=s(this)),n.src=t,i[t]=n,sp++}this.element=n,n!==null&&n.__goCache===void 0&&(n.__goCache=new iy),this.v(),this.N()}this.g("source",e,t)}}},sourceCrossOrigin:{get:function(){return this.rl},set:function(t){if(this.rl!==t&&(this.rl=t,this.element!==null)){var e=this.element.getAttribute("src");t===null&&typeof e=="string"?this.element.crossOrigin=null:t!==null&&(this.element.crossOrigin=t(this)),this.element.src=e}}},sourceRect:{get:function(){return this.Xg},set:function(t){var e=this.Xg;e.D(t)||(this.Xg=t=t.J(),this.N(),this.g("sourceRect",e,t))}},imageStretch:{get:function(){return this.Nk},set:function(t){var e=this.Nk;e!==t&&(this.Nk=t,this.N(),this.g("imageStretch",e,t))}},flip:{get:function(){return this.Xf},set:function(t){var e=this.Xf;e!==t&&(this.Xf=t,this.N(),this.g("flip",e,t))}},imageAlignment:{get:function(){return this.Mk},set:function(t){var e=this.Mk;e.D(t)||(this.Mk=t=t.J(),this.N(),this.g("imageAlignment",e,t))}},errorFunction:{get:function(){return this.Hd},set:function(t){var e=this.Hd;e!==t&&(this.Hd=t,this.g("errorFunction",e,t))}},successFunction:{get:function(){return this.Zg},set:function(t){var e=this.Zg;e!==t&&(this.Zg=t,this.g("successFunction",e,t))}},naturalBounds:{get:function(){return this.dc}}}),da.prototype.redraw=da.prototype.redraw,da.prototype.reloadSource=da.prototype.hA;var sp=0,ap=4;da.className="Picture",c0=new ci,da.clearCache=d0;function iy(){this.gi=null}function f0(t,e,i,n,s){t.gi===null&&(t.gi=[]);var a=new Tl(null),l=a.context,c=1/e;a.width=i/e,a.height=n/e,a.width!==0&&a.height!==0&&(e=new l1(a.Oa,e),i=1,0<t.gi.length&&(i=t.gi[t.gi.length-1],s=i.source,i=i.ratio),l.setTransform(c*i,0,0,c*i,0,0),l.yc(),l.drawImage(s,0,0),t.gi.push(e))}iy.className="PictureCacheArray";function l1(t,e){this.source=t,this.ratio=e}l1.className="PictureCacheInstance";function od(){this.os=new fe,this.mc=null}od.prototype.reset=function(t){t!==null?(t.ka(),this.os=t,t.figures.clear()):this.os=new fe,this.mc=null};function Qd(t,e,i,n,s,a){t.mc=new Mr,t.mc.startX=e,t.mc.startY=i,t.mc.isFilled=n,t.mc.isEvenOdd=a||!1,t.os.figures.add(t.mc),s!==void 0&&(t.mc.isShadowed=s)}function fx(t){var e=t.mc.segments.length;0<e&&t.mc.segments.M(e-1).close()}od.prototype.moveTo=function(t,e,i){i===void 0&&(i=!1);var n=new an(mo);n.endX=t,n.endY=e,i&&n.close(),this.mc.segments.add(n)},od.prototype.lineTo=function(t,e,i){i===void 0&&(i=!1);var n=new an(er);n.endX=t,n.endY=e,i&&n.close(),this.mc.segments.add(n)};function Zl(t,e,i,n,s,a,l){var c;c===void 0&&(c=!1);var f=new an($o);f.point1X=e,f.point1Y=i,f.point2X=n,f.point2Y=s,f.endX=a,f.endY=l,c&&f.close(),t.mc.segments.add(f)}function sd(t,e,i,n,s){var a;a===void 0&&(a=!1);var l=new an(ps);l.point1X=e,l.point1Y=i,l.endX=n,l.endY=s,a&&l.close(),t.mc.segments.add(l)}od.prototype.arcTo=function(t,e,i,n,s,a,l){a===void 0&&(a=0),l===void 0&&(l=!1);var c=new an(Or);c.startAngle=t,c.sweepAngle=e,c.centerX=i,c.centerY=n,c.radiusX=s,c.radiusY=a!==0?a:s,l&&c.close(),this.mc.segments.add(c)};function tf(t,e,i,n,s,a,l,c){var f;f===void 0&&(f=!1),e=new an(xa,l,c,e,i,n,s,a),f&&e.close(),t.mc.segments.add(e)}function ny(t){var e=lp;return e!==null?(lp=null,e.reset(t),e):(e=new od,e.reset(t),e)}var lp=null;od.className="StreamGeometryContext";function Uo(t,e){var i=t.toLowerCase(),n=ht.Ze;n[t]=e,n[i]=t}Uo("Rectangle",function(t,e,i){t="r"+e+","+i;var n=ht.Mf[t];return n!==void 0||(n=new fe(fe.u),n.endX=e,n.endY=i,ht.Nf<ht.vm&&(ht.Mf[t]=n,ht.Nf++)),n}),Uo("Square",function(t,e,i){t="s"+e+","+i;var n=ht.Mf[t];return n!==void 0||(n=new fe(fe.u),n.endX=e,n.endY=i,n.defaultStretch=Ge,ht.Nf<ht.vm&&(ht.Mf[t]=n,ht.Nf++)),n}),Uo("RoundedRectangle",function(t,e,i){t=t?t.parameter1:NaN,(isNaN(t)||0>t)&&(t=5),t=Math.min(t,e/3),t=Math.min(t,i/3);var n="rr"+e+","+i+","+t,s=ht.Mf[n];if(s!==void 0)return s;var a=t*ht.wg;return s=new fe().add(new Mr(t,0,!0).add(new an(er,e-t,0)).add(new an($o,e,t,e-a,0,e,a)).add(new an(er,e,i-t)).add(new an($o,e-t,i,e,i-a,e-a,i)).add(new an(er,t,i)).add(new an($o,0,i-t,a,i,0,i-a)).add(new an(er,0,t)).add(new an($o,t,0,0,a,a,0).close())),1<a&&(s.spot1=new Ze(0,0,a,a),s.spot2=new Ze(1,1,-a,-a)),ht.Nf<ht.vm&&(ht.Mf[n]=s,ht.Nf++),s}),Uo("Border","RoundedRectangle"),Uo("Ellipse",function(t,e,i){t="e"+e+","+i;var n=ht.Mf[t];return n!==void 0||(n=new fe(fe.F),n.endX=e,n.endY=i,n.spot1=Oa,n.spot2=Ba,ht.Nf<ht.vm&&(ht.Mf[t]=n,ht.Nf++)),n}),Uo("Circle",function(t,e,i){t="c"+e+","+i;var n=ht.Mf[t];return n!==void 0||(n=new fe(fe.F),n.endX=e,n.endY=i,n.spot1=Oa,n.spot2=Ba,n.defaultStretch=Ge,ht.Nf<ht.vm&&(ht.Mf[t]=n,ht.Nf++)),n}),Uo("TriangleRight",function(t,e,i){return new fe().add(new Mr(0,0).add(new an(er,e,.5*i)).add(new an(er,0,i).close())).pm(0,.25,.5,.75)}),Uo("TriangleDown",function(t,e,i){return new fe().add(new Mr(0,0).add(new an(er,e,0)).add(new an(er,.5*e,i).close())).pm(.25,0,.75,.5)}),Uo("TriangleLeft",function(t,e,i){return new fe().add(new Mr(e,i).add(new an(er,0,.5*i)).add(new an(er,e,0).close())).pm(.5,.25,1,.75)}),Uo("TriangleUp",function(t,e,i){return new fe().add(new Mr(e,i).add(new an(er,0,i)).add(new an(er,.5*e,0).close())).pm(.25,.5,.75,1)}),Uo("Triangle","TriangleUp"),Uo("Diamond",function(t,e,i){return new fe().add(new Mr(.5*e,0).add(new an(er,0,.5*i)).add(new an(er,.5*e,i)).add(new an(er,e,.5*i).close())).pm(.25,.25,.75,.75)}),Uo("LineH",function(t,e,i){return t=new fe(fe.j),t.startX=0,t.startY=i/2,t.endX=e,t.endY=i/2,t}),Uo("LineV",function(t,e,i){return t=new fe(fe.j),t.startX=e/2,t.startY=0,t.endX=e/2,t.endY=i,t}),Uo("None","Rectangle"),Uo("BarH","Rectangle"),Uo("BarV","Rectangle"),Uo("MinusLine","LineH"),Uo("PlusLine",function(t,e,i){return new fe().add(new Mr(0,i/2,!1).add(new an(er,e,i/2)).add(new an(mo,e/2,0)).add(new an(er,e/2,i)))}),Uo("XLine",function(t,e,i){return new fe().add(new Mr(0,i,!1).add(new an(er,e,0)).add(new an(mo,0,0)).add(new an(er,e,i)))}),Uo("LineRight",function(t,e,i){return new fe().add(new Mr(.25*e,0,!1).add(new an(er,.75*e,.5*i)).add(new an(er,.25*e,i)))}),Uo("LineDown",function(t,e,i){return new fe().add(new Mr(0,.25*i,!1).add(new an(er,.5*e,.75*i)).add(new an(er,e,.25*i)))}),Uo("LineLeft",function(t,e,i){return new fe().add(new Mr(.75*e,0,!1).add(new an(er,.25*e,.5*i)).add(new an(er,.75*e,i)))}),Uo("LineUp",function(t,e,i){return new fe().add(new Mr(0,.75*i,!1).add(new an(er,.5*e,.25*i)).add(new an(er,e,.75*i)))}),ht.um={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",BackwardOpenTriangleLine:"m 8,0 l -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};function p0(){this.nc=!1,this.tr=this.Kp=this.zq=null,this.vr="",this.fr=this.oq=this.ur=null,this.hr="",this.gr=Ps,this.ir=null,this.jr="",this.lr=zn,this.Gq="",this.Hq=An,this.Pq=vn,this.Kq=Qn,this.Up=null,this.Cq=127,this.zr=Kn,this.yr="gray",this.Vg=4}p0.prototype.copy=function(){var t=new p0;return t.zq=this.zq,t.Kp=this.Kp,t.tr=this.tr,t.vr=this.vr,t.ur=this.ur,t.oq=this.oq,t.fr=this.fr,t.hr=this.hr,t.gr=this.gr.J(),t.ir=this.ir,t.jr=this.jr,t.lr=this.lr.J(),t.Gq=this.Gq,t.Hq=this.Hq.J(),t.Pq=this.Pq.J(),t.Kq=this.Kq.J(),t.Up=this.Up,t.Cq=this.Cq,t.zr=this.zr.J(),t.yr=this.yr,t.Vg=this.Vg,t};function ui(t,e){t===void 0||t instanceof So||typeof t=="string"?ne.call(this,t):(ne.call(this),t&&(e=t)),this.G=2408959,this.Tf="",this.P=null,this.Jg="",this.Qf=this.Ug=null,this.ec="",this.Ah=this.Ig=null,this.ke=new z(NaN,NaN).freeze(),this.nf=null,this.Ao=NaN,this.vw=-1,this.py=new It,this.Rh=null,this.ag=NaN,e&&Object.assign(this,e)}gi(ui,ne),ui.prototype.cloneProtected=function(t){ne.prototype.cloneProtected.call(this,t),t.G=this.G&-4097|49152,t.Tf=this.Tf,this.P!==null&&(t.P=this.P.nc?this.P:this.P.copy()),t.Jg=this.Jg,t.Qf=null,t.ec=this.ec,t.ke.assign(this.ke),t.Ao=this.Ao},T=ui.prototype,T.Af=function(t){ne.prototype.Af.call(this,t),t.oh(),t.Ug=null,t.nf=null,t.Rh=null},T.toString=function(){var t=Re(this.constructor)+"#"+Ti(this);return this.data!==null&&(t+="("+ni(this.data)+")"),t};function us(t){t.P===null?t.P=new p0:t.P.nc&&(t.P=t.P.copy())}T.th=function(){ne.prototype.th.call(this),this.P!==null&&(this.P.nc=!0)},T.gk=function(t,e,i,n,s,a,l){var c=this.diagram;c!==null&&(t===Yr&&e==="elements"?s instanceof ne?Hh(s,function(f){Gr(c.partManager,f),nh(c,f)}):Yc(c,s):t===Jr&&e==="elements"&&(s instanceof ne?Hh(s,function(f){dd(c.partManager,f,c)}):em(c,s)),c.cb(t,e,i,n,s,a,l))},T.La=function(t){if(ne.prototype.La.call(this,t),this.data!==null){for(var e=this.O.s,i=e.length,n=0;n<i;n++){var s=e[n];s instanceof ne&&Hh(s,function(a){a.data!==null&&a.La()})}for(e=this.adornments;e.next();)e.value.La(t)}},ui.prototype.updateRelationshipsFromData=function(){var t;this.data!==null&&((t=this.diagram)===null||t===void 0||t.partManager.updateRelationshipsFromData(this))},ui.prototype.Pj=function(t){var e=this.Qf;return e===null?null:e.I(t)},ui.prototype.bh=function(t,e){if(e!==null){var i=null,n=this.Qf;if(n!==null&&(i=n.I(t)),i!==e){if(i!==null){var s=i.diagram;s!==null&&s.remove(i)}n===null&&(this.Qf=n=new pe),e.Tf!==t&&(e.category=t),n.add(t,e),t=this.diagram,t!==null&&(t.add(e),t=e.adornedObject,t!==null&&(t=t.ih(),t!==null&&(e.data=t.data)))}}},ui.prototype.Jf=function(t){var e=this.Qf;if(e!==null){var i=e.I(t);if(i!==null){var n=i.diagram;n!==null&&n.remove(i)}e.remove(t),e.count===0&&(this.Qf=null)}},ui.prototype.Ej=function(){var t=this.Qf;if(t!==null){var e=Pe();for(t=t.iterator;t.next();)e.push(t.key);t=e.length;for(var i=0;i<t;i++)this.Jf(e[i]);qe(e)}},ui.prototype.updateAdornments=function(){var t=this.diagram;if(t!==null){for(var e=this.adornments;e.next();){var i=e.value;i.v(),i.placeholder&&i.placeholder.v()}t:{if(this.isSelected&&this.selectionAdorned&&(e=this.selectionObject,e!==null&&this.actualBounds.w()&&this.isVisible()&&e.Ed()&&e.actualBounds.w())){if(i=this.Pj("Selection"),i===null){if(i=this.selectionAdornmentTemplate,i===null&&(i=this.ph()?t.linkSelectionAdornmentTemplate:this instanceof ji?t.groupSelectionAdornmentTemplate:t.nodeSelectionAdornmentTemplate),!(i instanceof Cn))break t;_a(i),i=i.copy(),i!==null&&(this.ph()&&this.selectionObject===this.path&&(i.type=ne.Link),i.adornedObject=e)}if(i!==null){i.type===ne.Link&&i.v(),this.bh("Selection",i);break t}}this.Jf("Selection")}for(px(this,t),e=this.adornments;e.next();)e.value.La()}},ui.prototype.Wb=function(){var t=this.diagram;t!==null&&(t.vd=!0,!(this.G&16384)&&(this.G|=16384))};function _m(t){t.G&16384&&(t.updateAdornments(),t.G&=-16385)}function px(t,e){e.toolManager.mouseDownTools.each(function(i){i.isEnabled&&i.updateAdornments(t)}),e.toolManager.updateAdornments(t)}function Zg(t){if(Mc(t)===!1){ry(t,!0),t.Uk();var e=t.diagram;e!==null&&(e.De.add(t),e.$b())}}function u1(t){if(t.G|=2097152,Mc(t)!==!1){var e=t.position,i=t.location;i.w()&&e.w()||ef(t,e,i),i=t.Ib;var n=It.alloc().assign(i);i.ka(),i.x=e.x,i.y=e.y,i.freeze(),t.Xl(n,i),It.free(n),ry(t,!1)}}ui.prototype.Ge=function(t,e,i,n){var s=this.uc;s.h(t,e,i,n),this.Lb===null&&(this.Lb=new nn);var a=this.Lb;a.reset(),this.no(a,t,e,i,n),this.Lb=a,a.ws()||a.pp(s)},ui.prototype.no=function(t,e,i,n,s){if(this.Ca!==1&&t.scale(this.Ca),this.Kb!==0){var a=on;this.locationSpot.sb()&&(a=this.locationSpot);var l=z.alloc();if(this.locationObject!==this)for(e=this.locationObject,i=e.naturalBounds,l.yi(i.x,i.y,i.width,i.height,a),e.Lb!==null&&e.Lb.Ga(l),l.offset(-e.measuredBounds.x,-e.measuredBounds.y),a=e.panel;a!==null&&a!==this;)a.Lb!==null&&a.Lb.Ga(l),l.offset(-a.measuredBounds.x,-a.measuredBounds.y),a=a.panel;else l.yi(e,i,n,s,a);t.rotate(this.Kb,l.x,l.y),z.free(l)}},ui.prototype.move=function(t,e){e===!0?this.location=t:this.position=t},ui.prototype.moveTo=function(t,e,i){t=z.allocAt(t,e),this.move(t,i),z.free(t)},ui.prototype.isVisible=function(){if(!this.visible)return!1;var t=this.layer;if(t!==null){if(!t.visible)return!1;if(t=t.diagram,t!==null&&t.animationManager.fv(this))return!0}return t=this.containingGroup,!!(t===null||t.isSubGraphExpanded&&t.isVisible())},ui.prototype.Zb=function(t){var e=this.diagram;t?(this.C(4),this.Wb(),e!==null&&e.De.add(this)):(this.C(8),this.Ej()),this.oh(),e!==null&&(e.Ya(),e.N())},ui.prototype.fb=function(t){if(this.name===t)return this;var e=this.Rh;if(e===null&&(this.Rh=e=new pe),e.I(t)!==null)return e.I(t);var i=ne.prototype.fb.call(this,t);return i!==null?(e.set(t,i),i):(e.set(t,null),null)};function ch(t,e,i,n){n===void 0&&(n=new z),i=i.Mc()?on:i;var s=e.naturalBounds;if(n.h(s.width*i.x+i.offsetX,s.height*i.y+i.offsetY),e===null||e===t)return n;for(e.transform.Ga(n),e=e.panel;e!==null&&e!==t;)e.transform.Ga(n),e=e.panel;return t.Lb!==null&&t.Lb.Ga(n),n.offset(-t.uc.x,-t.uc.y),n}ui.prototype.mi=function(t){return t===void 0&&(t=new It),t.assign(this.actualBounds)},ui.prototype.Va=function(){this.measure(1/0,1/0),this.arrange()};function Tu(t){var e=z.alloc(),i=t.locationObject,n=i.naturalBounds,s=i instanceof Xi?i.strokeWidth:0;if(e.yi(0,0,n.width+s,n.height+s,t.locationSpot),i!==t)for(e.offset(-s/2,-s/2),i.transform.Ga(e),i=i.panel;i!==null&&i!==t;)i.transform.Ga(e),i=i.panel;return t.Lb!==null&&t.Lb.Ga(e),e.offset(-t.uc.x,-t.uc.y),e}function hu(t,e){var i=t.py;isNaN(t.ag)&&(t.ag=t1(t));var n=t.ag,s=2*n;if(!t.isShadowed)return i.h(e.x-1-n,e.y-1-n,e.width+2+s,e.height+2+s),i;n=e.x,s=e.y;var a=e.width;e=e.height;var l=t.shadowBlur;return t=t.shadowOffset,a+=l,e+=l,n-=l/2,s-=l/2,0<t.x?a+=t.x:(n+=t.x,a-=t.x),0<t.y?e+=t.y:(s+=t.y,e-=t.y),i.h(n-1,s-1,a+2,e+2),i}ui.prototype.arrange=function(){if(Us(this)===!1)u1(this);else{vs(this,!1);var t=this.Ib,e=It.alloc();e.assign(t);var i=ad(this);this.eh(0,0,this.uc.width,this.uc.height);var n=this.position;ef(this,n,this.location),t.ka(),t.x=n.x,t.y=n.y,t.freeze(),this.Xl(e,t),e.D(t)?this.Fd(i):!this.Zc()||ht.B(e.width,t.width)&&ht.B(e.height,t.height)||0<=this.vw&&this.C(16),It.free(e),ry(this,!1)}},T=ui.prototype,T.Xl=function(t,e){var i=this.diagram;if(i!==null){var n=!1;if(i.Zi===!1&&t.w()){var s=It.alloc();s.assign(i.documentBounds),s.Fv(i.padding),t.x>s.x&&t.y>s.y&&t.right<s.right&&t.bottom<s.bottom&&e.x>s.x&&e.y>s.y&&e.right<s.right&&e.bottom<s.bottom&&(n=!0),It.free(s)}!(this.G&65536)&&t.D(e)||Tm(this,n,i),i.N(),!t.w()&&!e.w()||Xs(t,e)||(this instanceof Le&&!i.undoManager.isUndoingRedoing&&this.Bd(),this.oh())}},T.zv=function(t,e,i){if(this.ph()||!t.w())return!1;var n=this.diagram;return n!==null&&h1(this,n,t,e,i),this.pa=t,this.G&=-2097153,!this.ke.w()||n!==null&&!n.animationManager.isTicking&&n.undoManager.isUndoingRedoing||(n=this.ke,this.ke=new z(n.x+(t.x-e),n.y+(t.y-i)),this.g("location",n,this.ke.copy())),Mc(this)===!1&&Us(this)===!1&&(Zg(this),u1(this)),!0};function h1(t,e,i,n,s){e===null||t instanceof Cn||(e=e.animationManager,e.zb&&Bf(e,t,new z(n,s),i))}T.mm=function(t,e,i){var n=this.ke,s=this.pa;if(i){if(n.x===t&&n.y===e)return;Mc(this)||Us(this)?s.h(NaN,NaN):s.h(s.x+t-n.x,s.y+e-n.y),n.h(t,e)}else{if(s.x===t&&s.y===e)return;n.h(n.x+t-s.x,n.y+e-s.y),s.h(t,e)}Zg(this)},T.Av=function(){this.G&=-2097153,Zg(this)};function ef(t,e,i){var n=Tu(t),s=t.diagram,a=i.w(),l=e.w();a&&l?t.G&2097152?c1(t,e,i,s,n):nf(t,e,i,s,n):a?c1(t,e,i,s,n):l&&nf(t,e,i,s,n),t.G|=2097152,z.free(n),t.Uk()}function c1(t,e,i,n,s){var a=e.x,l=e.y;e.h(i.x-s.x,i.y-s.y),n!==null&&(i=n.animationManager,(n=i.defaultAnimation.isAnimating)||!i.zb||t instanceof Cn||Bf(i,t,new z(a,l),e),n||e.x===a&&e.y===l||t.g("position",new z(a,l),e.copy()))}function nf(t,e,i,n,s){var a=i.copy();i.h(e.x+s.x,e.y+s.y),i.D(a)||n===null||t.g("location",a,i.copy())}function Tm(t,e,i){Gg(t,!1),t instanceof Le&&sh(i,t),t.layer.isTemporary||e||i.Ya(),e=t.Ib;var n=i.viewportBounds;n.w()?ad(t)?(oa(e,n)||t.Fd(!1),t.updateAdornments()):t.isVisible()&&e.Yc(n)?(t.Fd(!0),t.updateAdornments()):t.Wb():i.vd=!0}T.si=function(){return!0},T.Zc=function(){return!0},T.ph=function(){return!1},T.Dd=function(){return!0};function m0(t,e,i,n){e.constructor===t.constructor||f1||(f1=!0,Fe('Should not change the class of the Part when changing category from "'+i+'" to "'+n+'"'),Fe(" Old class: "+Re(t.constructor)+", new class: "+Re(e.constructor)+", part: "+t.toString())),t.Ej();var s=t.data;i=t.layerName;var a=t.isSelected,l=t.isHighlighted,c=!0,f=!0,m=!1;t instanceof Le&&(c=t.isTreeLeaf,f=t.isTreeExpanded,m=t.wasTreeExpanded),e.Af(t),e.cloneProtected(t),t.Tf=n,t.svg!==null&&(t.svg.remove(),t.svg=null,t.Uc=!0),t.v(),t.N(),e=t.diagram,n=!0,e!==null&&(n=e.skipsUndoManager,e.skipsUndoManager=!0),t.ub=s,t.G=a?t.G|4096:t.G&-4097,t.G=l?t.G|524288:t.G&-524289,t instanceof Le&&(t.U=c?t.U|4:t.U&-5,t.U=f?t.U|1:t.U&-2,t.U=m?t.U|2:t.U&-3),s!==null&&t.La(),s=t.layerName,s!==i&&(t.Jg=i,t.layerName=s),e!==null&&(e.skipsUndoManager=n),t.Zc()&&t.C(64)}ui.prototype.canCopy=function(){if(!this.copyable)return!1;var t=this.layer;return t===null?!0:t.allowCopy?(t=t.diagram,t===null?!0:!!t.allowCopy):!1},ui.prototype.canDelete=function(){if(!this.deletable)return!1;var t=this.layer;return t===null?!0:t.allowDelete?(t=t.diagram,t===null?!0:!!t.allowDelete):!1},ui.prototype.canEdit=function(){if(!this.textEditable)return!1;var t=this.layer;return t===null?!0:t.allowTextEdit?(t=t.diagram,t===null?!0:!!t.allowTextEdit):!1},ui.prototype.canGroup=function(){if(!this.groupable)return!1;var t=this.layer;return t===null?!0:t.allowGroup?(t=t.diagram,t===null?!0:!!t.allowGroup):!1},ui.prototype.canMove=function(){if(!this.movable)return!1;var t=this.layer;return t===null?!0:t.allowMove?(t=t.diagram,t===null?!0:!!t.allowMove):!1},ui.prototype.canReshape=function(){if(!this.reshapable)return!1;var t=this.layer;return t===null?!0:t.allowReshape?(t=t.diagram,t===null?!0:!!t.allowReshape):!1},ui.prototype.canResize=function(){if(!this.resizable)return!1;var t=this.layer;return t===null?!0:t.allowResize?(t=t.diagram,t===null?!0:!!t.allowResize):!1},ui.prototype.canRotate=function(){if(!this.rotatable)return!1;var t=this.layer;return t===null?!0:t.allowRotate?(t=t.diagram,t===null?!0:!!t.allowRotate):!1},ui.prototype.canSelect=function(){if(!this.selectable)return!1;var t=this.layer;return t===null?!0:t.allowSelect?(t=t.diagram,t===null?!0:!!t.allowSelect):!1};function Mc(t){return(t.G&32768)!==0}function ry(t,e){t.G=e?t.G|32768:t.G&-32769}function Gg(t,e){t.G=e?t.G|65536:t.G&-65537}function ad(t){return(t.G&131072)!==0}T=ui.prototype,T.Fd=function(t){this.G=t?this.G|131072:this.G&-131073};function Pm(t,e){t.G=e?t.G|1048576:t.G&-1048577}T.oh=function(){var t=this.containingGroup;t!==null&&(t.v(),t.placeholder!==null&&t.placeholder.v(),t.Bd())},T.N=function(){var t=this.diagram;t!==null&&!Us(this)&&!Mc(this)&&this.isVisible()&&this.Ib.w()&&t.N(hu(this,this.Ib))},T.v=function(){ne.prototype.v.call(this);var t=this.diagram;t!==null&&(t.De.add(this),this instanceof Le&&this.labeledLink!==null&&Qo(this.labeledLink),t.$b(!0))},T.Vo=function(t){t||(t=this.Ah,t!==null&&hy(t,this))},T.Wo=function(t){t||(t=this.Ah,t!==null&&cy(t,this))},T.Lj=function(){var t=this.data;if(t!==null){var e=this.diagram;e!==null&&(e=e.model,e!==null&&e.cm(t))}},T.oz=function(){return Xg(this,this)};function Xg(t,e){var i=e.containingGroup;return i!==null?1+Xg(t,i):e instanceof Le&&(e=e.labeledLink,e!==null)?Xg(t,e):0}T.sz=function(){return d1(this,this)};function d1(t,e){var i=e.containingGroup;return i!==null||e instanceof Le&&(i=e.labeledLink,i!==null)?d1(t,i):e}T.Td=function(t){return t instanceof ji?oy(this,this,t):!1};function oy(t,e,i){if(e===i||i===null)return!1;var n=e.containingGroup;return n===null||n!==i&&!oy(t,n,i)?e instanceof Le&&(e=e.labeledLink,e!==null)?oy(t,e,i):!1:!0}T.px=function(t){if(t===null)return null;if(this===t)return this.containingGroup;for(var e=this;e!==null;){if(e instanceof ji&&Pm(e,!0),e instanceof Le){var i=e.labeledLink;i!==null&&(e=i)}e=e.containingGroup}for(i=null,e=t;e!==null;){if(e.G&1048576){i=e;break}e instanceof Le&&(t=e.labeledLink,t!==null&&(e=t)),e=e.containingGroup}for(e=this;e!==null;)e instanceof ji&&Pm(e,!1),e instanceof Le&&(t=e.labeledLink,t!==null&&(e=t)),e=e.containingGroup;return i},ui.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var t=this.layer;return!(t!==null&&t.isTemporary||this instanceof Le&&this.isLinkLabel)},ui.prototype.C=function(t){if(t===void 0&&(t=16777215),this.isLayoutPositioned&&t&this.layoutConditions){var e=this.layer;e!==null&&e.isTemporary||this instanceof Le&&this.isLinkLabel?e=!1:(e=this.diagram,e=!(e!==null&&e.undoManager.isUndoingRedoing))}else e=!1;if(e)if(e=this.Ah,e!==null){var i=e.layout;i!==null?i.C():e.C(t)}else t=this.diagram,t!==null&&(t=t.layout,t!==null&&t.C())};function Nm(t){return t.isVisible()?(t=t.layer,!(t!==null&&t.isTemporary)):!1}function Cc(t,e,i,n,s,a){if(a===void 0&&(a=null),!(t.contains(e)||a!==null&&!a(e)||e instanceof Cn)){if(t.add(e),e instanceof Le){if(i&&e instanceof ji)for(var l=e.memberParts;l.next();)Cc(t,l.value,i,n,s,a);if(s!==!1)for(l=e.linksConnected;l.next();){var c=l.value;if(!t.contains(c)){var f=c.fromNode,m=c.toNode;f=f===null||t.contains(f),m=m===null||t.contains(m),(s?f&&m:f||m)&&Cc(t,c,i,n,s,a)}}if(1<n)for(e=e.Ou();e.next();)Cc(t,e.value,i,n-1,s,a)}else if(e instanceof ue)for(e=e.labelNodes;e.next();)Cc(t,e.value,i,n,s,a)}}ct.Object.defineProperties(ui.prototype,{key:{get:function(){var t=this.diagram;if(t!==null)return t.model.wa(this.data)}},adornments:{get:function(){return this.Qf===null?Gi:this.Qf.iteratorValues}},layer:{get:function(){return this.Ig}},diagram:{get:function(){var t=this.Ig;return t==null?null:t.diagram}},layerName:{get:function(){return this.Jg},set:function(t){var e=this.Jg;if(e!==t){var i=this.diagram;if((i===null||i.Qj(t)!==null&&!i.partManager.addsToTemporaryLayer)&&(this.Jg=t,i!==null&&i.Ya(),this.g("layerName",e,t),e=this.layer,e!==null&&e.name!==t&&(i=e.diagram,i!==null&&(t=i.Qj(t),t!==null&&t!==e)))){var n=e.pc(-1,this,!0);if(0<=n&&i.cb(Jr,"parts",e,this,null,n,!0),n=t.oi(99999999,this,!0),e.visible!==t.visible&&this.Zb(t.visible),0<=n&&i.cb(Yr,"parts",t,null,this,!0,n),n=this.layerChanged,n!==null){var s=i.aa;i.aa=!0,n(this,e,t),i.aa=s}}}}},layerChanged:{get:function(){return this.P!==null?this.P.zq:null},set:function(t){var e=this.layerChanged;e!==t&&(us(this),this.P.zq=t,this.g("layerChanged",e,t))}},zOrder:{get:function(){return this.Ao},set:function(t){var e=this.Ao;if(e!==t){this.Ao=t;var i=this.layer;i!==null&&jf(i,-1,this),this.g("zOrder",e,t),t=this.diagram,t!==null&&t.N()}}},locationObject:{get:function(){if(this.nf===null){var t=this.locationObjectName;t!==""?(t=this.fb(t),t!==null?this.nf=t:this.nf=this):this instanceof Cn?this.type!==ne.Link&&this.placeholder!==null?this.nf=this.placeholder:this.nf=this:this.nf=this}return this.nf.visible?this.nf:this}},minLocation:{get:function(){return this.P!==null?this.P.Pq:vn},set:function(t){var e=this.minLocation;e.D(t)||(t=t.J(),us(this),this.P.Pq=t,this.g("minLocation",e,t))}},maxLocation:{get:function(){return this.P!==null?this.P.Kq:Qn},set:function(t){var e=this.maxLocation;e.D(t)||(t=t.J(),us(this),this.P.Kq=t,this.g("maxLocation",e,t))}},locationObjectName:{get:function(){return this.P!==null?this.P.Gq:""},set:function(t){var e=this.locationObjectName;e!==t&&(us(this),this.P.Gq=t,this.nf=null,this.v(),this.g("locationObjectName",e,t))}},locationSpot:{get:function(){return this.P!==null?this.P.Hq:An},set:function(t){var e=this.locationSpot;e.D(t)||(t=t.J(),us(this),this.P.Hq=t,this.v(),this.g("locationSpot",e,t))}},location:{get:function(){return this.ke},set:function(t){var e=t.x,i=t.y,n=this.ke;if(!(n.x===e||isNaN(n.x)&&isNaN(e))||!(n.y===i||isNaN(n.y)&&isNaN(i))){if(t=t.copy(),e=t,this.ph())e=!1;else{if(this.ke=e,this.G|=2097152,Us(this)===!1&&(Zg(this),i=this.pa,i.w())){var s=this.diagram;if(s===null||s.animationManager.isTicking||!s.undoManager.isUndoingRedoing){var a=i.copy();i.h(i.x+(e.x-n.x),i.y+(e.y-n.y)),h1(this,s,i,a.x,a.y),this.g("position",a,i.copy())}}e=!0}e&&this.g("location",n,t.copy())}}},category:{get:function(){return this.Tf},set:function(t){var e=this.Tf;if(e!==t){this.svg!==null&&(this.svg.remove(),this.Uc=!0);var i=this.diagram,n=this.data,s=null;if(i!==null&&n!==null&&!(this instanceof Cn)){var a=i.model.undoManager;a.isEnabled&&!a.isUndoingRedoing&&(s=this.clone(),s.O.addAll(this.O))}this.Tf=t,this.g("category",e,t),i===null||n===null||this instanceof Cn?this instanceof Cn&&(s=this.adornedPart,s!==null&&(t=s.Qf,t!==null&&t.remove(e),s.bh(this.category,this))):(a=i.model,a.undoManager.isUndoingRedoing||(this.ph()?(i.partManager.setLinkCategoryForData(n,t),i=i.partManager.findLinkTemplateForCategory(t),i!==null&&(_a(i),i=i.copy(),i!==null&&m0(this,i,e,t))):(a!==null&&a.jm(n,t),i=M1(i.partManager,n,t),i!==null&&(_a(i),i=i.copy(),i===null||i instanceof ue||(n=this.location.copy(),m0(this,i,e,t),this.location.w()||(this.location=n)))),s!==null&&(e=this.clone(),e.O.addAll(this.O),this.g("self",s,e))))}}},self:{get:function(){return this},set:function(t){m0(this,t,this.category,t.category)}},copyable:{get:function(){return(this.G&1)!==0},set:function(t){var e=(this.G&1)!==0;e!==t&&(this.G^=1,this.g("copyable",e,t))}},deletable:{get:function(){return(this.G&2)!==0},set:function(t){var e=(this.G&2)!==0;e!==t&&(this.G^=2,this.g("deletable",e,t))}},textEditable:{get:function(){return(this.G&4)!==0},set:function(t){var e=(this.G&4)!==0;e!==t&&(this.G^=4,this.g("textEditable",e,t),this.Wb())}},groupable:{get:function(){return(this.G&8)!==0},set:function(t){var e=(this.G&8)!==0;e!==t&&(this.G^=8,this.g("groupable",e,t))}},movable:{get:function(){return(this.G&16)!==0},set:function(t){var e=(this.G&16)!==0;e!==t&&(this.G^=16,this.g("movable",e,t))}},selectionAdorned:{get:function(){return(this.G&32)!==0},set:function(t){var e=(this.G&32)!==0;e!==t&&(this.G^=32,this.g("selectionAdorned",e,t),this.Wb())}},isInDocumentBounds:{get:function(){return(this.G&64)!==0},set:function(t){var e=(this.G&64)!==0;if(e!==t){this.G^=64;var i=this.diagram;i!==null&&i.Ya(),this.g("isInDocumentBounds",e,t)}}},isLayoutPositioned:{get:function(){return(this.G&128)!==0},set:function(t){var e=(this.G&128)!==0;e!==t&&(this.G^=128,this.g("isLayoutPositioned",e,t),this.C(t?4:8))}},selectable:{get:function(){return(this.G&256)!==0},set:function(t){var e=(this.G&256)!==0;e!==t&&(this.G^=256,this.g("selectable",e,t),this.Wb())}},reshapable:{get:function(){return(this.G&512)!==0},set:function(t){var e=(this.G&512)!==0;e!==t&&(this.G^=512,this.g("reshapable",e,t),this.Wb())}},resizable:{get:function(){return(this.G&1024)!==0},set:function(t){var e=(this.G&1024)!==0;e!==t&&(this.G^=1024,this.g("resizable",e,t),this.Wb())}},rotatable:{get:function(){return(this.G&2048)!==0},set:function(t){var e=(this.G&2048)!==0;e!==t&&(this.G^=2048,this.g("rotatable",e,t),this.Wb())}},isSelected:{get:function(){return(this.G&4096)!==0},set:function(t){var e=(this.G&4096)!==0;if(e!==t){var i=this.diagram;if(!t||this.canSelect()&&!(i!==null&&i.selection.count>=i.maxSelectionCount)){this.G^=4096;var n=!1;if(i!==null){n=i.skipsUndoManager,i.skipsUndoManager=!0;var s=i.selection;s.ka(),t?s.add(this):s.remove(this),s.freeze()}this.g("isSelected",e,t),this.Wb(),t=this.selectionChanged,t!==null&&t(this),i!==null&&(i.$b(),i.skipsUndoManager=n)}}}},isHighlighted:{get:function(){return(this.G&524288)!==0},set:function(t){var e=(this.G&524288)!==0;if(e!==t){this.G^=524288;var i=this.diagram;i!==null&&(i=i.highlighteds,i.ka(),t?i.add(this):i.remove(this),i.freeze()),this.g("isHighlighted",e,t),this.N(),t=this.highlightedChanged,t!==null&&t(this)}}},isShadowed:{get:function(){return(this.G&8192)!==0},set:function(t){var e=(this.G&8192)!==0;e!==t&&(this.G^=8192,this.Uc=!0,this.g("isShadowed",e,t),this.N())}},isAnimated:{get:function(){return(this.G&262144)!==0},set:function(t){var e=(this.G&262144)!==0;e!==t&&(this.G^=262144,this.g("isAnimated",e,t))}},highlightedChanged:{get:function(){return this.P!==null?this.P.oq:null},set:function(t){var e=this.highlightedChanged;e!==t&&(us(this),this.P.oq=t,this.g("highlightedChanged",e,t))}},selectionObjectName:{get:function(){return this.P!==null?this.P.vr:""},set:function(t){var e=this.selectionObjectName;e!==t&&(us(this),this.P.vr=t,this.Ug=null,this.g("selectionObjectName",e,t))}},selectionAdornmentTemplate:{get:function(){return this.P!==null?this.P.tr:null},set:function(t){var e=this.selectionAdornmentTemplate;e!==t&&(us(this),this.P.tr=t,this.g("selectionAdornmentTemplate",e,t))}},selectionObject:{get:function(){if(this.Ug===null){var t=this.selectionObjectName;t!==null&&t!==""?(t=this.fb(t),t!==null?this.Ug=t:this.Ug=this):this instanceof ue?(t=this.path,t!==null?this.Ug=t:this.Ug=this):this.Ug=this}return this.Ug}},selectionChanged:{get:function(){return this.P!==null?this.P.ur:null},set:function(t){var e=this.selectionChanged;e!==t&&(us(this),this.P.ur=t,this.g("selectionChanged",e,t))}},resizeAdornmentTemplate:{get:function(){return this.P!==null?this.P.fr:null},set:function(t){var e=this.resizeAdornmentTemplate;e!==t&&(us(this),this.P.fr=t,this.g("resizeAdornmentTemplate",e,t))}},resizeObjectName:{get:function(){return this.P!==null?this.P.hr:""},set:function(t){var e=this.resizeObjectName;e!==t&&(us(this),this.P.hr=t,this.g("resizeObjectName",e,t))}},resizeObject:{get:function(){var t=this.resizeObjectName;return t!==""&&(t=this.fb(t),t!==null)?t:this}},resizeCellSize:{get:function(){return this.P!==null?this.P.gr:Ps},set:function(t){var e=this.resizeCellSize;e.D(t)||(t=t.J(),us(this),this.P.gr=t,this.g("resizeCellSize",e,t))}},rotateAdornmentTemplate:{get:function(){return this.P!==null?this.P.ir:null},set:function(t){var e=this.rotateAdornmentTemplate;e!==t&&(us(this),this.P.ir=t,this.g("rotateAdornmentTemplate",e,t))}},rotateObjectName:{get:function(){return this.P!==null?this.P.jr:""},set:function(t){var e=this.rotateObjectName;e!==t&&(us(this),this.P.jr=t,this.g("rotateObjectName",e,t))}},rotateObject:{get:function(){var t=this.rotateObjectName;return t!==""&&(t=this.fb(t),t!==null)?t:this}},rotationSpot:{get:function(){return this.P!==null?this.P.lr:zn},set:function(t){var e=this.rotationSpot;e.D(t)||(t=t.J(),us(this),this.P.lr=t,this.g("rotationSpot",e,t))}},text:{get:function(){return this.ec},set:function(t){var e=this.ec;e!==t&&(this.ec=t,this.g("text",e,t))}},containingGroup:{get:function(){return this.Ah},set:function(t){if(this.Zc()){var e=this.Ah;if(e!==t){t===null||this!==t&&!t.Td(this)||(this===t&&lt("Cannot make a Group a member of itself: "+this.toString()),lt("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+t.toString())),this.C(2);var i=this.diagram;if(e!==null?cy(e,this):this instanceof ji&&i!==null&&i.ai.remove(this),this.Ah=t,t!==null?hy(t,this):this instanceof ji&&i!==null&&i.ai.add(this),this.C(1),i!==null&&i.aa){var n=this.data,s=i.model;if(n!==null&&s.Xj()){var a=s.wa(t!==null?t.data:null);s.mp(n,a)}}if(n=this.containingGroupChanged,n!==null&&(s=!0,i!==null&&(s=i.aa,i.aa=!0),n(this,e,t),i!==null&&(i.aa=s)),this instanceof ji){for(i=new At,Cc(i,this,!0,0,!0),i=i.iterator;i.next();)if(n=i.value,n instanceof Le)for(n=n.linksConnected;n.next();)hp(n.value)}if(this instanceof Le){for(i=this.linksConnected;i.next();)hp(i.value);i=this.labeledLink,i!==null&&hp(i)}this.g("containingGroup",e,t),t!==null&&(e=t.layer,e!==null&&jf(e,-1,t))}}else lt("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{get:function(){return this.P!==null?this.P.Kp:null},set:function(t){var e=this.containingGroupChanged;e!==t&&(us(this),this.P.Kp=t,this.g("containingGroupChanged",e,t))}},isTopLevel:{get:function(){return!(this.containingGroup!==null||this instanceof Le&&this.labeledLink!==null)}},layoutConditions:{get:function(){return this.P!==null?this.P.Cq:127},set:function(t){var e=this.layoutConditions;e!==t&&(us(this),this.P.Cq=t,this.g("layoutConditions",e,t))}},dragComputation:{get:function(){return this.P!==null?this.P.Up:null},set:function(t){var e=this.dragComputation;e!==t&&(us(this),this.P.Up=t,this.g("dragComputation",e,t))}},shadowOffset:{get:function(){return this.P!==null?this.P.zr:Kn},set:function(t){var e=this.shadowOffset;e.D(t)||(t=t.J(),us(this),this.P.zr=t,this.N(),this.g("shadowOffset",e,t))}},shadowColor:{get:function(){return this.P!==null?this.P.yr:"gray"},set:function(t){var e=this.shadowColor;e!==t&&(us(this),this.P.yr=t,this.N(),this.g("shadowColor",e,t))}},shadowBlur:{get:function(){return this.P!==null?this.P.Vg:4},set:function(t){var e=this.shadowBlur;e!==t&&(us(this),this.P.Vg=t,this.N(),this.g("shadowBlur",e,t))}}}),ui.prototype.invalidateLayout=ui.prototype.C,ui.prototype.findCommonContainingGroup=ui.prototype.px,ui.prototype.isMemberOf=ui.prototype.Td,ui.prototype.findTopLevelPart=ui.prototype.sz,ui.prototype.findSubGraphLevel=ui.prototype.oz,ui.prototype.ensureBounds=ui.prototype.Va,ui.prototype.getDocumentBounds=ui.prototype.mi,ui.prototype.findObject=ui.prototype.fb,ui.prototype.moveTo=ui.prototype.moveTo,ui.prototype.invalidateAdornments=ui.prototype.Wb,ui.prototype.clearAdornments=ui.prototype.Ej,ui.prototype.removeAdornment=ui.prototype.Jf,ui.prototype.addAdornment=ui.prototype.bh,ui.prototype.findAdornment=ui.prototype.Pj,ui.prototype.updateTargetBindings=ui.prototype.La;var f1=!1;ui.className="Part",ui.LayoutNone=0,ui.LayoutAdded=1,ui.LayoutRemoved=2,ui.LayoutShown=4,ui.LayoutHidden=8,ui.LayoutNodeSized=16,ui.LayoutGroupLayout=32,ui.LayoutNodeReplaced=64,ui.LayoutStandard=127,ui.LayoutAll=16777215;function Cn(t,e){t===void 0||t instanceof So||typeof t=="string"?ui.call(this,t):(ui.call(this),t&&(e=t)),this.G&=-257,this.Jg="Adornment",this.ue=null,this.Aw=0,this.Uw=!1,this.j=this.$a=null,e&&Object.assign(this,e)}gi(Cn,ui),Cn.prototype.toString=function(){var t=this.adornedPart;return"Adornment("+this.category+")"+(t!==null?t.toString():"")},Cn.prototype.updateRelationshipsFromData=function(){},Cn.prototype.Ul=function(t){var e=this.adornedObject,i=e==null?void 0:e.part;if(i instanceof ue&&e instanceof Xi){e=i.path,i.Ul(t),t=e.geometry,i=this.O.s,e=i.length;for(var n=0;n<e;n++){var s=i[n];s.isPanelMain&&s instanceof Xi&&(s.ua=t)}}},Cn.prototype.si=function(){var t=this.ue;return t===null?!0:(t=t.part,t===null||!Us(t))},Cn.prototype.Zc=function(){return!1},Cn.prototype.gk=function(t,e,i,n,s,a,l){if(t===Yr&&e==="elements"){if(s instanceof Zs)this.$a===null&&(this.$a=s);else if(s instanceof ne){var c=s.Nl(function(f){return f instanceof Zs});c instanceof Zs&&this.$a===null&&(this.$a=c)}}else t===Jr&&e==="elements"&&this.$a!==null&&(n===this.$a?this.$a=null:n instanceof ne&&this.$a.rg(n)&&(this.$a=null));ui.prototype.gk.call(this,t,e,i,n,s,a,l)},Cn.prototype.updateAdornments=function(){},Cn.prototype.Lj=function(){},ct.Object.defineProperties(Cn.prototype,{placeholder:{get:function(){return this.$a}},adornedObject:{get:function(){return this.ue},set:function(t){var e=this.adornedPart,i=null;t!==null&&(i=t.part),e===null||t!==null&&e===i||e.Jf(this.category),this.ue=t,i!==null&&i.bh(this.category,this)}},adornedPart:{get:function(){var t=this.ue;return t!==null?t.part:null}},containingGroup:{get:function(){return null}}}),Cn.className="Adornment";function rf(){this.nc=!1,this.Vr=this.gj=this.Eq=this.Dq=null,this.yp=Eo,this.er=up,this.Kr=this.ij=this.Nq=this.Mq=null}rf.prototype.copy=function(){var t=new rf;return t.Dq=this.Dq,t.Eq=this.Eq,t.gj=this.gj,t.Vr=this.Vr,t.yp=this.yp.J(),t.er=this.er,t.Mq=this.Mq,t.Nq=this.Nq,t.ij=this.ij,t.Kr=this.Kr,t};function Le(t,e){t===void 0||t instanceof So||typeof t=="string"?ui.call(this,t):(ui.call(this),t&&(e=t)),this.U=13,this.Ba=null,this.jb=new Kt,this.wc=this.af=this.Yk=null,this.ci=!1,e&&Object.assign(this,e)}gi(Le,ui),Le.prototype.cloneProtected=function(t){ui.prototype.cloneProtected.call(this,t),t.U=this.U,this.Ba!==null&&(t.Ba=this.Ba.nc?this.Ba:this.Ba.copy())},T=Le.prototype,T.Af=function(t){ui.prototype.Af.call(this,t),t.Bd(),t.af=this.af,t.wc=null};function Pu(t){t.Ba===null?t.Ba=new rf:t.Ba.nc&&(t.Ba=t.Ba.copy())}T.th=function(){ui.prototype.th.call(this),this.Ba!==null&&(this.Ba.nc=!0)};function sy(t,e){e!==null&&(t.af===null&&(t.af=new At),t.af.add(e))}function p1(t,e,i,n){if(e===null||t.af===null)return null;for(var s=t.af.iterator;s.next();){var a=s.value;if(a.Ds===t&&a.cv===e&&a.Ox===i&&a.Px===n||a.Ds===e&&a.cv===t&&a.Ox===n&&a.Px===i)return a}return null}T.Lz=function(t,e,i){e==null&&(e=""),i==null&&(i=""),t=p1(this,t,e,i),t!==null&&t.Sl()},T.gk=function(t,e,i,n,s,a,l){t===Yr&&e==="elements"?this.wc=null:t===Jr&&e==="elements"&&(this.wc=null),ui.prototype.gk.call(this,t,e,i,n,s,a,l)},T.Bd=function(t){for(var e=this.linksConnected;e.next();){var i=e.value;t!==void 0&&t.contains(i)||(ja(i.fromPort),ja(i.toPort),i.bb())}};function Am(t,e){for(t=t.linksConnected;t.next();){var i=t.value;(i.fromPort===e||i.toPort===e)&&(ja(i.fromPort),ja(i.toPort),i.bb())}}function ja(t){if(t!==null){var e=t.Zn;e!==null&&e.Sl(),t=t.part,e=t.containingGroup,e===null||t.isVisible()||ja(e.port)}}T.si=function(){return!0},Le.prototype.getAvoidableRect=function(t){return t.set(this.actualBounds),t.Co(this.avoidableMargin),t},Le.prototype.findVisibleNode=function(){for(var t=this;t!==null&&!t.isVisible();)t=t.containingGroup;return t},Le.prototype.isVisible=function(){if(!ui.prototype.isVisible.call(this))return!1;var t=!0,e=yc,i=this.diagram;if(i!==null&&(t=i.isTreePathToChildren,e=i.treeCollapsePolicy),e===yc){if(t=this.pg(),t!==null&&!t.isTreeExpanded)return!1}else if(e===go){if(t=t?this.Oo():this.Po(),0<t.count&&t.all(function(n){return!n.isTreeExpanded}))return!1}else if(e===Gp&&(t=t?this.Oo():this.Po(),0<t.count&&t.any(function(n){return!n.isTreeExpanded})))return!1;return t=this.labeledLink,t!==null?t.isVisible():!0},Le.prototype.Zb=function(t){ui.prototype.Zb.call(this,t);for(var e=this.linksConnected;e.next();){var i=e.value;if(t&&this.containingGroup!==null){var n=i.To(this);n===null||n.Td(this.containingGroup)||i.bb()}i.Zb(t)}},Le.prototype.qx=function(){var t=new At,e=new At;return m1(this,this,t,e),e.iterator};function m1(t,e,i,n){if(e!==null&&!i.has(e)){i.add(e);var s=!0,a=t.diagram;a!==null&&(s=a.isTreePathToChildren),e.linksConnected.each(function(l){l.isTreeLink?(s?l.fromNode===e:l.toNode===e)&&m1(t,s?l.toNode:l.fromNode,i,n):n.add(l)})}}Le.prototype.findLinksConnected=function(t){if(t===void 0&&(t=null),t===null)return this.jb.iterator;var e=new di(this.jb),i=this;return e.predicate=function(n){return n.fromNode===i&&n.fromPortId===t||n.toNode===i&&n.toPortId===t},e},T=Le.prototype,T.Mo=function(t){t===void 0&&(t=null);var e=new di(this.jb),i=this;return e.predicate=function(n){return n.fromNode!==i?!1:t===null?!0:n.fromPortId===t},e},T.Sd=function(t){t===void 0&&(t=null);var e=new di(this.jb),i=this;return e.predicate=function(n){return n.toNode!==i?!1:t===null?!0:n.toPortId===t},e},T.Mu=function(t){t===void 0&&(t=null);for(var e=null,i=null,n=this.jb.iterator;n.next();){var s=n.value;s.fromNode===this?(t===null||s.fromPortId===t)&&(s=s.toNode,e!==null?e.add(s):i!==null&&i!==s?(e=new At,e.add(i),e.add(s)):i=s):s.toNode!==this||t!==null&&s.toPortId!==t||(s=s.fromNode,e!==null?e.add(s):i!==null&&i!==s?(e=new At,e.add(i),e.add(s)):i=s)}return e!==null?e.iterator:i!==null?new ki(i):Gi},T.Po=function(t){t===void 0&&(t=null);for(var e=null,i=null,n=this.jb.iterator;n.next();){var s=n.value;s.fromNode!==this||t!==null&&s.fromPortId!==t||(s=s.toNode,e!==null?e.add(s):i!==null&&i!==s?(e=new At,e.add(i),e.add(s)):i=s)}return e!==null?e.iterator:i!==null?new ki(i):Gi},T.Oo=function(t){t===void 0&&(t=null);for(var e=null,i=null,n=this.jb.iterator;n.next();){var s=n.value;s.toNode!==this||t!==null&&s.toPortId!==t||(s=s.fromNode,e!==null?e.add(s):i!==null&&i!==s?(e=new At,e.add(i),e.add(s)):i=s)}return e!==null?e.iterator:i!==null?new ki(i):Gi},T.jz=function(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null);var n=new di(this.jb),s=this;return n.predicate=function(a){return!((a.fromNode!==s||a.toNode!==t||e!==null&&a.fromPortId!==e||i!==null&&a.toPortId!==i)&&(a.fromNode!==t||a.toNode!==s||i!==null&&a.fromPortId!==i||e!==null&&a.toPortId!==e))},n},T.kz=function(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null);var n=new di(this.jb),s=this;return n.predicate=function(a){return!(a.fromNode!==s||a.toNode!==t||e!==null&&a.fromPortId!==e||i!==null&&a.toPortId!==i)},n};function Dm(t,e,i){ja(i);var n=t.jb.contains(e);if(n||t.jb.add(e),!n||e.fromNode===e.toNode){var s=t.linkConnected;if(s!==null){var a=!0,l=t.diagram;l!==null&&(a=l.aa,l.aa=!0),s(t,e,i),l!==null&&(l.aa=a)}}!n&&e.isTreeLink&&(i=e.fromNode,e=e.toNode,i!==null&&e!==null&&i!==e&&(n=!0,t=t.diagram,t!==null&&(n=t.isTreePathToChildren),s=n?e:i,a=n?i:e,s.ci||(s.ci=a),!a.isTreeLeaf||t!==null&&t.undoManager.isUndoingRedoing||(n?i===a&&(a.isTreeLeaf=!1):e===a&&(a.isTreeLeaf=!1))))}function Yg(t,e,i){ja(i);var n=t.jb.remove(e),s=null;if(n||e.toNode===e.fromNode){var a=t.linkDisconnected;if(s=t.diagram,a!==null){var l=!0;s!==null&&(l=s.aa,s.aa=!0),a(t,e,i),s!==null&&(s.aa=l)}}n&&e.isTreeLink&&(i=!0,s!==null&&(i=s.isTreePathToChildren),t=i?e.toNode:e.fromNode,e=i?e.fromNode:e.toNode,t!==null&&(t.ci=!1),e===null||e.isTreeLeaf||(e.jb.count===0?(e.ci=null,s!==null&&s.undoManager.isUndoingRedoing||(e.isTreeLeaf=!0)):Im(e)))}function Im(t){if(t.ci=!1,t.jb.count!==0){var e=!0,i=t.diagram;if(i===null||!i.undoManager.isUndoingRedoing){for(i!==null&&(e=i.isTreePathToChildren),i=t.jb.iterator;i.next();){var n=i.value;if(n.isTreeLink){if(e){if(n.fromNode===t){t.isTreeLeaf=!1;return}}else if(n.toNode===t){t.isTreeLeaf=!1;return}}}t.isTreeLeaf=!0}}}Le.prototype.updateRelationshipsFromData=function(){var t=this.diagram;t!==null&&t.partManager.updateRelationshipsFromData(this)},T=Le.prototype,T.Vo=function(t){ui.prototype.Vo.call(this,t),t||(Im(this),t=this.Yk,t!==null&&qg(t,this))},T.Wo=function(t){ui.prototype.Wo.call(this,t),t||(t=this.Yk,t!==null&&t.wd!==null&&(t.wd.remove(this),t.v()))},T.Lj=function(){if(0<this.jb.count){var t=this.diagram;if(t!==null)for(var e=t.commandHandler!==null?t.commandHandler.deletesConnectedLinks:!0,i=this.jb.copy().iterator;i.next();){var n=i.value;e?t.remove(n):(n.fromNode===this&&(n.fromNode=null),n.toNode===this&&(n.toNode=null))}}this.labeledLink=null,ui.prototype.Lj.call(this)},T.ns=function(t){if(this.wc===null){if(t===""&&this.Te===!1)return this;ay(this)}var e=this.wc.I(t);return e!==null||t!==""&&(e=this.wc.I(""),e!==null)?e:this};function ay(t){t.wc===null?t.wc=new pe:t.wc.clear(),t.qm(t,function(e,i){ly(e,i)}),t.wc.count===0&&t.wc.add("",t)}function ly(t,e){var i=e.portId;i!==null&&t.wc!==null&&t.wc.add(i,e)}function uy(t,e,i){var n=e.portId;if(n!==null&&(t.wc!==null&&t.wc.remove(n),e=t.diagram,e!==null&&i)){for(i=null,t=t.findLinksConnected(n);t.next();)n=t.value,i===null&&(i=Pe()),i.push(n);if(i!==null){for(t=0;t<i.length;t++)e.remove(i[t]);qe(i)}}}T.Nz=function(t){if(t===null||t===this)return!1;var e=!0,i=this.diagram;if(i!==null&&(e=i.isTreePathToChildren),i=this,e)for(;i!==t;){e=null;for(var n=i.jb.iterator;n.next();){var s=n.value;if(s.isTreeLink&&(e=s.fromNode,e!==i&&e!==this))break}if(e===this||e===null||e===i)return!1;i=e}else for(;i!==t;){for(e=null,n=i.jb.iterator;n.next()&&(s=n.value,!s.isTreeLink||(e=s.toNode,e===i||e===this)););if(e===this||e===null||e===i)return!1;i=e}return!0},T.xz=function(){var t=!0,e=this.diagram;if(e!==null&&(t=e.isTreePathToChildren),e=this,t)for(;;){t=null;for(var i=e.jb.iterator;i.next();){var n=i.value;if(n.isTreeLink&&(t=n.fromNode,t!==e&&t!==this))break}if(t===this)return this;if(t===null||t===e)return e;e=t}else for(;;){for(t=null,i=e.jb.iterator;i.next()&&(n=i.value,!n.isTreeLink||(t=n.toNode,t===e||t===this)););if(t===this)return this;if(t===null||t===e)return e;e=t}},T.gz=function(t){if(t===null)return null;if(this===t)return this;for(var e=this;e!==null;)Pm(e,!0),e=e.pg();var i=null;for(e=t;e!==null;){if(e.G&1048576){i=e;break}e=e.pg()}for(e=this;e!==null;)Pm(e,!1),e=e.pg();return i},T.kh=function(){var t=!0,e=this.diagram;if(e!==null&&(t=e.isTreePathToChildren),e=this.jb.iterator,t){for(;e.next();)if(t=e.value,t.isTreeLink&&t.fromNode!==this)return t}else for(;e.next();)if(t=e.value,t.isTreeLink&&t.toNode!==this)return t;return null},T.pg=function(){var t=this.ci;if(t===null)return null;if(t instanceof Le)return t;t=this.diagram,t=t!==null?t.isTreePathToChildren:!0;for(var e=this.jb.iterator;e.next();){var i=e.value;if(i.isTreeLink&&(i=t?i.fromNode:i.toNode,i!==this))return this.ci=i}return this.ci=null},T.vz=function(){function t(i,n){n.add(i);var s=i.kh();s!==null&&(n.add(s),i=i.pg(),i!==null&&t(i,n))}var e=new At;return t(this,e),e},T.uz=function(){return ml(this,this)};function ml(t,e){return e=e.pg(),e===null?0:1+ml(t,e)}T.Qo=function(){var t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren),e=new di(this.jb);var i=this;return e.predicate=t?function(n){return!!(n.isTreeLink&&n.fromNode===i)}:function(n){return!!(n.isTreeLink&&n.toNode===i)},e},T.Ou=function(){var t=!0,e=this.diagram;e!==null&&(t=e.isTreePathToChildren);var i=e=null,n=this.jb.iterator;if(t)for(;n.next();)t=n.value,t.isTreeLink&&t.fromNode===this&&(t=t.toNode,e!==null?e.add(t):i!==null&&i!==t?(e=new Kt,e.add(i),e.add(t)):i=t);else for(;n.next();)t=n.value,t.isTreeLink&&t.toNode===this&&(t=t.fromNode,e!==null?e.add(t):i!==null&&i!==t?(e=new Kt,e.add(i),e.add(t)):i=t);return e!==null?e.iterator:i!==null?new ki(i):Gi},T.wz=function(t){t===void 0&&(t=1/0);var e=new At;return Cc(e,this,!1,t,!0),e},Le.prototype.collapseTree=function(t){t===void 0&&(t=1),1>t&&(t=1);var e=this.diagram;if(e!==null&&!e.Ue){e.Ue=!0;var i=new At;i.add(this),dh(this,i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===yc),e.Ue=!1}};function dh(t,e,i,n,s,a,l){if(1<n)for(var c=i?t.Mo():t.Sd();c.next();){var f=c.value;f.isTreeLink&&(f=f.To(t),f===null||f===t||e.contains(f)||(e.add(f),dh(f,e,i,n-1,s,a,l)))}else Om(t,e,i,s,a,l)}function Om(t,e,i,n,s,a){for(var l=s===t?!0:t.isTreeExpanded,c=i?t.Mo():t.Sd(),f={};c.next();){var m=c.value;if(m.isTreeLink&&(m=m.To(t),m!==null&&m!==t)){var v=e.contains(m);if(v||e.add(m),l){var w=i?m.Oo():m.Po();f.uv=t,w.all(function(C){return function(k){return k===C.uv||!k.isTreeExpanded}}(f))&&n.Aj(m,s),m.oh(),m.Zb(!1)}m.isTreeExpanded&&(m.wasTreeExpanded=m.isTreeExpanded,v||Om(m,e,i,n,s,a))}f={uv:f.uv}}t.isTreeExpanded=!1}Le.prototype.expandTree=function(t){t===void 0&&(t=2),2>t&&(t=2);var e=this.diagram;if(e!==null&&!e.Ue){e.Ue=!0;var i=new At;i.add(this),Jg(this,i,e.isTreePathToChildren,t,e,this,e.treeCollapsePolicy===yc),e.Ue=!1}};function Jg(t,e,i,n,s,a,l){for(var c=a===t?!1:t.isTreeExpanded,f=i?t.Mo():t.Sd(),m={};f.next();){var v=f.value;if(v.isTreeLink&&(c||v.fd||v.bb(),v=v.To(t),v!==null&&v!==t&&!e.contains(v))){if(e.add(v),!c){v.Zb(!0),v.oh();var w=i?v.Oo():v.Po();m.vv=t,w.all(function(C){return function(k){return k===C.vv||!k.isTreeExpanded}}(m))&&s.Cj(v,a)}(2<n||v.wasTreeExpanded)&&(v.wasTreeExpanded=!1,Jg(v,e,i,n-1,s,a,l))}m={vv:m.vv}}t.isTreeExpanded=!0}ct.Object.defineProperties(Le.prototype,{portSpreading:{get:function(){return this.Ba!==null?this.Ba.er:up},set:function(t){var e=this.portSpreading;e!==t&&(Pu(this),this.Ba.er=t,this.g("portSpreading",e,t),t=this.diagram,t!==null&&t.undoManager.isUndoingRedoing||this.Bd())}},avoidable:{get:function(){return(this.U&8)!==0},set:function(t){var e=(this.U&8)!==0;if(e!==t){this.U^=8;var i=this.diagram;i!==null&&sh(i,this),this.g("avoidable",e,t)}}},avoidableMargin:{get:function(){return this.Ba!==null?this.Ba.yp:Eo},set:function(t){typeof t=="number"&&(t=new ai(t));var e=this.avoidableMargin;if(!e.D(t)){t=t.J(),Pu(this),this.Ba.yp=t;var i=this.diagram;i!==null&&sh(i,this),this.g("avoidableMargin",e,t)}}},linksConnected:{get:function(){return this.jb.iterator}},linkConnected:{get:function(){return this.Ba!==null?this.Ba.Dq:null},set:function(t){var e=this.linkConnected;e!==t&&(Pu(this),this.Ba.Dq=t,this.g("linkConnected",e,t))}},linkDisconnected:{get:function(){return this.Ba!==null?this.Ba.Eq:null},set:function(t){var e=this.linkDisconnected;e!==t&&(Pu(this),this.Ba.Eq=t,this.g("linkDisconnected",e,t))}},linkValidation:{get:function(){return this.Ba!==null?this.Ba.gj:null},set:function(t){var e=this.linkValidation;e!==t&&(Pu(this),this.Ba.gj=t,this.g("linkValidation",e,t))}},isLinkLabel:{get:function(){return this.Yk!==null}},labeledLink:{get:function(){return this.Yk},set:function(t){var e=this.Yk;if(e!==t){var i=this.diagram,n=this.data;if(e!==null){if(e.wd!==null&&(e.wd.remove(this),e.v()),i!==null&&n!==null&&!i.undoManager.isUndoingRedoing){var s=e.data,a=i.model;if(s!==null&&a.ri()){var l=a.wa(n);l!==void 0&&a.Qx(s,l)}}this.containingGroup=null}this.Yk=t,t!==null&&(qg(t,this),i===null||n===null||i.undoManager.isUndoingRedoing||(s=t.data,i=i.model,s!==null&&i.ri()&&(n=i.wa(n),n!==void 0&&i.Bu(s,n))),this.containingGroup=t.containingGroup),Qo(this),this.g("labeledLink",e,t)}}},port:{get:function(){return this.ns("")}},ports:{get:function(){return this.wc===null&&ay(this),this.wc.iteratorValues}},isTreeExpanded:{get:function(){return(this.U&1)!==0},set:function(t){var e=(this.U&1)!==0;if(e!==t){this.U^=1;var i=this.diagram;if(this.g("isTreeExpanded",e,t),e=this.treeExpandedChanged,e!==null){var n=!0;i!==null&&(n=i.aa,i.aa=!0),e(this),i!==null&&(i.aa=n)}i!==null&&i.undoManager.isUndoingRedoing?this.Zb(t):t?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{get:function(){return(this.U&2)!==0},set:function(t){var e=(this.U&2)!==0;e!==t&&(this.U^=2,this.g("wasTreeExpanded",e,t))}},treeExpandedChanged:{get:function(){return this.Ba!==null?this.Ba.Vr:null},set:function(t){var e=this.treeExpandedChanged;e!==t&&(Pu(this),this.Ba.Vr=t,this.g("treeExpandedChanged",e,t))}},isTreeLeaf:{get:function(){return(this.U&4)!==0},set:function(t){var e=(this.U&4)!==0;e!==t&&(this.U^=4,this.g("isTreeLeaf",e,t))}}}),Le.prototype.expandTree=Le.prototype.expandTree,Le.prototype.collapseTree=Le.prototype.collapseTree,Le.prototype.findTreeParts=Le.prototype.wz,Le.prototype.findTreeChildrenNodes=Le.prototype.Ou,Le.prototype.findTreeChildrenLinks=Le.prototype.Qo,Le.prototype.findTreeLevel=Le.prototype.uz,Le.prototype.findTreeParentChain=Le.prototype.vz,Le.prototype.findTreeParentNode=Le.prototype.pg,Le.prototype.findTreeParentLink=Le.prototype.kh,Le.prototype.findCommonTreeParent=Le.prototype.gz,Le.prototype.findTreeRoot=Le.prototype.xz,Le.prototype.isInTreeOf=Le.prototype.Nz,Le.prototype.findPort=Le.prototype.ns,Le.prototype.findLinksTo=Le.prototype.kz,Le.prototype.findLinksBetween=Le.prototype.jz,Le.prototype.findNodesInto=Le.prototype.Oo,Le.prototype.findNodesOutOf=Le.prototype.Po,Le.prototype.findNodesConnected=Le.prototype.Mu,Le.prototype.findLinksInto=Le.prototype.Sd,Le.prototype.findLinksOutOf=Le.prototype.Mo,Le.prototype.findExternalTreeLinksConnected=Le.prototype.qx,Le.prototype.invalidateConnectedLinks=Le.prototype.Bd,Le.prototype.invalidateLinkBundle=Le.prototype.Lz;var g1=new mt(Le,"SpreadingNone",10),up=new mt(Le,"SpreadingEvenly",11),ld=new mt(Le,"SpreadingPacked",12);Le.className="Node",Le.SpreadingNone=g1,Le.SpreadingEvenly=up,Le.SpreadingPacked=ld;function ji(t,e){t===void 0||t instanceof So||typeof t=="string"?Le.call(this,t):(Le.call(this),t&&(e=t)),this.U|=4608,this.Gn=new At,this.$a=null,this.Sc=new pr,this.Sc.group=this,this.gl=new At,this.tb=this.$p=null,e&&Object.assign(this,e)}gi(ji,Le),ji.prototype.cloneProtected=function(t){Le.prototype.cloneProtected.call(this,t),this.U=this.U&-32769;var e=t.Nl(function(i){return i instanceof Zs});e instanceof Zs?t.$a=e:t.$a=null,this.Sc!==null?(t.Sc=this.Sc.copy(),t.Sc.group=t):(t.Sc!==null&&(t.Sc.group=null),t.Sc=null),this.tb!==null&&(t.tb=this.tb.copy())},T=ji.prototype,T.Af=function(t){Le.prototype.Af.call(this,t);var e=t.Rj();for(t=t.memberParts;t.next();){var i=t.value;if(i.v(),i.C(8),i.Ej(),i instanceof Le)i.Bd(e);else if(i instanceof ue)for(i=i.labelNodes;i.next();)i.value.Bd(e)}},T.gk=function(t,e,i,n,s,a,l){if(t===Yr&&e==="elements"){if(s instanceof Zs)this.$a===null?this.$a=s:this.$a!==s&&lt("Cannot insert a second Placeholder into the visual tree of a Group.");else if(s instanceof ne){var c=s.Nl(function(f){return f instanceof Zs});c instanceof Zs&&(this.$a===null?this.$a=c:this.$a!==c&&lt("Cannot insert a second Placeholder into the visual tree of a Group."))}}else t===Jr&&e==="elements"&&this.$a!==null&&(n===this.$a?this.$a=null:n instanceof ne&&this.$a.rg(n)&&(this.$a=null));Le.prototype.gk.call(this,t,e,i,n,s,a,l)},T.Xl=function(t,e){Le.prototype.Xl.call(this,t,e),this.isClipping&&this.type!==ne.Spot&&this.isSubGraphExpanded&&(t=this.resizeObject,t instanceof ne&&(t=t.Pb()),this.tb===null&&(this.tb=new It),t.mi(this.tb),t instanceof Xi&&this.tb.Bc(-t.strokeWidth,-t.strokeWidth))},T.eh=function(t,e,i,n){this.nf=this.$a,Le.prototype.eh.call(this,t,e,i,n)},T.Va=function(){var t=this;t.isSubGraphExpanded&&this.memberParts.each(function(e){!t.computesBoundsIncludingLinks&&e instanceof ue||e.Va()}),Le.prototype.Va.call(this)},T.si=function(){if(!Le.prototype.si.call(this))return!1;for(var t=this.memberParts;t.next();){var e=t.value;if(e instanceof Le){if(e.isVisible()&&Us(e))return!1}else if(e instanceof ue&&e.isVisible()&&Us(e)&&e.fromNode!==this&&e.toNode!==this)return!1}return!0};function hy(t,e){if(t.Gn.add(e)){e instanceof ji&&t.gl.add(e);var i=t.memberAdded;if(i!==null){var n=!0,s=t.diagram;s!==null&&(n=s.aa,s.aa=!0),i(t,e),s!==null&&(s.aa=n)}t.isVisible()&&t.isSubGraphExpanded||e.Zb(!1)}e instanceof ue&&!t.computesBoundsIncludingLinks||(e=t.$a,e===null&&(e=t),e.v())}function cy(t,e){if(t.Gn.remove(e)){e instanceof ji&&t.gl.remove(e);var i=t.memberRemoved;if(i!==null){var n=!0,s=t.diagram;s!==null&&(n=s.aa,s.aa=!0),i(t,e),s!==null&&(s.aa=n)}t.isVisible()&&t.isSubGraphExpanded||e.Zb(!0)}e instanceof ue&&!t.computesBoundsIncludingLinks||(e=t.$a,e===null&&(e=t),e.v())}T.Lj=function(){if(0<this.Gn.count){var t=this.diagram;if(t!==null)for(var e=this.Gn.copy().iterator;e.next();)t.remove(e.value)}Le.prototype.Lj.call(this)},ji.prototype.canAddMembers=function(t){var e=this.diagram;if(e===null)return!1;for(e=e.commandHandler,t=Lt(t).iterator;t.next();)if(!e.isValidMember(this,t.value))return!1;return!0},ji.prototype.addMembers=function(t,e){var i=this.diagram;if(i===null)return!1;i=i.commandHandler;var n=!0;for(t=Lt(t).iterator;t.next();){var s=t.value;!e||i.isValidMember(this,s)?s.containingGroup=this:n=!1}return n},ji.prototype.canUngroup=function(){if(!this.ungroupable)return!1;var t=this.layer;return t===null||!t.allowUngroup?!1:(t=t.diagram,!!(t===null||t.allowUngroup))},T=ji.prototype,T.Bd=function(t){var e=(this.U&65536)!==0;if(Le.prototype.Bd.call(this,t),!e)for(!(this.U&65536)&&(this.U=this.U^65536),e=this.Lu();e.next();){var i=e.value;if(t===void 0||!t.contains(i)){var n=i.fromNode;n!==null&&n!==this&&n.Td(this)&&!n.isVisible()?(ja(i.fromPort),ja(i.toPort),i.bb()):(n=i.toNode,n!==null&&n!==this&&n.Td(this)&&!n.isVisible()&&(ja(i.fromPort),ja(i.toPort),i.bb()))}}},T.Lu=function(){var t=this.diagram!==null&&this.diagram.Pw;if(t&&this.$p!==null)return this.$p.iterator;var e=this.Rj();e.add(this);for(var i=new At,n=e.iterator;n.next();){var s=n.value;if(s instanceof Le)for(s=s.linksConnected;s.next();){var a=s.value;e.contains(a)||i.add(a)}}return t&&(this.$p=i),i.iterator},T.iz=function(){var t=this.Rj();t.add(this);for(var e=new At,i=t.iterator;i.next();){var n=i.value;if(n instanceof Le)for(n=n.linksConnected;n.next();){var s=n.value,a=s.fromNode;a===null||t.contains(a)&&a!==this||e.add(a),s=s.toNode,s===null||t.contains(s)&&s!==this||e.add(s)}}return e.iterator},T.hz=function(){function t(i,n){i!==null&&(n.add(i),t(i.containingGroup,n))}var e=new At;return t(this,e),e},T.Rj=function(){var t=new At;return Cc(t,this,!0,0,!0),t.remove(this),t},T.Zb=function(t){Le.prototype.Zb.call(this,t);for(var e=this.memberParts;e.next();)e.value.Zb(t)},ji.prototype.collapseSubGraph=function(){var t=this.diagram;if(t!==null&&!t.Ue){t.Ue=!0;var e=this.Rj();v1(this,e,t,this),t.Ue=!1}};function v1(t,e,i,n){for(var s=t.memberParts;s.next();){var a=s.value;if(a.Zb(!1),a instanceof ji&&a.isSubGraphExpanded&&(a.wasSubGraphExpanded=a.isSubGraphExpanded,v1(a,e,i,n)),a instanceof Le)a.Bd(e),i.Aj(a,n);else if(a instanceof ue)for(a=a.labelNodes;a.next();)a.value.Bd(e)}t.isSubGraphExpanded=!1}ji.prototype.expandSubGraph=function(){var t=this.diagram;if(t!==null&&!t.Ue){t.Ue=!0;var e=this.Rj();y1(this,e,t,this),t.Ue=!1}};function y1(t,e,i,n){for(var s=t.memberParts;s.next();){var a=s.value;if(a.Zb(!0),a instanceof ji&&a.wasSubGraphExpanded&&(a.wasSubGraphExpanded=!1,y1(a,e,i,n)),a instanceof Le)a.Bd(e),i.Cj(a,n);else if(a instanceof ue)for(a=a.labelNodes;a.next();)a.value.Bd(e)}t.isSubGraphExpanded=!0}ji.prototype.move=function(t,e){e===void 0&&(e=!1);var i=e?this.location:this.position,n=i.x;i=i.y;var s=t.x,a=t.y;if(!(n===s||isNaN(n)&&isNaN(s))||!(i===a||isNaN(i)&&isNaN(a))){for(n=s-(isNaN(n)?0:n),i=a-(isNaN(i)?0:i),a=z.alloc(),Le.prototype.move.call(this,t,e),t=new At,e=this.Rj().iterator;e.next();)s=e.value,s instanceof ue&&(s.suspendsRouting&&t.add(s),s.fd||s.fromNode!==this&&s.toNode!==this)&&(s.suspendsRouting=!0);for(e.reset();e.next();)if(s=e.value,!(s.ph()||s instanceof Le&&s.isLinkLabel)){var l=s.position,c=s.location;l.w()?(a.x=l.x+n,a.y=l.y+i,s.position=a):c.w()&&(a.x=c.x+n,a.y=c.y+i,s.location=a)}for(e.reset();e.next();)s=e.value,s instanceof ue&&(s.suspendsRouting=t.contains(s),s.fd||s.fromNode!==this&&s.toNode!==this)&&(l=s.position,a.x=l.x+n,a.y=l.y+i,a.w()?s.move(a):s.bb(),fy(s)&&s.bb());z.free(a)}},ct.Object.defineProperties(ji.prototype,{placeholder:{get:function(){return this.$a}},computesBoundsAfterDrag:{get:function(){return(this.U&2048)!==0},set:function(t){var e=(this.U&2048)!==0;e!==t&&(this.U^=2048,this.g("computesBoundsAfterDrag",e,t))}},computesBoundsIncludingLinks:{get:function(){return(this.U&4096)!==0},set:function(t){var e=(this.U&4096)!==0;e!==t&&(this.U^=4096,this.g("computesBoundsIncludingLinks",e,t))}},computesBoundsIncludingLocation:{get:function(){return(this.U&8192)!==0},set:function(t){var e=(this.U&8192)!==0;e!==t&&(this.U^=8192,this.g("computesBoundsIncludingLocation",e,t))}},handlesDragDropForMembers:{get:function(){return(this.U&16384)!==0},set:function(t){var e=(this.U&16384)!==0;e!==t&&(this.U^=16384,this.g("handlesDragDropForMembers",e,t))}},memberParts:{get:function(){return this.Gn.iterator}},layout:{get:function(){return this.Sc},set:function(t){var e=this.Sc;if(e!==t){t!==null&&t.diagram!==null&&t.diagram.layout===t&&lt("A layout cannot be both the Diagram.layout and a Group.layout: "+t),e!==null&&(e.diagram=null,e.group=null),this.Sc=t;var i=this.diagram;t!==null&&(t.diagram=i,t.group=this),i!==null&&(i.xh=!0),this.g("layout",e,t),i!==null&&i.$b()}}},memberAdded:{get:function(){return this.Ba!==null?this.Ba.Mq:null},set:function(t){var e=this.memberAdded;e!==t&&(Pu(this),this.Ba.Mq=t,this.g("memberAdded",e,t))}},memberRemoved:{get:function(){return this.Ba!==null?this.Ba.Nq:null},set:function(t){var e=this.memberRemoved;e!==t&&(Pu(this),this.Ba.Nq=t,this.g("memberRemoved",e,t))}},memberValidation:{get:function(){return this.Ba!==null?this.Ba.ij:null},set:function(t){var e=this.memberValidation;e!==t&&(Pu(this),this.Ba.ij=t,this.g("memberValidation",e,t))}},ungroupable:{get:function(){return(this.U&256)!==0},set:function(t){var e=(this.U&256)!==0;e!==t&&(this.U^=256,this.g("ungroupable",e,t))}},isSubGraphExpanded:{get:function(){return(this.U&512)!==0},set:function(t){var e=(this.U&512)!==0;if(e!==t){this.U^=512;var i=this.diagram;if(this.g("isSubGraphExpanded",e,t),e=this.subGraphExpandedChanged,e!==null){var n=!0;i!==null&&(n=i.aa,i.aa=!0),e(this),i!==null&&(i.aa=n)}i!==null&&i.undoManager.isUndoingRedoing?(this.$a!==null&&this.$a.v(),this.memberParts.each(function(s){s.updateAdornments()})):t?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{get:function(){return(this.U&1024)!==0},set:function(t){var e=(this.U&1024)!==0;e!==t&&(this.U^=1024,this.g("wasSubGraphExpanded",e,t))}},subGraphExpandedChanged:{get:function(){return this.Ba!==null?this.Ba.Kr:null},set:function(t){var e=this.subGraphExpandedChanged;e!==t&&(Pu(this),this.Ba.Kr=t,this.g("subGraphExpandedChanged",e,t))}},rh:{get:function(){return(this.U&32768)!==0},set:function(t){(this.U&32768)!==0!==t&&(this.U^=32768)}}}),ji.prototype.expandSubGraph=ji.prototype.expandSubGraph,ji.prototype.collapseSubGraph=ji.prototype.collapseSubGraph,ji.prototype.findSubGraphParts=ji.prototype.Rj,ji.prototype.findContainingGroupChain=ji.prototype.hz,ji.prototype.findExternalNodesConnected=ji.prototype.iz,ji.prototype.findExternalLinksConnected=ji.prototype.Lu,ji.prototype.ensureBounds=ji.prototype.Va,ji.className="Group";function Zs(t){at.call(this),this.yb=ro,this.ko=new It(NaN,NaN,NaN,NaN),t&&Object.assign(this,t)}gi(Zs,at),Zs.prototype.cloneProtected=function(t){at.prototype.cloneProtected.call(this,t),t.yb=this.yb.J(),t.ko=this.ko.copy()},Zs.prototype.gh=function(t){if(this.background===null&&this.areaBackground===null)return!1;var e=this.naturalBounds;return jr(0,0,e.width,e.height,t.x,t.y)},Zs.prototype.Wl=function(){var t=this.part;if(t!==null&&(t instanceof ji||t instanceof Cn)||lt("Placeholder is not inside a Group or Adornment."),t instanceof ji){var e=this.computeBorder(this.ko),i=this.minSize,n=this.dc;for(Lo(n,(isFinite(i.width)?Math.max(i.width,e.width):e.width)||0,(isFinite(i.height)?Math.max(i.height,e.height):e.height)||0),this.Ge(0,0,n.width,n.height),n=t.memberParts,i=!1;n.next();)if(n.value.isVisible()){i=!0;break}n=t.diagram,!i||n===null||n.animationManager.Xu(t)||isNaN(e.x)||isNaN(e.y)||(i=z.alloc(),i.xi(e,t.locationSpot),i.D(t.location)||(t.location=i),z.free(i))}else{e=this.dc,i=this.yb,n=i.left+i.right;var s=i.top+i.bottom,a=t.adornedObject;t.angle=a.li();var l=0;a instanceof Xi&&(l=a.strokeWidth);var c=a.Df(),f=a.naturalBounds,m=(f.width+l)*c;l=(f.height+l)*c,t.type!==ne.Link&&(c=a.ga(t.category==="Selection"?An:t.locationSpot,z.alloc()),t.location=c,z.free(c)),isNaN(m)||isNaN(l)?(t=a.ga(An,z.alloc()),m=It.allocAt(t.x,t.y,0,0),m.Ye(a.ga(Go,t)),m.Ye(a.ga(Io,t)),m.Ye(a.ga(Ys,t)),Lo(e,m.width+n||0,m.height+s||0),this.Ge(-i.left,-i.top,e.width,e.height),z.free(t),It.free(m)):(Lo(e,m+n||0,l+s||0),this.Ge(-i.left,-i.top,e.width,e.height))}},Zs.prototype.eh=function(t,e,i,n){this.actualBounds.h(t,e,i,n)},Zs.prototype.computeBorder=function(t){var e=this.part,i=e.diagram,n=i===null||!i.animationManager.isAnimating;if(i!==null&&e instanceof ji&&!e.layer.isTemporary&&e.computesBoundsAfterDrag&&this.ko.w()){var s=i.toolManager.findTool("Dragging");if(s===i.currentTool&&(i=s.computeBorder(e,this.ko,t),i!==null))return i}i=It.alloc(),s=this.computeMemberBounds(i);var a=this.yb;return e instanceof ji&&!e.isSubGraphExpanded?t.h(s.x-a.left,s.y-a.top,0,0):t.h(s.x-a.left,s.y-a.top,Math.max(s.width+a.left+a.right,0),Math.max(s.height+a.top+a.bottom,0)),It.free(i),n&&e instanceof ji&&e.computesBoundsIncludingLocation&&e.location.w()&&t.Ye(e.location),t},Zs.prototype.computeMemberBounds=function(t){if(!(this.part instanceof ji))return t.h(0,0,0,0),t;for(var e=this.part,i=1/0,n=1/0,s=-1/0,a=-1/0,l=e.memberParts;l.next();){var c=l.value;if(c.isVisible()){if(c instanceof ue&&(!e.computesBoundsIncludingLinks||ha(c)||c.fromNode===e||c.toNode===e))continue;c=c.actualBounds,c.left<i&&(i=c.left),c.top<n&&(n=c.top),c.right>s&&(s=c.right),c.bottom>a&&(a=c.bottom)}}return isFinite(i)&&isFinite(n)?t.h(i,n,s-i,a-n):(e=e.location,t.h(e.x,e.y,0,0)),t},ct.Object.defineProperties(Zs.prototype,{padding:{get:function(){return this.yb},set:function(t){typeof t=="number"&&(t=new ai(t));var e=this.yb;e.D(t)||(this.yb=t=t.J(),this.g("padding",e,t),this.v())}}}),Zs.className="Placeholder";function ue(t){ui.call(this,ne.Link),this.Qa=8,this.ef=null,this.ff="",this.uf=this.gn=null,this.vf="",this.uo=null,this.qk=ea,this.Om=0,this.Qm=ea,this.Rm=NaN,this.qj=gy,this.po=.5,this.wd=null,this.Nb=new Kt().freeze(),this.Tg=this.Mg=null,this.ml=new It,this.ua=new fe,this.u=this.o=this.Sf=this.Wf=null,this.su=new z,this.cq=this.Mw=this.Lw=null,this.vt=NaN,this.ba=null,this.j=[],t&&Object.assign(this,t)}gi(ue,ui),ue.prototype.cloneProtected=function(t){ui.prototype.cloneProtected.call(this,t),t.Qa=this.Qa&-113,t.ff=this.ff,t.gn=this.gn,t.vf=this.vf,t.uo=this.uo,t.qk=this.qk,t.Om=this.Om,t.Qm=this.Qm,t.Rm=this.Rm,t.qj=this.qj,t.po=this.po,this.ba!==null&&(t.ba=this.ba.copy())},T=ue.prototype,T.Af=function(t){ui.prototype.Af.call(this,t),this.ff=t.ff,this.vf=t.vf,t.Mg=null,t.bb(),t.Sf=this.Sf;var e=t.fromPort;e!==null&&ja(e),t=t.toPort,t!==null&&ja(t)},T.qb=function(t){t.classType===ue?(t.value&2)===2?this.routing=t:t===Qa||t===$a||t===yo?this.curve=t:t===Ka||t===Es||t===dp?this.adjusting=t:t!==gy&&t!==ea&&lt("Unknown Link enum value for a Link property: "+t):ui.prototype.qb.call(this,t)},T.Xc=function(){this.ba===null&&(this.ba=new Hd)},T.si=function(){var t=this.fromNode;if(t!==null){var e=t.findVisibleNode();if(e!==null&&(t=e),Us(t)||Mc(t))return!1}return t=this.toNode,!(t!==null&&(e=t.findVisibleNode(),e!==null&&(t=e),Us(t)||Mc(t)))},T.zv=function(){return!1},T.Av=function(){},T.Zc=function(){return!1},ue.prototype.computeAngle=function(t,e,i){return ue.computeAngle(e,i)},ue.computeAngle=function(t,e){switch(t){default:case ea:t=0;break;case y0:t=e;break;case lf:t=e+90;break;case zm:t=e-90;break;case yy:t=e+180;break;case nv:t=ht.bp(e),90<t&&270>t&&(t-=180);break;case x0:t=ht.bp(e+90),90<t&&270>t&&(t-=180);break;case jm:t=ht.bp(e-90),90<t&&270>t&&(t-=180);break;case rv:if(t=ht.bp(e),45<t&&135>t||225<t&&315>t)return 0;90<t&&270>t&&(t-=180)}return ht.bp(t)};function hp(t){var e=t.fromNode,i=t.toNode,n=null;if(e!==null?n=i!==null?e.px(i):e.containingGroup:i!==null?n=i.containingGroup:n=null,e=n,i=t.Ah,i!==e){i!==null&&cy(i,t),t.Ah=e,e!==null&&hy(e,t);var s=t.containingGroupChanged;if(s!==null){var a=!0,l=t.diagram;l!==null&&(a=l.aa,l.aa=!0),s(t,i,e),l!==null&&(l.aa=a)}!t.fd||t.Lw!==i&&t.Mw!==i||t.bb()}if(t.isLabeledLink)for(t=t.labelNodes;t.next();)t.value.containingGroup=n}T=ue.prototype,T.oh=function(){var t=this.containingGroup;t!==null&&this.fromNode!==t&&this.toNode!==t&&t.computesBoundsIncludingLinks&&ui.prototype.oh.call(this)},T.To=function(t){var e=this.fromNode;return t===e?this.toNode:e},T.Cz=function(t){var e=this.fromPort;return t===e?this.toPort:e};function qg(t,e){t.wd===null&&(t.wd=new At),t.wd.add(e),t.v()}T.Vo=function(t){if(ui.prototype.Vo.call(this,t),hd(this)&&this.Xo(this.actualBounds),!t){t=this.ef;var e=null;t!==null&&(e=this.fromPort,Dm(t,this,e));var i=this.uf;if(i!==null){var n=this.toPort;i===t&&n===e||Dm(i,this,n)}Rm(this)}},T.Wo=function(t){if(ui.prototype.Wo.call(this,t),hd(this)&&this.Xo(this.actualBounds),!t){t=this.ef;var e=null;t!==null&&(e=this.fromPort,Yg(t,this,e));var i=this.uf;if(i!==null){var n=this.toPort;i===t&&n===e||Yg(i,this,n)}cd(this)}},T.Lj=function(){if(this.fd=!0,this.wd!==null){var t=this.diagram;if(t!==null)for(var e=this.wd.copy().iterator;e.next();)t.remove(e.value)}this.data!==null&&(t=this.diagram,t!==null&&t.partManager.removeDataForLink(this))},ue.prototype.updateRelationshipsFromData=function(){if(this.data!==null){var t=this.diagram;t!==null&&t.partManager.updateRelationshipsFromData(this)}},ue.prototype.move=function(t,e){var i=e?this.location:this.position,n=i.x;isNaN(n)&&(n=0);var s=i.y;for(isNaN(s)&&(s=0),n=t.x-n,s=t.y-s,e===!0?ui.prototype.move.call(this,t,!1):(t=z.allocAt(i.x+n,i.y+s),ui.prototype.move.call(this,t,!1),z.free(t)),kc(this,n,s),t=this.labelNodes;t.next();)e=t.value,i=e.position,e.moveTo(i.x+n,i.y+s)},ue.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var t=this.layer;return t===null?!0:t.allowRelink?(t=t.diagram,!!(t===null||t.allowRelink)):!1},ue.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var t=this.layer;return t===null?!0:t.allowRelink?(t=t.diagram,!!(t===null||t.allowRelink)):!1},ue.prototype.computeMidPoint=function(t){var e=this.pointsCount;if(e===0)return t.assign(Ar),t;if(e===1)return t.assign(this.i(0)),t;if(e===2){var i=this.i(0),n=this.i(1);return t.h((i.x+n.x)/2,(i.y+n.y)/2),t}if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===Qa))return this.ua.Pu(.5,t),t.add(this.i(0)),i=this.ua.figures.first(),t.offset(-i.startX,-i.startY),t;if(this.computeCurve()===Qa){if(e===3){i=this.i(0),n=this.i(1);var s=this.i(2);return ht.ax(i.x,i.y,n.x,n.y,n.x,n.y,s.x,s.y,t),t}if(n=(e-1)/3|0,i=3*(n/2|0),n%2===1){n=this.i(i),s=this.i(i+1);var a=this.i(i+2);i=this.i(i+3),ht.ax(n.x,n.y,s.x,s.y,a.x,a.y,i.x,i.y,t)}else t.assign(this.i(i));return t}var l=this.flattenedLengths;for(i=this.flattenedTotalLength,s=a=n=0;n<i/2&&a<e&&(s=l[a],!(n+s>i/2));)n+=s,a++;return e=this.i(a),a=this.i(a+1),1>Math.abs(e.x-a.x)?e.y>a.y?t.h(e.x,e.y-(i/2-n)):t.h(e.x,e.y+(i/2-n)):1>Math.abs(e.y-a.y)?e.x>a.x?t.h(e.x-(i/2-n),e.y):t.h(e.x+(i/2-n),e.y):(i=(i/2-n)/s,t.h(e.x+i*(a.x-e.x),e.y+i*(a.y-e.y))),t},ue.prototype.computeMidAngle=function(){var t=this.pointsCount;if(2>t)return NaN;if(t===2)return this.i(0).ab(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===Qa))return this.ua.wx(.5);if(this.computeCurve()===Qa&&4<=t){var e=(t-1)/3|0,i=3*(e/2|0);if(e%2===1){i=Math.floor(i),t=this.i(i),e=this.i(i+1);var n=this.i(i+2);return i=this.i(i+3),ht.My(t.x,t.y,e.x,e.y,n.x,n.y,i.x,i.y)}if(0<i&&i+1<t)return this.i(i-1).ab(this.i(i+1))}e=this.flattenedLengths,n=this.flattenedTotalLength;var s=0;i=0;for(var a;s<n/2&&i<t&&(a=e[i],!(s+a>n/2));)s+=a,i++;if(e=this.i(i),n=this.i(i+1),1>Math.abs(e.x-n.x)&&1>Math.abs(e.y-n.y)){if(0<i&&i+2<t)return this.i(i-1).ab(this.i(i+2))}else{if(1>Math.abs(e.x-n.x))return e.y>n.y?270:90;if(1>Math.abs(e.y-n.y))return e.x>n.x?180:0}return e.ab(n)},T=ue.prototype,T.i=function(t){return this.Nb.s[t]},T.dd=function(t,e){this.Nb.cd(t,e)},T.L=function(t,e,i){this.Nb.cd(t,new z(e,i))},T.Kz=function(t,e){this.Nb.Gb(t,e)},T.m=function(t,e,i){this.Nb.Gb(t,new z(e,i))},T.ne=function(t){this.Nb.add(t)},T.yf=function(t,e){this.Nb.add(new z(t,e))},T.pv=function(t){this.Nb.mb(t)},T.Fj=function(){this.Nb.clear()};function kc(t,e,i){if(e!==0||i!==0)if(t.pointsCount===0)t.defaultFromPoint&&t.defaultFromPoint.offset(e,i),t.defaultToPoint&&t.defaultToPoint.offset(e,i);else{for(var n=t.fd,s=new Kt,a=t.Nb.iterator;a.next();){var l=a.value;s.add(new z(l.x+e,l.y+i).freeze())}s.freeze(),a=t.Nb,t.Nb=s,l=t.diagram,isNaN(e)||isNaN(i)||l!==null&&l.animationManager.zb?t.v():(t.ke.h(t.ke.x+e,t.ke.y+i),t.pa.h(t.pa.x+e,t.pa.y+i),Qo(t)),n?Qg(t):(t.defaultFromPoint&&(t.defaultFromPoint=t.i(0)),t.defaultToPoint&&(t.defaultToPoint=t.i(t.pointsCount-1))),l!==null&&l.animationManager.zb&&Sa(l.animationManager,t,s),t.g("points",a,s)}}T.uh=function(){this.Mg===null&&(this.Mg=this.Nb,this.Nb=this.Nb.copy())},T.zf=function(){if(this.Mg!==null){for(var t=this.Mg,e=this.Nb,i=1/0,n=1/0,s=t.s,a=s.length,l=0;l<a;l++){var c=s[l];i=Math.min(c.x,i),n=Math.min(c.y,n)}c=l=1/0;for(var f=e.s,m=f.length,v=0;v<m;v++){var w=f[v];l=Math.min(w.x,l),c=Math.min(w.y,c),w.freeze()}if(e.freeze(),m===a){for(a=0;a<m;a++)if(v=s[a],w=f[a],v.x-i!==w.x-l||v.y-n!==w.y-c){this.qc();break}}else this.qc();this.Mg=null,i=this.diagram,i!==null&&i.animationManager.zb&&Sa(i.animationManager,this,e),Qg(this),this.g("points",t,e)}},T.rv=function(){this.Mg!==null&&(this.Nb=this.Mg,this.Mg=null)};function Qg(t){t.Nb.count===0?t.fd=!1:(t.fd=!0,t.cq=null,t.vt=NaN,t.defaultFromPoint=t.i(0),t.defaultToPoint=t.i(t.pointsCount-1),ev(t,!1))}T.bb=function(){if(!this.suspendsRouting){var t=this.diagram;if(t){if(t.As.contains(this)||t.undoManager.isUndoingRedoing||(t=t.animationManager,t.isTicking&&!t.isAnimating))return;this.Tg===null||t.isTicking||(this.Tg=null)}t=this.path,t!==null&&(this.fd=!1,this.v(),t.v())}},T.vg=function(){if(!this.fd&&!this.computingPoints){var t=!0;try{this.computingPoints=!0,this.uh(),t=this.computePoints()}catch(e){this.computingPoints=!1,this.rv()}finally{this.computingPoints=!1,t?this.zf():this.rv()}}},ue.prototype.computePoints=function(){if(this.diagram===null)return!1;var t=this.fromNode,e=null;if(t===null?(cp||(cp=new Le,cp.desiredSize=xr,cp.Va()),this.defaultFromPoint&&(cp.location=this.defaultFromPoint,cp.Va(),e=t=cp)):e=this.fromPort,e!==null&&!t.isVisible()){var i=t.findVisibleNode();i!==null&&i!==t?(t=i,e=i.port):t=i}if(this.Lw=t,t===null||!t.location.w())return!1;for(;!(e===null||e.actualBounds.w()&&e.Ed());)e=e.panel;if(e===null)return!1;var n=this.toNode,s=null;if(n===null?(af||(af=new Le,af.desiredSize=xr,af.Va()),this.defaultToPoint&&(af.location=this.defaultToPoint,af.Va(),s=n=af)):s=this.toPort,s===null||n.isVisible()||(i=n.findVisibleNode(),i!==null&&i!==n?(n=i,s=i.port):n=i),this.Mw=n,n===null||!n.location.w())return!1;for(;!(s===null||s.actualBounds.w()&&s.Ed());)s=s.panel;if(s===null)return!1;var a=this.pointsCount,l=this.computeSpot(!0,e);i=this.computeSpot(!1,s);var c=of(l),f=of(i),m=e===s&&e!==null,v=this.isOrthogonal,w=this.curve===Qa;this.Wf=m&&!v?w=!0:!1;var C=this.computeAdjusting()===ea||m;if(!v&&!m&&c&&f){if(c=!1,!C&&3<=a&&(C=this.getLinkPoint(t,e,l,!0,!1,n,s),f=this.getLinkPoint(n,s,i,!1,!1,t,e),c=this.adjustPoints(0,C,a-1,f))&&(C=this.getLinkPoint(t,e,l,!0,!1,n,s),f=this.getLinkPoint(n,s,i,!1,!1,t,e),this.adjustPoints(0,C,a-1,f)),!c)if(this.Fj(),w){a=this.getLinkPoint(t,e,l,!0,!1,n,s),C=this.getLinkPoint(n,s,i,!1,!1,t,e),c=C.x-a.x,f=C.y-a.y,m=this.computeCurviness(),w=v=0;var k=a.x+c/3,L=a.y+f/3,A=k,H=L;ht.B(f,0)?H=0<c?H-m:H+m:(v=-c/f,w=Math.sqrt(m*m/(v*v+1)),0>m&&(w=-w),A=(0>f?-1:1)*w+k,H=v*(A-k)+L),k=a.x+2*c/3,L=a.y+2*f/3;var R=k,X=L;ht.B(f,0)?X=0<c?X-m:X+m:(R=(0>f?-1:1)*w+k,X=v*(R-k)+L),this.Fj(),this.ne(a),this.yf(A,H),this.yf(R,X),this.ne(C),this.dd(0,this.getLinkPoint(t,e,l,!0,!1,n,s)),this.dd(3,this.getLinkPoint(n,s,i,!1,!1,t,e))}else a=n,C=s,n=this.getLinkPoint(t,e,l,!0,!1,a,C),s=this.getLinkPoint(a,C,i,!1,!1,t,e),this.hasCurviness()?(C=s.x-n.x,i=s.y-n.y,l=this.computeCurviness(),t=n.x+C/2,e=n.y+i/2,a=t,c=e,ht.B(i,0)?c=0<C?c-l:c+l:(C=-C/i,a=Math.sqrt(l*l/(C*C+1)),0>l&&(a=-a),a=(0>i?-1:1)*a+t,c=C*(a-t)+e),this.ne(n),this.yf(a,c),this.ne(s)):(this.ne(n),this.ne(s),c=It.alloc(),e.mi(c),f=c.ca(s),C.mi(c),m=c.ca(n),(f||m)&&(l=e.ga(Bm(l),new z),this.dd(0,this.getLinkPointFromPoint(t,e,l,s,!0,l)),i=C.ga(Bm(i),new z),this.dd(1,this.getLinkPointFromPoint(a,C,i,n,!1,i))),It.free(c))}else{w=this.isAvoiding,C&&(v&&w||m)&&this.Fj();var Y=m?this.computeCurviness():0;w=this.getLinkPoint(t,e,l,!0,v,n,s),k=A=L=0,(v||!c||m)&&(H=this.computeEndSegmentLength(t,e,l,!0),k=this.getLinkDirection(t,e,w,l,!0,v,n,s),m&&(c||l.D(i)||!v&&l.x+i.x===1&&l.y+i.y===1)&&(k-=v?90:30,0>Y&&(k-=180)),0>k?k+=360:360<=k&&(k-=360),m&&(H+=Math.abs(Y)*(v?1:2)),k===0?L=H:k===90?A=H:k===180?L=-H:k===270?A=-H:(L=H*Math.cos(k*Math.PI/180),A=H*Math.sin(k*Math.PI/180)),l.Mc()&&m&&(H=e.ga(on,z.alloc()),R=z.allocAt(H.x+1e3*L,H.y+1e3*A),this.getLinkPointFromPoint(t,e,H,R,!0,w),z.free(H),z.free(R))),H=this.getLinkPoint(n,s,i,!1,v,t,e);var tt=X=R=0;if(v||!f||m){var st=this.computeEndSegmentLength(n,s,i,!1);tt=this.getLinkDirection(n,s,H,i,!1,v,t,e),m&&(f||l.D(i)||!v&&l.x+i.x===1&&l.y+i.y===1)&&(tt+=v?0:30,0>Y&&(tt+=180)),0>tt?tt+=360:360<=tt&&(tt-=360),m&&(st+=Math.abs(Y)*(v?1:2)),tt===0?R=st:tt===90?X=st:tt===180?R=-st:tt===270?X=-st:(R=st*Math.cos(tt*Math.PI/180),X=st*Math.sin(tt*Math.PI/180)),i.Mc()&&m&&(i=s.ga(on,z.alloc()),l=z.allocAt(i.x+1e3*R,i.y+1e3*X),this.getLinkPointFromPoint(n,s,i,l,!1,H),z.free(i),z.free(l))}i=w,(v||!c||m)&&(i=new z(w.x+L,w.y+A)),l=H,(v||!f||m)&&(l=new z(H.x+R,H.y+X)),!C&&!v&&c&&3<a&&this.adjustPoints(0,w,a-2,l)?this.dd(a-1,H):!C&&!v&&f&&3<a&&this.adjustPoints(1,i,a-1,H)?this.dd(0,w):!C&&(v?6<=a:4<a)&&this.adjustPoints(1,i,a-2,l)?(this.dd(0,w),this.dd(a-1,H)):(this.Fj(),this.ne(w),(v||!c||m)&&this.ne(i),v&&this.addOrthoPoints(i,k,l,tt,t,n),(v||!f||m)&&this.ne(l),this.ne(H))}return!0};function dy(t,e){return Math.abs(e.x-t.x)>Math.abs(e.y-t.y)?(e.x>=t.x?e.x=t.x+9e9:e.x=t.x-9e9,e.y=t.y):(e.y>=t.y?e.y=t.y+9e9:e.y=t.y-9e9,e.x=t.x),e}ue.prototype.getLinkPointFromPoint=function(t,e,i,n,s,a){if(a===void 0&&(a=new z),t===null||e===null)return a.assign(i),a;if(t.isVisible()||(s=t.findVisibleNode(),s!==null&&s!==t&&(e=s.port)),t=null,s=e.panel,s===null||s.se()||(s=s.panel),s===null){s=n.x,n=n.y;var l=i.x;i=i.y}else{t=s.oe,s=1/(t.m11*t.m22-t.m12*t.m21),l=t.m22*s;var c=-t.m12*s,f=-t.m21*s,m=t.m11*s,v=s*(t.m21*t.dy-t.m22*t.dx),w=s*(t.m12*t.dx-t.m11*t.dy);s=n.x*l+n.y*f+v,n=n.x*c+n.y*m+w,l=i.x*l+i.y*f+v,i=i.x*c+i.y*m+w}return e.Sj(s,n,l,i,a),t!==null&&a.transform(t),a};function g0(t,e){var i=e.Zn;return i===null&&(i=new Nl,i.port=e,i.node=e.part,e.Zn=i),av(i,t)}ue.prototype.getLinkPoint=function(t,e,i,n,s,a,l,c){if(c===void 0&&(c=new z),i.sb()&&!of(i))return e.ga(i,c),c;if(i.$c()){var f=g0(this,e);if(f!==null){if(c.assign(f.Zo),s&&this.routing===vy){var m=g0(this,l);if(m!==null&&f.Gl<m.Gl){f=z.alloc(),m=z.alloc();var v=new It(e.ga(An,f),e.ga(Go,m)),w=this.computeSpot(!n,l);t=this.getLinkPoint(a,l,w,!n,s,t,e,m),(i.Hf(sa)||i.Hf(fs))&&t.y>=v.y&&t.y<=v.y+v.height?c.y=t.y:(i.Hf(Ol)||i.Hf(jo))&&t.x>=v.x&&t.x<=v.x+v.width&&(c.x=t.x),z.free(f),z.free(m)}}return c}}return i=e.ga(Bm(i),z.alloc()),this.pointsCount>(s?6:2)?(l=n?this.i(1):this.i(this.pointsCount-2),s&&(l=dy(i,l.copy()))):(f=this.computeSpot(!n,l),a=z.alloc(),l=l.ga(Bm(f),a),s&&(l=dy(i,l)),z.free(a)),this.getLinkPointFromPoint(t,e,i,l,n,c),z.free(i),c},ue.prototype.getLinkDirection=function(t,e,i,n,s,a,l,c){t:if(n.sb())var f=n.x>n.y?n.x>1-n.y?0:n.x<1-n.y?270:315:n.x<n.y?n.x>1-n.y?90:n.x<1-n.y?180:135:.5>n.x?225:.5<n.x?45:0;else{if(n.$c()&&(f=g0(this,e),f!==null))switch(f.Nc){case 1:f=270;break t;case 2:f=180;break t;default:case 4:f=0;break t;case 8:f=90;break t}f=e.ga(on,z.alloc()),this.pointsCount>(a?6:2)?(c=s?this.i(1):this.i(this.pointsCount-2),c=a?dy(f,c.copy()):i):(i=z.alloc(),c=c.ga(on,i),z.free(i)),i=Math.abs(c.x-f.x)>Math.abs(c.y-f.y)?c.x>=f.x?0:180:c.y>=f.y?90:270,z.free(f),f=i}return n.Mc()&&l.Td(t)&&(f+=180,360<=f&&(f-=360)),of(n)||(t=e.li(),t===0)||(45<=t&&135>t?f+=90:135<=t&&225>t?f+=180:225<=t&&315>t&&(f+=270),360<=f&&(f-=360)),f},ue.prototype.computeEndSegmentLength=function(t,e,i,n){return e!==null&&i.$c()&&(t=g0(this,e),t!==null)?t.Ju:(t=n?this.fromEndSegmentLength:this.toEndSegmentLength,e!==null&&isNaN(t)&&(t=n?e.fromEndSegmentLength:e.toEndSegmentLength),isNaN(t)&&(t=10),t)},ue.prototype.computeSpot=function(t,e){return e===void 0&&(e=null),t?(t=e||this.fromPort,t===null?t=on:(e=this.fromSpot,e.Xb()&&(e=t.fromSpot),t=e===zn?Nn:e)):(t=e||this.toPort,t===null?t=on:(e=this.toSpot,e.Xb()&&(e=t.toSpot),t=e===zn?Nn:e)),t};function of(t){return t===Nn||t.x===.5&&t.y===.5}function Bm(t){return t.x===.5&&t.y===.5?t:on}ue.prototype.computeOtherPoint=function(t,e){return this.computeAdjusting()!==ea&&4<this.pointsCount?this.computeMidPoint(new z):(t=e.Zn,t=t!==null?av(t,this):null,t!==null?t.Zo:e.ga(on))},ue.prototype.computeShortLength=function(t){if(t){if(t=this.fromShortLength,isNaN(t)){var e=this.fromPort;e!==null&&(t=e.fromShortLength)}return isNaN(t)?0:t}return t=this.toShortLength,isNaN(t)&&(e=this.toPort,e!==null&&(t=e.toShortLength)),isNaN(t)?0:t},ue.prototype.Cf=function(t,e,i,n,s,a){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);var l=a;if(a===void 0&&(l=nn.alloc(),l.reset()),l.multiply(this.transform),this.fh(t,l))return Ig(this,e,i,s),a===void 0&&nn.free(l),!0;if(this.Yc(t,l)){var c=!1;if(!this.isAtomic)for(var f=this.O.s,m=f.length;m--;){var v=f[m];if(v.visible||v===this.locationObject){var w=v.actualBounds,C=this.naturalBounds;if(!(w.x>C.width||w.y>C.height||0>w.x+w.width||0>w.y+w.height)){if(w=nn.alloc(),w.set(l),v instanceof ne)c=v.Cf(t,e,i,n,s,w);else if(this.path===v){if(v instanceof Xi)if(c=t,C=n,v.pickable===!1)c=!1;else if(w.multiply(v.transform),C)t:{var k=c,L=w;if(v.fh(k,L))c=!0;else{if(L===void 0&&(L=v.transform,k.Re(v.actualBounds))){c=!0;break t}c=k.left,C=k.right;var A=k.top;k=k.bottom;var H=z.alloc(),R=z.alloc(),X=z.alloc(),Y=nn.alloc();Y.set(L),Y.bv(v.transform),Y.Vj(),R.x=C,R.y=A,R.transform(Y),H.x=c,H.y=A,H.transform(Y),L=!1,Jd(v,H,R,X)?L=!0:(H.x=C,H.y=k,H.transform(Y),Jd(v,H,R,X)?L=!0:(R.x=c,R.y=k,R.transform(Y),Jd(v,H,R,X)?L=!0:(H.x=c,H.y=A,H.transform(Y),Jd(v,H,R,X)&&(L=!0)))),nn.free(Y),z.free(H),z.free(R),z.free(X),c=L}}else c=v.fh(c,w)}else c=To(v,t,n,w);c&&(C=v,e!==null&&(C=e(v)),C&&(i===null||i(C))&&s.add(C)),nn.free(w)}}}return a===void 0&&nn.free(l),c||this.background!==null||this.areaBackground!==null}return a===void 0&&nn.free(l),!1},ue.prototype.computeCurve=function(){if(this.Wf===null){var t=this.fromPort,e=this.isOrthogonal;this.Wf=t!==null&&t===this.toPort&&!e}return this.Wf?Qa:this.curve},ue.prototype.computeCorner=function(){if(this.curve===Qa)return 0;var t=this.corner;return(isNaN(t)||0>t)&&(t=10),t},ue.prototype.findMidLabel=function(){for(var t=this.path,e=this.O.s,i=e.length,n=0;n<i;n++){var s=e[n];if(s!==t&&!s.isPanelMain&&(s.segmentIndex===-1/0||isNaN(s.segmentIndex)))return s}for(t=this.labelNodes;t.next();)if(e=t.value,e.segmentIndex===-1/0||isNaN(e.segmentIndex))return e;return null},ue.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var t=w1;t=Math.max(t,this.computeThickness());var e=this.fromPort,i=this.toPort;if(e!==null&&i!==null){var n=this.findMidLabel();if(n!==null){var s=n.naturalBounds,a=n.margin,l=isNaN(s.width)?30:s.width*n.scale+a.left+a.right;s=isNaN(s.height)?14:s.height*n.scale+a.top+a.bottom,n=n.segmentOrientation,n===y0||n===nv||n===yy?t=Math.max(t,s):n===zm||n===jm||n===lf||n===x0?t=Math.max(t,l):(e=e.ga(on).ab(i.ga(on))/180*Math.PI,t=Math.max(t,Math.abs(Math.sin(e)*l)+Math.abs(Math.cos(e)*s)+1)),this.curve===Qa&&(t*=1.333)}}return t},ue.prototype.arrangeBundledLinks=function(t,e){if(e)for(e=0;e<t.length;e++){var i=t[e];i.computeAdjusting()===ea&&i.bb()}},ue.prototype.computeCurviness=function(){var t=this.curviness;if(isNaN(t)){t=x1;var e=this.Sf;if(e!==null){for(var i=Pe(),n=0,s=e.links,a=0;a<s.length;a++){var l=s[a].computeSpacing();i.push(l),n+=l}for(n=-n/2,a=0;a<s.length;a++){if(s[a]===this){t=n+i[a]/2;break}n+=i[a]}e.Ds===this.fromNode&&(t=-t),qe(i)}}return t},ue.prototype.computeThickness=function(){if(!this.isVisible())return 0;var t=this.path;return t!==null?Math.max(t.strokeWidth,1):1},ue.prototype.hasCurviness=function(){return!isNaN(this.curviness)||this.Sf!==null},ue.prototype.adjustPoints=function(t,e,i,n){var s=this.computeAdjusting();if(this.isOrthogonal){if(s===Es)return!1;s===dp&&(s=Ka)}switch(s){case Es:var a=this.i(t),l=this.i(i);if(!a.Xa(e)||!l.Xa(n)){s=a.x,a=a.y;var c=l.x-s,f=l.y-a,m=Math.sqrt(c*c+f*f);if(!ht.$(m,0)){if(ht.$(c,0))var v=0>f?-Math.PI/2:Math.PI/2;else v=Math.atan(f/Math.abs(c)),0>c&&(v=Math.PI-v);l=e.x;var w=e.y;c=n.x-l;var C=n.y-w;for(f=Math.sqrt(c*c+C*C),ht.$(c,0)?C=0>C?-Math.PI/2:Math.PI/2:(C=Math.atan(C/Math.abs(c)),0>c&&(C=Math.PI-C)),m=f/m,v=C-v,this.dd(t,e),t+=1;t<i;t++)e=this.i(t),c=e.x-s,f=e.y-a,e=Math.sqrt(c*c+f*f),ht.$(e,0)||(ht.$(c,0)?f=0>f?-Math.PI/2:Math.PI/2:(f=Math.atan(f/Math.abs(c)),0>c&&(f=Math.PI-f)),c=f+v,e*=m,this.L(t,l+e*Math.cos(c),w+e*Math.sin(c)));this.dd(i,n)}}return!0;case dp:if(a=this.i(t),w=this.i(i),!a.Xa(e)||!w.Xa(n)){s=a.x,a=a.y,l=w.x,w=w.y,m=(l-s)*(l-s)+(w-a)*(w-a),c=e.x,v=e.y,f=n.x,C=n.y;var k=1;if(f-c!==0){var L=(C-v)/(f-c);k=Math.sqrt(1+1/(L*L))}else L=9e9;for(this.dd(t,e),t+=1;t<i;t++){e=this.i(t);var A=e.x,H=e.y,R=.5;m!==0&&(R=((s-A)*(s-l)+(a-H)*(a-w))/m);var X=s+R*(l-s),Y=a+R*(w-a);e=Math.sqrt((A-X)*(A-X)+(H-Y)*(H-Y)),H<L*(A-X)+Y&&(e=-e),0<L&&(e=-e),A=c+R*(f-c),R=v+R*(C-v),L!==0?(e=A+e/k,this.L(t,e,R-(e-A)/L)):this.L(t,A,R+e)}this.dd(i,n)}return!0;case Ka:t:{if(this.isOrthogonal&&(s=this.i(t),a=this.i(t+1),l=this.i(t+2),c=a.x,v=a.y,w=c,m=v,ht.B(s.y,a.y)?ht.B(a.x,l.x)?v=e.y:ht.B(a.y,l.y)&&(c=e.x):ht.B(s.x,a.x)&&(ht.B(a.y,l.y)?c=e.x:ht.B(a.x,l.x)&&(v=e.y)),this.L(t+1,c,v),s=this.i(i),a=this.i(i-1),l=this.i(i-2),c=a.x,v=a.y,f=c,C=v,ht.B(s.y,a.y)?ht.B(a.x,l.x)?v=n.y:ht.B(a.y,l.y)&&(c=n.x):ht.B(s.x,a.x)&&(ht.B(a.y,l.y)?c=n.x:ht.B(a.x,l.x)&&(v=n.y)),this.L(i-1,c,v),fy(this))){this.L(t+1,w,m),this.L(i-1,f,C),i=!1;break t}this.dd(t,e),this.dd(i,n),i=!0}return i;default:return!1}},ue.prototype.addOrthoPoints=function(t,e,i,n,s,a){0>e?e+=360:360<=e&&(e-=360),0>n?n+=360:360<=n&&(n-=360);var l=n;e=315<=e||45>e?0:45<=e&&135>e?90:135<=e&&225>e?180:270,n=315<=n||45>n?0:45<=n&&135>n?90:135<=n&&225>n?180:270;var c=s.actualBounds.copy(),f=a.actualBounds.copy();if(c.w()&&f.w()){c.Bc($m,$m),f.Bc($m,$m),c.Ye(t),f.Ye(i);var m=z.alloc(),v=z.alloc();e===0?i.x>t.x||n===270&&i.y<t.y&&f.right>t.x||n===90&&i.y>t.y&&f.right>t.x?(m.h(i.x,t.y),v.h(i.x,(t.y+i.y)/2),n===180?(m.x=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1),v.x=m.x,v.y=i.y):n===270&&i.y<t.y||n===90&&i.y>t.y?(m.x=t.x<f.left?this.computeMidOrthoPosition(t.x,t.y,f.left,i.y,!1):t.x<f.right&&(n===270&&t.y<f.top||n===90&&t.y>f.bottom)?this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1):f.right,v.x=m.x,v.y=i.y):n===0&&t.x<f.left&&t.y>f.top&&t.y<f.bottom&&(m.x=t.x,m.y=t.y<i.y?Math.min(i.y,f.top):Math.max(i.y,f.bottom),v.y=m.y)):(m.h(t.x,i.y),v.h((t.x+i.x)/2,i.y),(n===180||n===90&&i.y<c.top||n===270&&i.y>c.bottom)&&(n===180&&(f.ca(t)||c.ca(i))?m.y=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0):i.y<t.y&&(n===180||n===90)?m.y=this.computeMidOrthoPosition(t.x,c.top,i.x,Math.max(i.y,f.bottom),!0):i.y>t.y&&(n===180||n===270)&&(m.y=this.computeMidOrthoPosition(t.x,c.bottom,i.x,Math.min(i.y,f.top),!0)),v.x=i.x,v.y=m.y),m.y>c.top&&m.y<c.bottom&&(i.x>=c.left&&i.x<=t.x||t.x<=f.right&&t.x>=i.x?(n===90||n===270)&&(m.h(Math.max((t.x+i.x)/2,t.x),t.y),v.h(m.x,i.y)):(m.y=n===270||(n===0||n===180)&&i.y<t.y?Math.min(i.y,n===0?c.top:Math.min(c.top,f.top)):Math.max(i.y,n===0?c.bottom:Math.max(c.bottom,f.bottom)),v.x=i.x,v.y=m.y))):e===180?i.x<t.x||n===270&&i.y<t.y&&f.left<t.x||n===90&&i.y>t.y&&f.left<t.x?(m.h(i.x,t.y),v.h(i.x,(t.y+i.y)/2),n===0?(m.x=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1),v.x=m.x,v.y=i.y):n===270&&i.y<t.y||n===90&&i.y>t.y?(m.x=t.x>f.right?this.computeMidOrthoPosition(t.x,t.y,f.right,i.y,!1):t.x>f.left&&(n===270&&t.y<f.top||n===90&&t.y>f.bottom)?this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1):f.left,v.x=m.x,v.y=i.y):n===180&&t.x>f.right&&t.y>f.top&&t.y<f.bottom&&(m.x=t.x,m.y=t.y<i.y?Math.min(i.y,f.top):Math.max(i.y,f.bottom),v.y=m.y)):(m.h(t.x,i.y),v.h((t.x+i.x)/2,i.y),(n===0||n===90&&i.y<c.top||n===270&&i.y>c.bottom)&&(n===0&&(f.ca(t)||c.ca(i))?m.y=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0):i.y<t.y&&(n===0||n===90)?m.y=this.computeMidOrthoPosition(t.x,c.top,i.x,Math.max(i.y,f.bottom),!0):i.y>t.y&&(n===0||n===270)&&(m.y=this.computeMidOrthoPosition(t.x,c.bottom,i.x,Math.min(i.y,f.top),!0)),v.x=i.x,v.y=m.y),m.y>c.top&&m.y<c.bottom&&(i.x<=c.right&&i.x>=t.x||t.x>=f.left&&t.x<=i.x?(n===90||n===270)&&(m.h(Math.min((t.x+i.x)/2,t.x),t.y),v.h(m.x,i.y)):(m.y=n===270||(n===0||n===180)&&i.y<t.y?Math.min(i.y,n===180?c.top:Math.min(c.top,f.top)):Math.max(i.y,n===180?c.bottom:Math.max(c.bottom,f.bottom)),v.x=i.x,v.y=m.y))):e===90?i.y>t.y||n===180&&i.x<t.x&&f.bottom>t.y||n===0&&i.x>t.x&&f.bottom>t.y?(m.h(t.x,i.y),v.h((t.x+i.x)/2,i.y),n===270?(m.y=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0),v.x=i.x,v.y=m.y):n===180&&i.x<t.x||n===0&&i.x>t.x?(m.y=t.y<f.top?this.computeMidOrthoPosition(t.x,t.y,i.x,f.top,!0):t.y<f.bottom&&(n===180&&t.x<f.left||n===0&&t.x>f.right)?this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0):f.bottom,v.x=i.x,v.y=m.y):n===90&&t.y<f.top&&t.x>f.left&&t.x<f.right&&(m.x=t.x<i.x?Math.min(i.x,f.left):Math.max(i.x,f.right),m.y=t.y,v.x=m.x)):(m.h(i.x,t.y),v.h(i.x,(t.y+i.y)/2),(n===270||n===0&&i.x<c.left||n===180&&i.x>c.right)&&(n===270&&(f.ca(t)||c.ca(i))?m.x=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1):i.x<t.x&&(n===270||n===0)?m.x=this.computeMidOrthoPosition(c.left,t.y,Math.max(i.x,f.right),i.y,!1):i.x>t.x&&(n===270||n===180)&&(m.x=this.computeMidOrthoPosition(c.right,t.y,Math.min(i.x,f.left),i.y,!1)),v.x=m.x,v.y=i.y),m.x>c.left&&m.x<c.right&&(i.y>=c.top&&i.y<=t.y||t.y<=f.bottom&&t.y>=i.y?(n===0||n===180)&&(m.h(t.x,Math.max((t.y+i.y)/2,t.y)),v.h(i.x,m.y)):(m.x=n===180||(n===90||n===270)&&i.x<t.x?Math.min(i.x,n===90?c.left:Math.min(c.left,f.left)):Math.max(i.x,n===90?c.right:Math.max(c.right,f.right)),v.x=m.x,v.y=i.y))):i.y<t.y||n===180&&i.x<t.x&&f.top<t.y||n===0&&i.x>t.x&&f.top<t.y?(m.h(t.x,i.y),v.h((t.x+i.x)/2,i.y),n===90?(m.y=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0),v.x=i.x,v.y=m.y):n===180&&i.x<t.x||n===0&&i.x>=t.x?(m.y=t.y>f.bottom?this.computeMidOrthoPosition(t.x,t.y,i.x,f.bottom,!0):t.y>f.top&&(n===180&&t.x<f.left||n===0&&t.x>f.right)?this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!0):f.top,v.x=i.x,v.y=m.y):n===270&&t.y>f.bottom&&t.x>f.left&&t.x<f.right&&(m.x=t.x<i.x?Math.min(i.x,f.left):Math.max(i.x,f.right),m.y=t.y,v.x=m.x)):(m.h(i.x,t.y),v.h(i.x,(t.y+i.y)/2),(n===90||n===0&&i.x<c.left||n===180&&i.x>c.right)&&(n===90&&(f.ca(t)||c.ca(i))?m.x=this.computeMidOrthoPosition(t.x,t.y,i.x,i.y,!1):i.x<t.x&&(n===90||n===0)?m.x=this.computeMidOrthoPosition(c.left,t.y,Math.max(i.x,f.right),i.y,!1):i.x>t.x&&(n===90||n===180)&&(m.x=this.computeMidOrthoPosition(c.right,t.y,Math.min(i.x,f.left),i.y,!1)),v.x=m.x,v.y=i.y),m.x>c.left&&m.x<c.right&&(i.y<=c.bottom&&i.y>=t.y||t.y>=f.top&&t.y<=i.y?(n===0||n===180)&&(m.h(t.x,Math.min((t.y+i.y)/2,t.y)),v.h(i.x,m.y)):(m.x=n===180||(n===90||n===270)&&i.x<t.x?Math.min(i.x,n===270?c.left:Math.min(c.left,f.left)):Math.max(i.x,n===270?c.right:Math.max(c.right,f.right)),v.x=m.x,v.y=i.y)));var w=i;if(this.isAvoiding){var C=this.diagram;if(C===null||s===a||this.layer.isTemporary||!Ca(C)||c.ca(w)&&!a.Td(s)||f.ca(t)&&!s.Td(a))e=!1;else{var k=oh(C,!0,this.containingGroup,null);if(this.segmentIndex!==17&&k.Yj(Math.min(t.x,m.x),Math.min(t.y,m.y),Math.abs(t.x-m.x),Math.abs(t.y-m.y))&&k.Yj(Math.min(m.x,v.x),Math.min(m.y,v.y),Math.abs(m.x-v.x),Math.abs(m.y-v.y))&&k.Yj(Math.min(v.x,w.x),Math.min(v.y,w.y),Math.abs(v.x-w.x),Math.abs(v.y-w.y)))e=!1;else{s=t,a=w;var L=i=null;if(C.isVirtualized){C=k.bounds.copy(),C.Bc(-k.Ho,-k.Go);var A=z.alloc();b0(k,t.x,t.y)||(ht.Ff(C.x,C.y,C.x+C.width,C.y+C.height,t.x,t.y,m.x,m.y,A)?(i=t=A.copy(),e=A.ab(m)):ht.Ff(C.x,C.y,C.x+C.width,C.y+C.height,m.x,m.y,v.x,v.y,A)?(i=t=A.copy(),e=A.ab(v)):ht.Ff(C.x,C.y,C.x+C.width,C.y+C.height,v.x,v.y,w.x,w.y,A)&&(i=t=A.copy(),e=A.ab(w))),b0(k,w.x,w.y)||(ht.Ff(C.x,C.y,C.x+C.width,C.y+C.height,w.x,w.y,v.x,v.y,A)?(L=w=A.copy(),n=v.ab(A)):ht.Ff(C.x,C.y,C.x+C.width,C.y+C.height,v.x,v.y,m.x,m.y,A)?(L=w=A.copy(),n=m.ab(A)):ht.Ff(C.x,C.y,C.x+C.width,C.y+C.height,m.x,m.y,t.x,t.y,A)&&(L=w=A.copy(),n=t.ab(A))),z.free(A)}c=c.copy().ed(f),c.Bc(k.Ho*k.Os,k.Go*k.Os),xy(k,t,e,w,n,c,!0),f=cu(k,w.x,w.y),!k.abort&&f>=S0&&(b1(k),c.Bc(k.Ho*k.Hx,k.Go*k.Ix),xy(k,t,e,w,n,c,!1),f=cu(k,w.x,w.y)),!k.abort&&f<S0&&cu(k,w.x,w.y)!==fh?(Fm(this,k,w.x,w.y,n,!0,l),c=this.i(2),4>this.pointsCount?(e===0||e===180?(c.x=t.x,c.y=w.y):(c.x=w.x,c.y=t.y),this.L(2,c.x,c.y),this.m(3,c.x,c.y)):(l=this.i(3),e===0||e===180?ht.B(c.x,l.x)?(c=e===0?Math.max(c.x,t.x):Math.min(c.x,t.x),this.L(2,c,t.y),this.L(3,c,l.y)):ht.B(c.y,l.y)?(Math.abs(t.y-c.y)<=k.Go/2&&(this.L(2,c.x,t.y),this.L(3,l.x,t.y)),this.m(2,c.x,t.y)):this.L(2,t.x,c.y):(e===90||e===270)&&(ht.B(c.y,l.y)?(c=e===90?Math.max(c.y,t.y):Math.min(c.y,t.y),this.L(2,t.x,c),this.L(3,l.x,c)):ht.B(c.x,l.x)?(Math.abs(t.x-c.x)<=k.Ho/2&&(this.L(2,t.x,c.y),this.L(3,t.x,l.y)),this.m(2,t.x,c.y)):this.L(2,c.x,t.y))),i!==null&&(t=this.i(1),l=this.i(2),t.x!==l.x&&t.y!==l.y?e===0||e===180?this.m(2,t.x,l.y):this.m(2,l.x,t.y):e===0||e===180?this.m(2,s.x,i.y):this.m(2,i.x,s.y)),L!==null&&(n===0||n===180?this.yf(a.x,L.y):this.yf(L.x,a.y)),e=!0):e=!1}}}else e=!1;e||(this.ne(m.copy()),this.ne(v.copy())),z.free(m),z.free(v)}},ue.prototype.computeMidOrthoPosition=function(t,e,i,n,s){var a=0;return!this.hasCurviness()||this.computeSpot(!0,this.fromPort).$c()||this.computeSpot(!1,this.toPort).$c()||(a=this.computeCurviness()),s?(e+n)/2+a:(t+i)/2+a};function fy(t){if(t.diagram===null||!t.isAvoiding||!Ca(t.diagram))return!1;var e=t.points.s,i=e.length;if(4>i)return!1;t=oh(t.diagram,!0,t.containingGroup,null);for(var n=1;n<i-2;n++){var s=e[n],a=e[n+1];if(!t.Yj(Math.min(s.x,a.x),Math.min(s.y,a.y),Math.abs(s.x-a.x),Math.abs(s.y-a.y)))return!0}return!1}function Fm(t,e,i,n,s,a,l){var c=e.Ho,f=e.Go,m=cu(e,i,n),v=i,w=n;for(s===0?v+=c:s===90?w+=f:s===180?v-=c:w-=f,s!==l&&m>uf&&cu(e,v,w)!==m-1&&(cu(e,i-c,n)===m-1?(s=180,v=i-c,w=n):cu(e,i+c,n)===m-1?(s=0,v=i+c,w=n):cu(e,i,n-f)===m-1?(s=270,v=i,w=n-f):cu(e,i,n+f)===m-1&&(s=90,v=i,w=n+f));m>uf&&cu(e,v,w)===m-1;)i=v,n=w,s===0?v+=c:s===90?w+=f:s===180?v-=c:w-=f,--m;a?m>uf&&(s===180||s===0?i=Math.floor(i/c)*c+c/2:(s===90||s===270)&&(n=Math.floor(n/f)*f+f/2)):(i=Math.floor(i/c)*c+c/2,n=Math.floor(n/f)*f+f/2),m>uf&&(a=s,l=i,v=n,s===0?(a=90,v+=f):s===90?(a=180,l-=c):s===180?(a=270,v-=f):s===270&&(a=0,l+=c),cu(e,l,v)===m-1?Fm(t,e,l,v,a,!1,a):(l=i,v=n,s===0?(a=270,v-=f):s===90?(a=0,l+=c):s===180?(a=90,v+=f):s===270&&(a=180,l-=c),cu(e,l,v)===m-1&&Fm(t,e,l,v,a,!1,a))),t.yf(i,n)}ue.prototype.ez=function(t){var e=t.x;t=t.y;for(var i=this.i(0),n=this.i(1),s=Fn(e,t,i.x,i.y,n.x,n.y),a=0,l=1;l<this.pointsCount-1;l++){i=this.i(l+1);var c=Fn(e,t,n.x,n.y,i.x,i.y);n=i,c<s&&(a=l,s=c)}return a},ue.prototype.qc=function(){this.lk=!1,this.v()},ue.prototype.Ul=function(t){if(!(!t&&(this.fd===!1||(t=this.Pb(),this.lk&&(t===null||t.geometry!==null))))&&(2>this.pointsCount?this.lk=!0:this.ua=this.makeGeometry(),t=this.path,t!==null)){t.ua=this.ua;for(var e=this.O.s,i=e.length,n=0;n<i;n++){var s=e[n];s!==t&&s.isPanelMain&&s instanceof Xi&&(s.ua=this.ua)}}},ue.prototype.makeGeometry=function(){var t=this.ua,e=this.pointsCount,i=!1,n=this.diagram;n!==null&&hd(this)&&n.Eh.contains(this)&&(this.ml.width!==0||this.ml.height!==0)&&(n.animationManager.isAnimating||n.currentTool!==n.toolManager)&&(i=!0);var s=this.i(0).copy(),a=s.copy();n=this.Nb.s;var l=this.computeCurve();if(l===Qa&&3<=e&&!ht.$(this.smoothness,0))if(e===3){var c=this.i(1);n=Math.min(s.x,c.x);var f=Math.min(s.y,c.y);c=this.i(2),n=Math.min(n,c.x),f=Math.min(f,c.y)}else{if(this.isOrthogonal)for(f=0;f<e;f++)c=n[f],a.x=Math.min(c.x,a.x),a.y=Math.min(c.y,a.y);else for(n=3;n<e;n+=3)n+3>=e&&(n=e-1),f=this.i(n),a.x=Math.min(f.x,a.x),a.y=Math.min(f.y,a.y);n=a.x,f=a.y}else{for(f=0;f<e;f++)c=n[f],a.x=Math.min(c.x,a.x),a.y=Math.min(c.y,a.y);n=a.x,f=a.y}if(n-=this.su.x,f-=this.su.y,s.x-=n,s.y-=f,e!==2||hd(this)){if(t.type=fe.o,c=ny(t),this.computeShortLength(!0)!==0&&(s=sf(this,s,!0,a)),Qd(c,s.x,s.y,!1),l===Qa&&3<=e&&!ht.$(this.smoothness,0))if(e===3)i=this.i(1),e=i.x-n,i=i.y-f,s=this.i(2).copy(),s.x-=n,s.y-=f,this.computeShortLength(!1)!==0&&(s=sf(this,s,!1,a)),Zl(c,e,i,e,i,s.x,s.y);else if(this.isOrthogonal){e=z.allocAt(n,f),i=z.alloc(),i.assign(this.i(1)),a=z.allocAt(n,f),s=z.allocAt(n,f),l=this.i(0);for(var m,v=this.smoothness/3,w=1;w<this.pointsCount-1;w++){m=this.i(w);var C=l,k=m,L=this.i(ud(this,m,w,!1));if((!ht.$(C.x,k.x)||!ht.$(k.x,L.x))&&(!ht.$(C.y,k.y)||!ht.$(k.y,L.y))){var A=v;isNaN(A)&&(A=this.smoothness/3);var H=C.x;C=C.y;var R=k.x;k=k.y;var X=L.x;L=L.y;var Y=A*v0(H,C,R,k);A*=v0(R,k,X,L),ht.$(C,k)&&ht.$(R,X)&&(R>H?L>k?(a.x=R-Y,a.y=k-Y,s.x=R+A,s.y=k+A):(a.x=R-Y,a.y=k+Y,s.x=R+A,s.y=k-A):L>k?(a.x=R+Y,a.y=k-Y,s.x=R-A,s.y=k+A):(a.x=R+Y,a.y=k+Y,s.x=R-A,s.y=k-A)),ht.$(H,R)&&ht.$(k,L)&&(k>C?(X>R?(a.x=R-Y,a.y=k-Y,s.x=R+A):(a.x=R+Y,a.y=k-Y,s.x=R-A),s.y=k+A):(X>R?(a.x=R-Y,a.y=k+Y,s.x=R+A):(a.x=R+Y,a.y=k+Y,s.x=R-A),s.y=k-A)),(ht.$(H,R)&&ht.$(R,X)||ht.$(C,k)&&ht.$(k,L))&&(H=.5*(H+X),C=.5*(C+L),a.x=H,a.y=C,s.x=H,s.y=C),(w===1||w===2&&ht.$(l.x,this.i(0).x)&&ht.$(l.y,this.i(0).y))&&(i.x=.5*(l.x+m.x),i.y=.5*(l.y+m.y)),Zl(c,i.x-n,i.y-f,a.x-n,a.y-f,m.x-n,m.y-f),e.set(a),i.set(s),l=m}}m=l.x,l=l.y,v=this.i(this.pointsCount-1),this.computeShortLength(!1)!==0&&(v=sf(this,v.copy(),!1,fn)),m=.5*(m+v.x),l=.5*(l+v.y),Zl(c,s.x-n,s.y-f,m-n,l-f,v.x-n,v.y-f),z.free(e),z.free(i),z.free(a),z.free(s)}else for(i=3;i<e;i+=3)a=this.i(i-2),i+3>=e&&(i=e-1),s=this.i(i-1),l=this.i(i),i===e-1&&this.computeShortLength(!1)!==0&&(l=sf(this,l.copy(),!1,fn)),Zl(c,a.x-n,a.y-f,s.x-n,s.y-f,l.x-n,l.y-f);else{for(a=z.alloc(),a.assign(this.i(0)),s=z.alloc(),s.assign(a),l=this.computeCorner(),w=1,m=0;w<e;){if(w=ud(this,a,w,1<w),v=this.i(w),w>=e-1){if(!a.D(v))this.computeShortLength(!1)!==0&&(v=sf(this,v.copy(),!1,fn)),Uh(this,c,-n,-f,a,v,i);else if(m===0)for(w=1;w<e;)s.assign(a),v=this.i(w++),Uh(this,c,-n,-f,a,v,i),a.assign(v);break}if(m=ud(this,v,w+1,w<e-3),w=-n,H=-f,C=v,R=this.i(m),A=i,ht.B(a.y,C.y)&&ht.B(C.x,R.x))if(L=Math.min(l,Math.abs(C.x-s.x)/2),L=Y=Math.min(L,Math.abs(R.y-C.y)/2),ht.B(L,0))Uh(this,c,w,H,a,C,A),a.assign(C);else{var tt=C.x,st=C.y;k=tt,X=st,C.x>a.x?tt=C.x-L:tt=C.x+L,R.y>C.y?X=C.y+Y:X=C.y-Y,R=z.allocAt(tt,st),Uh(this,c,w,H,a,R,A),z.free(R),sd(c,C.x+w,C.y+H,k+w,X+H),a.h(k,X)}else ht.B(a.x,C.x)&&ht.B(C.y,R.y)?(L=Math.min(l,Math.abs(C.y-s.y)/2),L=Y=Math.min(L,Math.abs(R.x-C.x)/2),ht.B(Y,0)?(Uh(this,c,w,H,a,C,A),a.assign(C)):(tt=C.x,st=C.y,k=tt,X=st,C.y>a.y?st=C.y-L:st=C.y+L,R.x>C.x?k=C.x+Y:k=C.x-Y,R=z.allocAt(tt,st),Uh(this,c,w,H,a,R,A),z.free(R),sd(c,C.x+w,C.y+H,k+w,X+H),a.h(k,X))):(Uh(this,c,w,H,a,C,A),a.assign(C));s.assign(v),w=m}z.free(a)}lp=c}else c=this.i(1).copy(),c.x-=n,c.y-=f,this.computeShortLength(!0)!==0&&(s=sf(this,s,!0,a)),this.computeShortLength(!1)!==0&&(c=sf(this,c,!1,a)),t.type=fe.j,t.startX=s.x,t.startY=s.y,t.endX=c.x,t.endY=c.y;return this.lk=!0,t};function v0(t,e,i,n){return t=i-t,isNaN(t)||t===1/0||t===-1/0?NaN:(0>t&&(t=-t),e=n-e,isNaN(e)||e===1/0||e===-1/0?NaN:(0>e&&(e=-e),ht.$(t,0)?e:ht.$(e,0)?t:Math.sqrt(t*t+e*e)))}function sf(t,e,i,n){var s=t.pointsCount;if(2>s)return e;if(i){var a=t.i(1);if(i=a.x-n.x,a=a.y-n.y,n=v0(e.x,e.y,i,a),n===0)return e;s=s===2?.5*n:n,t=t.computeShortLength(!0),t>s&&(t=s),s=t*(a-e.y)/n,e.x+=t*(i-e.x)/n,e.y+=s}else{if(a=t.i(s-2),i=a.x-n.x,a=a.y-n.y,n=v0(e.x,e.y,i,a),n===0)return e;s=s===2?.5*n:n,t=t.computeShortLength(!1),t>s&&(t=s),s=t*(e.y-a)/n,e.x-=t*(e.x-i)/n,e.y-=s}return e}function ud(t,e,i,n){for(var s=t.pointsCount,a=e;ht.$(e.x,a.x)&&ht.$(e.y,a.y);){if(i>=s)return s-1;a=t.i(i++)}if(!ht.$(e.x,a.x)&&!ht.$(e.y,a.y))return i-1;for(var l=a;ht.$(e.x,a.x)&&ht.$(a.x,l.x)&&(!n||(e.y>=a.y?a.y>=l.y:a.y<=l.y))||ht.$(e.y,a.y)&&ht.$(a.y,l.y)&&(!n||(e.x>=a.x?a.x>=l.x:a.x<=l.x));){if(i>=s)return s-1;l=t.i(i++)}return i-2}ue.prototype.computeJumpLength=function(){return 10};function Uh(t,e,i,n,s,a,l){if(!l&&hd(t)){l=t.computeJumpLength();var c=l/2,f=[],m=0;if(t.isVisible()&&(m=tv(t,s,a,f)),0<m){if(ht.B(s.y,a.y))if(s.x<a.x)for(var v=0;v<m;){var w=Math.max(s.x,Math.min(f[v++]-c,a.x-l));e.lineTo(w+i,a.y+n);for(var C=w+i,k=Math.min(w+l,a.x);v<m&&(w=f[v],w<k+l);)v++,k=Math.min(w+c,a.x);w=a.y-l+n,k+=i;var L=a.y+n;t.curve===$a?Qd(e,k,L,!1):Zl(e,C,w,k,w,k,L)}else for(--m;0<=m;){for(v=Math.min(s.x,Math.max(f[m--]+c,a.x+l)),e.lineTo(v+i,a.y+n),C=v+i,w=Math.max(v-l,a.x);0<=m&&(v=f[m],v>w-l);)m--,w=Math.max(v-c,a.x);v=a.y-l+n,w+=i,k=a.y+n,t.curve===$a?Qd(e,w,k,!1):Zl(e,C,v,w,v,w,k)}else if(ht.B(s.x,a.x))if(s.y<a.y)for(v=0;v<m;){for(w=Math.max(s.y,Math.min(f[v++]-c,a.y-l)),e.lineTo(a.x+i,w+n),C=w+n,w=Math.min(w+l,a.y);v<m&&(k=f[v],k<w+l);)v++,w=Math.min(k+c,a.y);k=a.x-l+i,L=a.x+i,w+=n,t.curve===$a?Qd(e,L,w,!1):Zl(e,k,C,k,w,L,w)}else for(--m;0<=m;){for(v=Math.min(s.y,Math.max(f[m--]+c,a.y+l)),e.lineTo(a.x+i,v+n),C=v+n,v=Math.max(v-l,a.y);0<=m&&(w=f[m],w>v-l);)m--,v=Math.max(w-c,a.y);w=a.x-l+i,k=a.x+i,v+=n,t.curve===$a?Qd(e,k,v,!1):Zl(e,w,C,w,v,k,v)}}}e.lineTo(a.x+i,a.y+n)}function tv(t,e,i,n){var s=t.diagram;if(s===null||e.D(i))return 0;for(s=s.layers;s.next();){var a=s.value;if(a!==null&&a.visible){a=a.Pa.s;for(var l=a.length,c=0;c<l;c++){var f=a[c];if(f instanceof ue){if(f===t)return 0<n.length&&n.sort(function(v,w){return v-w}),n.length;if(f.isVisible()&&hd(f)){var m=f.routeBounds;m.w()&&t.routeBounds.Yc(m)&&!t.usesSamePort(f)&&(m=f.path,m!==null&&m.Ed()&&py(e,i,n,f))}}}}}return 0<n.length&&n.sort(function(v,w){return v-w}),n.length}function py(t,e,i,n){for(var s=ht.B(t.y,e.y),a=n.pointsCount,l=n.i(0),c=z.alloc(),f=1;f<a;f++){var m=n.i(f);if(f<a-1){var v=n.i(f+1);if(l.y===m.y&&m.y===v.y){if(m.x>l.x&&v.x>=m.x||m.x<l.x&&v.x<=m.x)continue}else if(l.x===m.x&&m.x===v.x&&(m.y>l.y&&v.y>=m.y||m.y<l.y&&v.y<=m.y))continue}t:{v=t.x;var w=t.y,C=e.x,k=e.y,L=l.x;l=l.y;var A=m.x,H=m.y;if(ht.B(v,C)){if(!ht.B(w,k)&&ht.B(l,H)&&Math.min(w,k)<l&&Math.max(w,k)>l&&Math.min(L,A)<v&&Math.max(L,A)>v&&!ht.B(L,A)){c.x=v,c.y=l,v=!0;break t}}else if(ht.B(w,k)&&ht.B(L,A)&&Math.min(v,C)<L&&Math.max(v,C)>L&&Math.min(l,H)<w&&Math.max(l,H)>w&&!ht.B(l,H)){c.x=L,c.y=w,v=!0;break t}c.x=0,c.y=0,v=!1}v&&(s?i.push(c.x):i.push(c.y)),l=m}z.free(c)}function hd(t){return t=t.curve,t===yo||t===$a}function ev(t,e){(e||hd(t))&&(e=t.diagram,e===null||e.animationManager.isTicking||e.Eh.contains(t)||t.ml.width===0&&t.ml.height===0||e.Eh.add(t,t.ml.copy()))}ue.prototype.Xo=function(t){var e=this.layer;if(e!==null&&e.visible&&!e.isTemporary){var i=e.diagram;if(i!==null&&!i.animationManager.isTicking){var n=!1;for(i=i.layers;i.next();){var s=i.value;if(s.visible){if(s===e){n=!0;var a=!1;s=s.Pa.s;for(var l=s.length,c=0;c<l;c++){var f=s[c];f instanceof ue&&(f===this?a=!0:a&&my(this,f,t))}}else if(n)for(a=s.Pa.s,s=a.length,l=0;l<s;l++)c=a[l],c instanceof ue&&my(this,c,t)}}}}};function my(t,e,i){if(e!==null&&e.lk&&e.fd&&hd(e)){var n=e.routeBounds;n.w()&&(t.routeBounds.Yc(n)||i.Yc(n))&&(t.usesSamePort(e)||e.qc())}}ue.prototype.usesSamePort=function(t){var e=this.pointsCount,i=t.pointsCount;if(0<e&&0<i){var n=this.i(0),s=t.i(0);if(n.Xa(s)||(e=this.i(e-1),t=t.i(i-1),e.Xa(t)||n.Xa(t)||e.Xa(s)))return!0}else if(this.fromNode===t.fromNode||this.toNode===t.toNode||this.fromNode===t.toNode||this.toNode===t.fromNode)return!0;return!1},ue.prototype.isVisible=function(){if(!ui.prototype.isVisible.call(this))return!1;var t=this.containingGroup,e=!0,i=this.diagram;if(i!==null&&(e=i.isTreePathToChildren),i=this.fromNode,i!==null){if(this.isTreeLink&&e&&!i.isTreeExpanded)return!1;if(i===t)return!0;for(var n=i;n!==null;){if(n.labeledLink===this)return!0;n=n.containingGroup}if(i=i.findVisibleNode(),i===null||i===t)return!1}if(i=this.toNode,i!==null){if(this.isTreeLink&&!e&&!i.isTreeExpanded)return!1;if(i===t)return!0;for(e=i;e!==null;){if(e.labeledLink===this)return!0;e=e.containingGroup}if(e=i.findVisibleNode(),e===null||e===t)return!1}return!0},ue.prototype.Zb=function(t){if(ui.prototype.Zb.call(this,t),t&&ev(this,!1),this.Sf!==null&&this.Sf.Sl(),this.wd!==null)for(var e=this.wd.iterator;e.next();)e.value.Zb(t)},ue.prototype.computeAdjusting=function(){return this.isAvoiding&&this.diagram!==null&&this.diagram.animationManager.defaultAnimation.isAnimating?Ka:this.qk};function Rm(t){var e=t.ef;if(e!==null){var i=t.uf;if(i!==null&&isNaN(t.curviness)){for(var n=t.ff,s=t.vf,a=t=null,l=e.jb.s,c=l.length,f=0;f<c;f++){var m=l[f];(m.ef===e&&m.ff===n&&m.uf===i&&m.vf===s||m.ef===i&&m.ff===s&&m.uf===e&&m.vf===n)&&(a===null?a=m:(t===null&&(t=[],t.push(a)),t.push(m)))}if(t!==null){for(a=p1(e,i,n,s),a===null&&(a=new w0(e,n,i,s),sy(e,a),sy(i,a)),a.links=t,e=0;e<t.length;e++)t[e].Sf=a;a.Sl()}}}}function cd(t){var e=t.Sf;e!==null&&isNaN(t.curviness)&&(t.Sf=null,t=e.links.indexOf(t),0<=t&&(Mi(e.links,t),e.Sl()))}ue.prototype.ph=function(){return!0},ct.Object.defineProperties(ue.prototype,{fromNode:{get:function(){return this.ef},set:function(t){var e=this.ef;if(e!==t){var i=this.fromPort;e!==null&&(this.uf!==e&&Yg(e,this,i),cd(this),this.C(2)),this.ef=t,t!==null&&this.Zb(t.isVisible()),this.Wf=null,this.bb();var n=this.diagram;n!==null&&n.aa&&n.partManager.setFromNodeForLink(this,t,e);var s=this.fromPort,a=this.fromPortChanged;if(a!==null){var l=!0;n!==null&&(l=n.aa,n.aa=!0),a(this,i,s),n!==null&&(n.aa=l)}t!==null&&(this.uf!==t&&Dm(t,this,s),Rm(this),this.C(1)),this.g("fromNode",e,t),hp(this)}}},fromPortId:{get:function(){return this.ff},set:function(t){var e=this.ff;if(e!==t){var i=this.fromPort;i!==null&&ja(i),cd(this),this.ff=t;var n=this.fromPort;n!==null&&ja(n);var s=this.diagram;if(s!==null){var a=this.data,l=s.model;a!==null&&l.ri()&&l.xv(a,t)}i!==n&&(this.Wf=null,this.bb(),a=this.fromPortChanged,a!==null&&(l=!0,s!==null&&(l=s.aa,s.aa=!0),a(this,i,n),s!==null&&(s.aa=l))),Rm(this),this.g("fromPortId",e,t)}}},fromPort:{get:function(){var t=this.ef;return t===null?null:t.ns(this.ff)}},fromPortChanged:{get:function(){return this.gn},set:function(t){var e=this.gn;e!==t&&(this.gn=t,this.g("fromPortChanged",e,t))}},toNode:{get:function(){return this.uf},set:function(t){var e=this.uf;if(e!==t){var i=this.toPort;e!==null&&(this.ef!==e&&Yg(e,this,i),cd(this),this.C(2)),this.uf=t,t!==null&&this.Zb(t.isVisible()),this.Wf=null,this.bb();var n=this.diagram;n!==null&&n.aa&&n.partManager.setToNodeForLink(this,t,e);var s=this.toPort,a=this.toPortChanged;if(a!==null){var l=!0;n!==null&&(l=n.aa,n.aa=!0),a(this,i,s),n!==null&&(n.aa=l)}t!==null&&(this.ef!==t&&Dm(t,this,s),Rm(this),this.C(1)),this.g("toNode",e,t),hp(this)}}},toPortId:{get:function(){return this.vf},set:function(t){var e=this.vf;if(e!==t){var i=this.toPort;i!==null&&ja(i),cd(this),this.vf=t;var n=this.toPort;n!==null&&ja(n);var s=this.diagram;if(s!==null){var a=this.data,l=s.model;a!==null&&l.ri()&&l.Cv(a,t)}i!==n&&(this.Wf=null,this.bb(),a=this.toPortChanged,a!==null&&(l=!0,s!==null&&(l=s.aa,s.aa=!0),a(this,i,n),s!==null&&(s.aa=l))),Rm(this),this.g("toPortId",e,t)}}},toPort:{get:function(){var t=this.uf;return t===null?null:t.ns(this.vf)}},toPortChanged:{get:function(){return this.uo},set:function(t){var e=this.uo;e!==t&&(this.uo=t,this.g("toPortChanged",e,t))}},fromSpot:{get:function(){return this.ba!==null?this.ba.Xi:zn},set:function(t){var e=this.fromSpot;e.D(t)||(t=t.J(),this.Xc(),this.ba.Xi=t,this.g("fromSpot",e,t),(e.$c()||t.$c())&&this.fromNode!==null&&ja(this.fromPort),this.bb())}},fromEndSegmentLength:{get:function(){return this.ba!==null?this.ba.Vi:NaN},set:function(t){var e=this.fromEndSegmentLength;e!==t&&(0>t&&me(t,">= 0",ue,"fromEndSegmentLength"),this.Xc(),this.ba.Vi=t,this.g("fromEndSegmentLength",e,t),this.bb())}},fromShortLength:{get:function(){return this.ba!==null?this.ba.Wi:NaN},set:function(t){var e=this.fromShortLength;e!==t&&(this.Xc(),this.ba.Wi=t,this.qc(),this.g("fromShortLength",e,t))}},toSpot:{get:function(){return this.ba!==null?this.ba.yj:zn},set:function(t){var e=this.toSpot;e.D(t)||(t=t.J(),this.Xc(),this.ba.yj=t,this.g("toSpot",e,t),(e.$c()||t.$c())&&this.toNode!==null&&ja(this.toPort),this.bb())}},toEndSegmentLength:{get:function(){return this.ba!==null?this.ba.wj:NaN},set:function(t){var e=this.toEndSegmentLength;e!==t&&(0>t&&me(t,">= 0",ue,"toEndSegmentLength"),this.Xc(),this.ba.wj=t,this.g("toEndSegmentLength",e,t),this.bb())}},toShortLength:{get:function(){return this.ba!==null?this.ba.xj:NaN},set:function(t){var e=this.toShortLength;e!==t&&(this.Xc(),this.ba.xj=t,this.qc(),this.g("toShortLength",e,t))}},isLabeledLink:{get:function(){return this.wd===null?!1:0<this.wd.count}},labelNodes:{get:function(){return this.wd===null?Gi:this.wd.iterator}},relinkableFrom:{get:function(){return(this.Qa&1)!==0},set:function(t){var e=(this.Qa&1)!==0;e!==t&&(this.Qa^=1,this.g("relinkableFrom",e,t),this.Wb())}},relinkableTo:{get:function(){return(this.Qa&2)!==0},set:function(t){var e=(this.Qa&2)!==0;e!==t&&(this.Qa^=2,this.g("relinkableTo",e,t),this.Wb())}},resegmentable:{get:function(){return(this.Qa&4)!==0},set:function(t){var e=(this.Qa&4)!==0;e!==t&&(this.Qa^=4,this.g("resegmentable",e,t),this.Wb())}},isTreeLink:{get:function(){return(this.Qa&8)!==0},set:function(t){var e=(this.Qa&8)!==0;e!==t&&(this.Qa^=8,this.g("isTreeLink",e,t),this.fromNode!==null&&Im(this.fromNode),this.toNode!==null&&Im(this.toNode))}},path:{get:function(){var t=this.Pb();return t instanceof Xi?t:null}},routeBounds:{get:function(){this.vg();var t=this.ml,e=1/0,i=1/0,n=this.pointsCount;if(n===0)t.h(NaN,NaN,0,0);else{if(n===1)n=this.i(0),e=Math.min(n.x,e),i=Math.min(n.y,i),t.h(n.x,n.y,0,0);else if(n===2){n=this.i(0);var s=this.i(1);e=Math.min(n.x,s.x),i=Math.min(n.y,s.y),t.h(n.x,n.y,0,0),t.Ye(s)}else if(this.computeCurve()===Qa&&3<=n&&!this.isOrthogonal)if(s=this.i(0),e=s.x,i=s.y,t.h(e,i,0,0),n===3){n=this.i(1),e=Math.min(n.x,e),i=Math.min(n.y,i);var a=this.i(2);e=Math.min(a.x,e),i=Math.min(a.y,i),ht.Dl(s.x,s.y,n.x,n.y,n.x,n.y,a.x,a.y,.5,t)}else for(a=3;a<n;a+=3){var l=this.i(a-2);a+3>=n&&(a=n-1);var c=this.i(a-1),f=this.i(a);ht.Dl(s.x,s.y,l.x,l.y,c.x,c.y,f.x,f.y,.5,t),e=Math.min(f.x,e),i=Math.min(f.y,i),s=f}else for(s=this.i(0),a=this.i(1),e=Math.min(s.x,a.x),i=Math.min(s.y,a.y),t.h(s.x,s.y,0,0),t.Ye(a),s=2;s<n;s++)a=this.i(s),e=Math.min(a.x,e),i=Math.min(a.y,i),t.Ye(a);this.su.h(e-t.x,i-t.y)}return t}},midPoint:{get:function(){return this.vg(),this.computeMidPoint(new z)}},midAngle:{get:function(){return this.vg(),this.computeMidAngle()}},flattenedLengths:{get:function(){if(this.cq===null){this.fd||Qg(this);for(var t=this.cq=[],e=this.pointsCount,i=0;i<e-1;i++){var n=this.i(i),s=this.i(i+1);ht.$(n.x,s.x)?(n=s.y-n.y,0>n&&(n=-n)):ht.$(n.y,s.y)?(n=s.x-n.x,0>n&&(n=-n)):n=Math.sqrt(n.Bf(s)),t.push(n)}}return this.cq}},flattenedTotalLength:{get:function(){var t=this.vt;if(isNaN(t)){for(var e=this.flattenedLengths,i=e.length,n=t=0;n<i;n++)t+=e[n];this.vt=t}return t}},points:{get:function(){return this.Nb},set:function(t){var e=this.Nb;if(e!==t){var i=null;if(Array.isArray(t)){var n=t.length%2===0;if(n){for(var s=0;s<t.length;s++)if(typeof t[s]!="number"||isNaN(t[s])){n=!1;break}}if(n)for(i=new Kt,n=0;n<t.length/2;n++)s=new z(t[2*n],t[2*n+1]).freeze(),i.add(s);else{for(n=!0,s=0;s<t.length;s++){var a=t[s];if(!Tt(a)||typeof a.x!="number"||isNaN(a.x)||typeof a.y!="number"||isNaN(a.y)){n=!1;break}}if(n)for(i=new Kt,n=0;n<t.length;n++)s=t[n],i.add(new z(s.x,s.y).freeze())}}else if(t instanceof Kt)for(i=t.copy(),t=i.iterator;t.next();)t.value.freeze();else lt("Link.points value is not an instance of List or Array: "+t);i.freeze(),this.Nb=i,this.qc(),Qg(this),t=this.diagram,t!==null&&(t.pi||t.undoManager.isUndoingRedoing||t.As.add(this),t.animationManager.zb&&Sa(t.animationManager,this,i)),this.g("points",e,i)}}},pointsCount:{get:function(){return this.Nb.count}},fd:{get:function(){return(this.Qa&16)!==0},set:function(t){(this.Qa&16)!==0!==t&&(this.Qa^=16)}},suspendsRouting:{get:function(){return(this.Qa&32)!==0},set:function(t){(this.Qa&32)!==0!==t&&(this.Qa^=32)}},computingPoints:{get:function(){return(this.Qa&64)!==0},set:function(t){(this.Qa&64)!==0!==t&&(this.Qa^=64)}},defaultFromPoint:{get:function(){return this.o},set:function(t){this.o=t.copy()}},defaultToPoint:{get:function(){return this.u},set:function(t){this.u=t.copy()}},isOrthogonal:{get:function(){return(this.qj.value&2)===2}},isAvoiding:{get:function(){return(this.qj.value&4)===4}},lk:{get:function(){return(this.Qa&128)!==0},set:function(t){(this.Qa&128)!==0!==t&&(this.Qa^=128)}},geometry:{get:function(){if(!this.lk){if(this.vg(),2>this.pointsCount)return this.lk=!0,this.ua;this.ua=this.makeGeometry()}return this.ua}},firstPickIndex:{get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!of(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var t=this.pointsCount;return t===0?0:2>=t?t-1:this.isOrthogonal||!of(this.computeSpot(!1))?t-2:t-1}},adjusting:{get:function(){return this.qk},set:function(t){var e=this.qk;e!==t&&(this.qk=t,this.g("adjusting",e,t))}},corner:{get:function(){return this.Om},set:function(t){var e=this.Om;e!==t&&(this.Om=t,this.qc(),this.g("corner",e,t))}},curve:{get:function(){return this.Qm},set:function(t){var e=this.Qm;e!==t&&(this.Qm=t,this.bb(),this.qc(),ev(this,e===$a||e===yo||t===$a||t===yo),this.g("curve",e,t))}},curviness:{get:function(){return this.Rm},set:function(t){var e=this.Rm;e!==t&&(this.Rm=t,this.bb(),this.qc(),this.g("curviness",e,t))}},routing:{get:function(){return this.qj},set:function(t){var e=this.qj;e!==t&&(this.qj=t,this.Wf=null,this.bb(),ev(this,(e.value&2)===2||(t.value&2)===2),this.g("routing",e,t))}},smoothness:{get:function(){return this.po},set:function(t){var e=this.po;e!==t&&(this.po=t,this.qc(),this.g("smoothness",e,t))}},key:{get:function(){var t=this.diagram;if(t!==null&&t.model.ri())return t.model.Ac(this.data)}}}),ue.prototype.invalidateOtherJumpOvers=ue.prototype.Xo,ue.prototype.findClosestSegment=ue.prototype.ez,ue.prototype.updateRoute=ue.prototype.vg,ue.prototype.invalidateRoute=ue.prototype.bb,ue.prototype.rollbackRoute=ue.prototype.rv,ue.prototype.commitRoute=ue.prototype.zf,ue.prototype.startRoute=ue.prototype.uh,ue.prototype.clearPoints=ue.prototype.Fj,ue.prototype.removePoint=ue.prototype.pv,ue.prototype.addPointAt=ue.prototype.yf,ue.prototype.addPoint=ue.prototype.ne,ue.prototype.insertPointAt=ue.prototype.m,ue.prototype.insertPoint=ue.prototype.Kz,ue.prototype.setPointAt=ue.prototype.L,ue.prototype.setPoint=ue.prototype.dd,ue.prototype.getPoint=ue.prototype.i,ue.prototype.getOtherPort=ue.prototype.Cz,ue.prototype.getOtherNode=ue.prototype.To;var cp=null,af=null,gy=new mt(ue,"Normal",1),iv=new mt(ue,"Orthogonal",2),mx=new mt(ue,"AvoidsNodes",6),vy=new mt(ue,"AvoidsNodesStraight",7),ea=new mt(ue,"None",0),Qa=new mt(ue,"Bezier",9),$a=new mt(ue,"JumpGap",10),yo=new mt(ue,"JumpOver",11),Ka=new mt(ue,"End",17),Es=new mt(ue,"Scale",18),dp=new mt(ue,"Stretch",19),y0=new mt(ue,"OrientAlong",21),lf=new mt(ue,"OrientPlus90",22),zm=new mt(ue,"OrientMinus90",23),yy=new mt(ue,"OrientOpposite",24),nv=new mt(ue,"OrientUpright",25),x0=new mt(ue,"OrientPlus90Upright",26),jm=new mt(ue,"OrientMinus90Upright",27),rv=new mt(ue,"OrientUpright45",28),x1=16,w1=14,$m=8;ue.className="Link",ue.Normal=gy,ue.Orthogonal=iv,ue.AvoidsNodes=mx,ue.AvoidsNodesStraight=vy,ue.None=ea,ue.Bezier=Qa,ue.JumpGap=$a,ue.JumpOver=yo,ue.End=Ka,ue.Scale=Es,ue.Stretch=dp,ue.OrientAlong=y0,ue.OrientPlus90=lf,ue.OrientMinus90=zm,ue.OrientOpposite=yy,ue.OrientUpright=nv,ue.OrientPlus90Upright=x0,ue.OrientMinus90Upright=jm,ue.OrientUpright45=rv,ue.EndSegmentStep=8,ue.CurvinessStart=x1,ue.SpacingMin=w1,ue.OrthoShortCut=$m;function w0(t,e,i,n){vi(this),this.Fe=this.qq=!1,this.Ds=t,this.Ox=e,this.cv=i,this.Px=n,this.links=[]}w0.prototype.Sl=function(){if(!this.qq){var t=this.links;0<t.length&&(t=t[0].diagram,t!==null&&(t.ow.add(this),this.Fe=t.undoManager.isUndoingRedoing))}this.qq=!0},w0.prototype.Nv=function(){if(this.qq){this.qq=!1;var t=this.links;if(0<t.length){var e=t[0],i=e.diagram;i=i===null||i.pi&&!this.Fe,this.Fe=!1,e.arrangeBundledLinks(t,i),t.length===1&&(e.Sf=null,t.length=0)}t.length===0&&(t=this.Ds,this!==null&&t.af!==null&&t.af.remove(this),t=this.cv,this!==null&&t.af!==null&&t.af.remove(this))}},w0.className="LinkBundle";function fp(t){vi(this),this.Yx=this.group=null,this.vs=!0,this.abort=!1,this.Od=this.Nd=1,this.Fn=this.En=-1,this.rc=t.width,this.sc=t.height,this.ac=null,this.ei=this.di=0,this.Os=11,this.Ix=this.Hx=22}fp.prototype.initialize=function(t){if(!(0>=t.width||0>=t.height)){var e=t.y,i=t.x+t.width,n=t.y+t.height;if(this.Nd=Math.floor((t.x-this.rc)/this.rc)*this.rc,this.Od=Math.floor((e-this.sc)/this.sc)*this.sc,this.En=Math.ceil((i+2*this.rc)/this.rc)*this.rc,this.Fn=Math.ceil((n+2*this.sc)/this.sc)*this.sc,t=1+(Math.ceil((this.En-this.Nd)/this.rc)|0),e=1+(Math.ceil((this.Fn-this.Od)/this.sc)|0),this.ac===null||this.di<t-1||this.ei<e-1){for(i=[],n=0;n<=t;n++)i[n]=new Uint32Array(e);this.ac=i,this.di=t-1,this.ei=e-1}if(t=by,this.ac!==null)for(e=0;e<=this.di;e++)if(i=this.ac[e],i.fill)i.fill(t);else for(n=0;n<=this.ei;n++)i[n]=t}};function b0(t,e,i){return t.Nd<=e&&e<=t.En&&t.Od<=i&&i<=t.Fn}function cu(t,e,i){return b0(t,e,i)?(e-=t.Nd,e/=t.rc,i-=t.Od,i/=t.sc,t.ac[e|0][i|0]):by}function b1(t){if(t.ac!==null)for(var e=0;e<=t.di;e++)for(var i=t.ac[e],n=0;n<=t.ei;n++)i[n]>=uf&&(i[n]=by)}fp.prototype.Yj=function(t,e,i,n){if(t>this.En||t+i<this.Nd||e>this.Fn||e+n<this.Od)return!0;t=(t-this.Nd)/this.rc|0,e=(e-this.Od)/this.sc|0,i=Math.max(0,i)/this.rc+1|0;var s=Math.max(0,n)/this.sc+1|0;if(0>t&&(i+=t,t=0),0>e&&(s+=e,e=0),0>i||0>s)return!0;for(n=Math.min(t+i-1,this.di)|0,i=Math.min(e+s-1,this.ei)|0;t<=n;t++){s=this.ac[t];for(var a=e;a<=i;a++)if(s[a]===fh)return!1}return!0};function Gl(t,e,i,n,s,a,l,c,f){if(!(e<a||e>l||i<c||i>f)){var m=e|0,v=i|0,w=t.ac[m][v];if(w>=uf&&w<S0)for(s?v+=n:m+=n,w+=1;a<=m&&m<=l&&c<=v&&v<=f&&!(w>=t.ac[m][v]);)t.ac[m][v]=w,w+=1,s?v+=n:m+=n;if(m=s?v:m,s)if(0<n)for(i+=n;i<m;i+=n)Gl(t,e,i,1,!s,a,l,c,f),Gl(t,e,i,-1,!s,a,l,c,f);else for(i+=n;i>m;i+=n)Gl(t,e,i,1,!s,a,l,c,f),Gl(t,e,i,-1,!s,a,l,c,f);else if(0<n)for(e+=n;e<m;e+=n)Gl(t,e,i,1,!s,a,l,c,f),Gl(t,e,i,-1,!s,a,l,c,f);else for(e+=n;e>m;e+=n)Gl(t,e,i,1,!s,a,l,c,f),Gl(t,e,i,-1,!s,a,l,c,f)}}function ov(t,e,i,n,s,a,l,c,f){e|=0,i|=0;var m=fh,v=uf;for(t.ac[e][i]=v;m===fh&&e>a&&e<l&&i>c&&i<f;)v+=1,t.ac[e][i]=v,s?i+=n:e+=n,m=t.ac[e][i]}function sv(t,e,i,n,s,a,l,c,f){e|=0,i|=0;var m=fh,v=S0;for(t.ac[e][i]=v;m===fh&&e>a&&e<l&&i>c&&i<f;)t.ac[e][i]=v,s?i+=n:e+=n,m=t.ac[e][i]}function xy(t,e,i,n,s,a,l){if(t.ac!==null){t.abort=!1;var c=e.x,f=e.y;if(b0(t,c,f)){c-=t.Nd,c/=t.rc,f-=t.Od,f/=t.sc;var m=n.x,v=n.y;if(b0(t,m,v))if(m-=t.Nd,m/=t.rc,v-=t.Od,v/=t.sc,1>=Math.abs(c-m)&&1>=Math.abs(f-v))t.abort=!0;else{var w=a.x;n=a.y,e=a.x+a.width;var C=a.y+a.height;w-=t.Nd,w/=t.rc,n-=t.Od,n/=t.sc,e-=t.Nd,e/=t.rc,C-=t.Od,C/=t.sc,a=Math.max(0,Math.min(t.di,w|0)),e=Math.min(t.di,Math.max(0,e|0)),w=Math.max(0,Math.min(t.ei,n|0)),C=Math.min(t.ei,Math.max(0,C|0)),n=t.ac,c|=0,f|=0,m|=0,v|=0;var k=i===0||i===90?1:-1;if(i=i===90||i===270,n[c][f]===fh?(ov(t,c,f,k,i,a,e,w,C),ov(t,c,f,1,!i,a,e,w,C),ov(t,c,f,-1,!i,a,e,w,C)):ov(t,c,f,k,i,c,f,c,f),n[m][v]===fh?(sv(t,m,v,s===0||s===90?1:-1,s===90||s===270,a,e,w,C),sv(t,m,v,1,!(s===90||s===270),a,e,w,C),sv(t,m,v,-1,!(s===90||s===270),a,e,w,C)):sv(t,m,v,k,i,m,v,m,v),i=Pe(),l&&wy(t,m,v,s,c,f,i))for((i[0]!==m||i[1]!==v)&&(i.unshift(v),i.unshift(m)),(i[i.length-2]!==c||i[i.length-1]!==f)&&(i.push(c),i.push(f)),t=uf,s=i[i.length-2],l=i[i.length-1],n[s][l]=t++,a=i.length-4;0<=a;a-=2)for(s=i[a+2],l=i[a+3],e=i[a],m=i[a+1];e>s?s++:e<s?s--:m>l?l++:m<l&&l--,n[s][l]=t++,s!==e||l!==m;);else Gl(t,c,f,1,!1,a,e,w,C),Gl(t,c,f,-1,!1,a,e,w,C),Gl(t,c,f,1,!0,a,e,w,C),Gl(t,c,f,-1,!0,a,e,w,C);qe(i)}}}}function wy(t,e,i,n,s,a,l){for(var c=t.ac,f=e,m=i;;){if(f===s&&m===a)return!0;var v=f,w=m;if(n===0)if(v<s)v++;else break;else if(n===90)if(w<a)w++;else break;else if(n===180)if(v>s)v--;else break;else if(w>a)w--;else break;var C=c[v][w];if(C===0||C===hf)break;f=v,m=w}for(;;){if(v=n,w=f,C=m,n===0?C<a?(v=90,C++):C>a&&(v=270,C--):n===90?w<s?(v=0,w++):w>s&&(v=180,w--):n===180?C<a?(v=90,C++):C>a&&(v=270,C--):w<s?(v=0,w++):w>s&&(v=180,w--),w=c[w][C],v!==n&&w!==0&&w!==hf){if(l.push(f),l.push(m),wy(t,f,m,v,s,a,l))return!0;l.pop(),l.pop()}if(c[f][m]=hf,n===0){if(f===e)return!1;f--}else if(n===90){if(m===i)return!1;m--}else if(n===180){if(f===e)return!1;f++}else{if(m===i)return!1;m++}}}ct.Object.defineProperties(fp.prototype,{bounds:{get:function(){return new It(this.Nd,this.Od,this.En-this.Nd,this.Fn-this.Od)}},Ho:{get:function(){return this.rc},set:function(t){0<t&&t!==this.rc&&(this.rc=t,this.initialize(this.bounds))}},Go:{get:function(){return this.sc},set:function(t){0<t&&t!==this.sc&&(this.sc=t,this.initialize(this.bounds))}}});var fh=0,uf=1,S0=999999,by=S0+1,hf=S0+2;fp.className="PositionArray";function Nl(){vi(this),this.port=this.node=null,this.pe=[],this.ap=!1}Nl.prototype.toString=function(){for(var t=this.pe,e=this.node.toString()+" "+t.length.toString()+":",i=0;i<t.length;i++){var n=t[i];n!==null&&(e+=`
`+n.toString())}return e};function Sy(t,e,i,n){switch(e=e.offsetY,e){case 8:return 90;case 2:return 180;case 1:return 270;case 4:return 0}switch(e){case 9:return 180<i?270:90;case 6:return 90<i&&270>=i?180:0}switch(t=180*Math.atan2(t.height,t.width)/Math.PI,e){case 3:return i>t&&i<=180+t?180:270;case 5:return i>180-t&&i<=360-t?270:0;case 12:return i>t&&i<=180+t?90:0;case 10:return i>180-t&&i<=360-t?180:90;case 7:return 90<i&&i<=180+t?180:i>180+t&&i<=360-t?270:0;case 13:return 180<i&&i<=360-t?270:i>t&&180>=i?90:0;case 14:return i>t&&i<=180-t?90:i>180-t&&270>=i?180:0;case 11:return i>180-t&&i<=180+t?180:i>180+t?270:90}return n&&e!==15&&(i-=15,0>i&&(i+=360)),i>t&&i<180-t?90:i>=180-t&&i<=180+t?180:i>180+t&&i<360-t?270:0}Nl.prototype.Sl=function(){this.pe.length=0};function av(t,e){var i=t.pe;if(i.length===0){t:if(!t.ap){i=t.ap,t.ap=!0;var n=null,s=t.node,a=s instanceof ji?s:null;if(a===null||a.isSubGraphExpanded)var l=s.isTreeExpanded?s.findLinksConnected(t.port.portId):s.qx();else{if(!a.actualBounds.w()){t.ap=i;break t}n=a,l=n.Lu()}a=t.pe.length=0;var c=t.port.ga(An,z.alloc()),f=t.port.ga(Go,z.alloc());for(s=It.allocAt(c.x,c.y,0,0),s.Ye(f),z.free(c),z.free(f),c=z.allocAt(s.x+s.width/2,s.y+s.height/2),f=t.port.li(),l=l.iterator;l.next();){var m=l.value;if(m.isVisible()&&m.fromPort!==m.toPort){var v=m.fromPort===t.port||m.fromNode!==null&&m.fromNode.Td(n),w=m.computeSpot(v,t.port);if(w.$c()&&(v=v?m.toPort:m.fromPort,v!==null)){var C=v.part;if(C!==null){var k=C.findVisibleNode();k!==null&&k!==C&&(C=k,v=C.port),v=m.computeOtherPoint(C,v),C=c.ab(v),C-=f,0>C?C+=360:360<=C&&(C-=360),w=Sy(s,w,C,m.isOrthogonal),w===0?(w=4,180<C&&(C-=360)):w===90?(w=8,270<C&&(C-=360)):w===180?w=2:(w=1,90>C&&(C+=360)),k=t.pe[a],k===void 0?(k=new lv(m,C,w),t.pe[a]=k):(k.link=m,k.angle=C,k.Nc=w),k.hv.set(v),a++}}}}for(z.free(c),t.pe.sort(Nl.prototype.j),f=t.pe.length,n=-1,a=c=0;a<f;a++)l=t.pe[a],l!==void 0&&(l.Nc!==n&&(n=l.Nc,c=0),l.Uo=c,c++);for(n=-1,c=0,a=f-1;0<=a;a--)f=t.pe[a],f!==void 0&&(f.Nc!==n&&(n=f.Nc,c=f.Uo+1),f.Gl=c);if(a=t.pe,w=t.port,n=t.node.portSpreading,c=z.alloc(),f=z.alloc(),l=z.alloc(),m=z.alloc(),w.ga(An,c),w.ga(Io,f),w.ga(Go,l),w.ga(Ys,m),k=C=v=w=0,n===ld)for(var L=0;L<a.length;L++){var A=a[L];if(A!==null){var H=A.link.computeThickness();switch(A.Nc){case 8:C+=H;break;case 2:k+=H;break;case 1:w+=H;break;default:case 4:v+=H}}}var R=L=0,X=1,Y=A=0;for(H=0;H<a.length;H++){var tt=a[H];if(tt!==null){if(L!==tt.Nc){switch(L=tt.Nc,L){case 8:var st=l;R=m;break;case 2:st=m,R=c;break;case 1:st=c,R=f;break;default:case 4:st=f,R=l}switch(A=R.x-st.x,Y=R.y-st.y,L){case 8:C>Math.abs(A)?(X=Math.abs(A)/C,C=Math.abs(A)):X=1;break;case 2:k>Math.abs(Y)?(X=Math.abs(Y)/k,k=Math.abs(Y)):X=1;break;case 1:w>Math.abs(A)?(X=Math.abs(A)/w,w=Math.abs(A)):X=1;break;default:case 4:v>Math.abs(Y)?(X=Math.abs(Y)/v,v=Math.abs(Y)):X=1}R=0}var bt=tt.Zo;if(n===ld){switch(tt=tt.link.computeThickness(),tt*=X,bt.set(st),L){case 8:bt.x=st.x+A/2+C/2-R-tt/2;break;case 2:bt.y=st.y+Y/2+k/2-R-tt/2;break;case 1:bt.x=st.x+A/2-w/2+R+tt/2;break;default:case 4:bt.y=st.y+Y/2-v/2+R+tt/2}R+=tt}else{var Te=.5;n===up&&(Te=(tt.Uo+1)/(tt.Gl+1)),bt.x=st.x+A*Te,bt.y=st.y+Y*Te}}}for(z.free(c),z.free(f),z.free(l),z.free(m),st=t.pe,a=0;a<st.length;a++)n=st[a],n!==null&&(n.Ju=t.computeEndSegmentLength(n));t.ap=i,It.free(s)}i=t.pe}for(t=0;t<i.length;t++)if(s=i[t],s!==null&&s.link===e)return s;return null}Nl.prototype.j=function(t,e){return t===e?0:t===null?-1:e===null?1:t.Nc<e.Nc?-1:t.Nc>e.Nc?1:t.angle<e.angle?-1:t.angle>e.angle?1:0},Nl.prototype.computeEndSegmentLength=function(t){var e=t.link,i=e.computeEndSegmentLength(this.node,this.port,Nn,e.fromPort===this.port),n=t.Uo;if(0>n)return i;var s=t.Gl;if(1>=s||!e.isOrthogonal)return i;e=t.hv;var a=t.Zo;return(t.Nc===2||t.Nc===8)&&(n=s-1-n),((t=t.Nc===2||t.Nc===4)?e.y<a.y:e.x<a.x)?i+8*n:(t?e.y===a.y:e.x===a.x)?i:i+8*(s-1-n)},Nl.className="Knot";function lv(t,e,i){this.link=t,this.angle=e,this.Nc=i,this.hv=new z,this.Gl=this.Uo=0,this.Zo=new z,this.Ju=0}lv.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Nc.toString()+":"+this.Uo.toString()+"/"+this.Gl.toString()+" "+this.Zo.toString()+" "+this.Ju.toString()+" "+this.hv.toString()},lv.className="LinkInfo";function pr(t){vi(this),this.o=this.H=null,this.Gh=this.sn=!0,this.yn=!1,this.Am=new z(0,0).freeze(),this.vn=!0,this.Em=this.un=null,this.xn=!1,this.j=null,t&&Object.assign(this,t)}pr.prototype.cloneProtected=function(t){t.sn=this.sn,t.Gh=this.Gh,t.yn=this.yn,t.Am.assign(this.Am),t.vn=this.vn,t.un=this.un,t.Em=this.Em,t.xn=!0},pr.prototype.copy=function(){var t=new this.constructor;return this.cloneProtected(t),t},pr.prototype.qb=function(){},pr.prototype.toString=function(){var t=Re(this.constructor);return t+="(",this.group!==null&&(t+=" in "+this.group),this.diagram!==null&&(t+=" for "+this.diagram),t+")"},pr.prototype.C=function(){if(this.isValidLayout){var t=this.diagram;if(t!==null&&!t.undoManager.isUndoingRedoing){var e=t.animationManager;!e.isTicking&&(e.defaultAnimation.isAnimating&&e.Cc(),this.isOngoing&&t.pi||this.isInitial&&!t.pi)&&(this.isValidLayout=!1,t.$b())}}},pr.prototype.createNetwork=function(){return new nr(this)},pr.prototype.makeNetwork=function(t){var e=this.createNetwork();return t instanceof wt?(e.lg(t.nodes,!0),e.lg(t.links,!0)):t instanceof ji?e.lg(t.memberParts):e.lg(t.iterator),e},pr.prototype.updateParts=function(){this.isValidLayout=!0;var t=this.diagram;if(t===null&&this.network!==null)for(var e=this.network.vertexes.iterator;e.next();){var i=e.value.node;if(i!==null&&(t=i.diagram,t!==null))break}try{t!==null&&t.Ea("Layout"),this.commitLayout()}finally{t!==null&&t.eb("Layout")}},pr.prototype.commitLayout=function(){if(this.network!==null){for(var t=this.network.vertexes.iterator;t.next();)t.value.commit();if(this.isRouting)for(t=this.network.edges.iterator;t.next();)t.value.commit()}},pr.prototype.doLayout=function(t){var e=new At;t instanceof wt?(Lc(this,e,t.nodes,!0,this.rh,!0,!1,!0),Lc(this,e,t.parts,!0,this.rh,!0,!1,!0)):t instanceof ji?Lc(this,e,t.memberParts,!1,this.rh,!0,!1,!0):e.addAll(t.iterator),0<e.count&&(t=this.diagram,t!==null&&t.Ea("Layout"),this.doMinimalNoNetworkLayout(e),t!==null&&t.eb("Layout")),this.isValidLayout=!0},pr.prototype.doMinimalNoNetworkLayout=function(t){var e=Math.ceil(Math.sqrt(t.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var i=this.arrangementOrigin.x,n=i,s=this.arrangementOrigin.y,a=0,l=0;for(t=t.iterator;t.next();){var c=t.value;M0(c);var f=c.measuredBounds,m=f.width;f=f.height,c.moveTo(n,s),c instanceof ji&&(c.rh=!1),n+=Math.max(m,50)+20,l=Math.max(l,Math.max(f,50)),a>=e-1?(a=0,n=i,s+=l+20,l=0):a++}},pr.prototype.doMinimalNetworkLayout=function(){var t=Math.ceil(Math.sqrt(this.network.vertexes.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);for(var e=this.arrangementOrigin.x,i=e,n=this.arrangementOrigin.y,s=0,a=0,l=this.network.vertexes.iterator;l.next();){var c=l.value.node;if(!(c===null||c instanceof ue)&&(M0(c),this.rh(c))){var f=c.measuredBounds,m=f.width;f=f.height,c.moveTo(i,n),c instanceof ji&&(c.rh=!1),i+=Math.max(m,50)+20,a=Math.max(a,Math.max(f,50)),s>=t-1?(s=0,i=e,n+=a+20,a=0):s++}}},pr.prototype.rh=function(t){return!!(!t.location.w()||t instanceof ji&&t.rh)};function Lc(t,e,i,n,s,a,l,c){for(i=i.iterator;i.next();){var f=i.value;n&&!f.isTopLevel||s!==null&&!s(f)||!f.canLayout()||(a&&f instanceof Le?f.isLinkLabel||(f instanceof ji&&f.layout===null?Lc(t,e,f.memberParts,!1,s,a,l,c):(M0(f),e.add(f))):l&&f instanceof ue?e.add(f):!c||!f.Zc()||f instanceof Le||(M0(f),e.add(f)))}}function M0(t){var e=t.actualBounds;(e.width===0||e.height===0||isNaN(e.width)||isNaN(e.height))&&t.Va()}pr.prototype.ni=function(t,e){var i=this.boundsComputation;return i!==null?(e||(e=new It),i(t,this,e)):e?(e.set(t.actualBounds),e):t.actualBounds},pr.prototype.ex=function(t){var e=new At;return t instanceof wt?(Lc(this,e,t.nodes,!0,null,!0,!0,!0),Lc(this,e,t.links,!0,null,!0,!0,!0),Lc(this,e,t.parts,!0,null,!0,!0,!0)):t instanceof ji?Lc(this,e,t.memberParts,!1,null,!0,!0,!0):Lc(this,e,t.iterator,!1,null,!0,!0,!0),e},pr.prototype.initialOrigin=function(t){var e=this.group;if(e!==null){var i=e.position.copy();return(isNaN(i.x)||isNaN(i.y))&&i.set(t),e=e.placeholder,e!==null&&(i=e.ga(An),(isNaN(i.x)||isNaN(i.y))&&i.set(t),t=e.padding,i.x+=t.left,i.y+=t.top),i}return t},ct.Object.defineProperties(pr.prototype,{diagram:{get:function(){return this.H},set:function(t){this.H=t}},group:{get:function(){return this.o},set:function(t){this.o!==t&&(this.o=t,t!==null&&(this.H=t.diagram))}},isOngoing:{get:function(){return this.sn},set:function(t){this.sn!==t&&(this.sn=t)}},isInitial:{get:function(){return this.Gh},set:function(t){this.Gh=t,t||(this.xn=!0)}},isViewportSized:{get:function(){return this.yn},set:function(t){this.yn!==t&&(this.yn=t)&&this.C()}},isRouting:{get:function(){return this.vn},set:function(t){this.vn!==t&&(this.vn=t)}},isRealtime:{get:function(){return this.un},set:function(t){this.un!==t&&(this.un=t)}},isValidLayout:{get:function(){return this.xn},set:function(t){this.xn!==t&&(this.xn=t,t||(t=this.diagram,t!==null&&(t.xh=!0)))}},network:{get:function(){return this.j},set:function(t){this.j!==t&&(this.j=t,t!==null&&(t.layout=this))}},boundsComputation:{get:function(){return this.Em},set:function(t){this.Em!==t&&(this.Em=t,this.C())}},arrangementOrigin:{get:function(){return this.Am},set:function(t){this.Am.D(t)||(this.Am.assign(t),this.C())}}}),pr.prototype.collectParts=pr.prototype.ex,pr.prototype.getLayoutBounds=pr.prototype.ni,pr.prototype.invalidateLayout=pr.prototype.C,pr.className="Layout";function nr(t){vi(this),this.Sc=t,this.wf=new At,this.ye=new At,this.Es=new pe,this.zs=new pe}nr.prototype.clear=function(){if(this.wf)for(var t=this.wf.iterator;t.next();)t.value.clear();if(this.ye)for(t=this.ye.iterator;t.next();)t.value.clear();this.wf=new At,this.ye=new At,this.Es=new pe,this.zs=new pe},nr.prototype.toString=function(t){t===void 0&&(t=0);var e="LayoutNetwork"+(this.layout!==null?"("+this.layout.toString()+")":"");if(0>=t)return e;if(e+=" vertexes: "+this.wf.count+" edges: "+this.ye.count,1<t){for(var i=this.wf.iterator;i.next();)e+=`
`+i.value.toString(t-1);for(i=this.ye.iterator;i.next();)e+=`
`+i.value.toString(t-1)}return e},nr.prototype.createVertex=function(){return new lo(this)},nr.prototype.createEdge=function(){return new Na(this)},nr.prototype.lg=function(t,e,i){if(t!==null){for(e===void 0&&(e=!1),i===void 0&&(i=null),i===null&&(i=function(l){if(l instanceof Le)return!l.isLinkLabel;if(l instanceof ue){var c=l.fromNode;return c===null||c.isLinkLabel?!1:(l=l.toNode,!(l===null||l.isLinkLabel))}return!1}),t=t.iterator;t.next();){var n=t.value;if(n instanceof Le&&(!e||n.isTopLevel)&&n.canLayout()&&i(n)){if(n instanceof ji&&n.layout===null)this.lg(n.memberParts,!1);else if(this.ki(n)===null){var s=this.createVertex();s.node=n,this.dh(s)}}}for(t.reset();t.next();)if(n=t.value,n instanceof ue&&(!e||n.isTopLevel)&&n.canLayout()&&i(n)&&this.Lo(n)===null){var a=n.fromNode;s=n.toNode,a!==null&&s!==null&&a!==s&&(a=this.findGroupVertex(a),s=this.findGroupVertex(s),a!==null&&s!==null&&this.Zj(a,s,n))}}},nr.prototype.findGroupVertex=function(t){if(t===null)return null;var e=t.findVisibleNode();if(e===null)return null;if(t=this.ki(e),t!==null)return t;for(e=e.containingGroup;e!==null;){if(t=this.ki(e),t!==null)return t;e=e.containingGroup}return null},T=nr.prototype,T.dh=function(t){if(t!==null){this.wf.add(t);var e=t.node;e!==null&&this.Es.add(e,t),t.network=this}},T.Bl=function(t){if(t===null)return null;var e=this.ki(t);return e===null&&(e=this.createVertex(),e.node=t,this.dh(e)),e},T.Iu=function(t){if(t!==null&&pp(this,t)){for(var e=t.tg,i=e.count-1;0<=i;i--){var n=e.M(i);this.Mj(n)}for(e=t.mg,t=e.count-1;0<=t;t--)i=e.M(t),this.Mj(i)}};function pp(t,e){if(e===null)return!1;var i=t.wf.remove(e);return i&&(e=e.node,e!==null&&t.Es.remove(e)),i}T.Zy=function(t){t!==null&&(t=this.ki(t),t!==null&&this.Iu(t))},T.ki=function(t){return t===null?null:this.Es.I(t)},T.Bo=function(t){if(t!==null){uv(this,t);var e=t.toVertex;e!==null&&e.Cl(t),e=t.fromVertex,e!==null&&e.zl(t)}};function uv(t,e){if(e!==null){t.ye.add(e);var i=e.link;i!==null&&t.Lo(i)===null&&t.zs.add(i,e),e.network=t}}T.Dy=function(t){if(t===null)return null;var e=t.fromNode,i=t.toNode,n=this.Lo(t);return n===null?(n=this.createEdge(),n.link=t,e!==null&&(n.fromVertex=this.Bl(e)),i!==null&&(n.toVertex=this.Bl(i)),this.Bo(n)):(e!==null?n.fromVertex=this.Bl(e):n.fromVertex=null,i!==null?n.toVertex=this.Bl(i):n.toVertex=null),n},T.Mj=function(t){if(t!==null){var e=t.toVertex;e!==null&&e.Kl(t),e=t.fromVertex,e!==null&&e.Jl(t),hv(this,t)}};function hv(t,e){e!==null&&t.ye.remove(e)&&(e=e.link,e!==null&&t.zs.remove(e))}T.Yy=function(t){t!==null&&(t=this.Lo(t),t!==null&&this.Mj(t))},T.Lo=function(t){return t===null?null:this.zs.I(t)},T.Zj=function(t,e,i){if(t===null||e===null)return null;if(t.network===this&&e.network===this){var n=this.createEdge();return n.link=i,n.fromVertex=t,n.toVertex=e,this.Bo(n),n}return null},T.gm=function(t){if(t!==null){var e=t.fromVertex,i=t.toVertex;e!==null&&i!==null&&(e.Jl(t),i.Kl(t),t.gm(),e.Cl(t),i.zl(t))}},T.Ko=function(){for(var t=Pe(),e=this.ye.iterator;e.next();){var i=e.value;i.fromVertex===i.toVertex&&t.push(i)}for(e=t.length,i=0;i<e;i++)this.Mj(t[i]);qe(t)},nr.prototype.deleteArtificialVertexes=function(){for(var t=Pe(),e=this.wf.iterator;e.next();){var i=e.value;i.node===null&&i.data===null&&t.push(i)}for(i=t.length,e=0;e<i;e++)this.Iu(t[e]);for(e=Pe(),i=this.ye.iterator;i.next();){var n=i.value;n.link===null&&n.data===null&&e.push(n)}for(i=e.length,n=0;n<i;n++)this.Mj(e[n]);qe(t),qe(e)};function gx(t){for(var e=Pe(),i=t.ye.iterator;i.next();){var n=i.value;n.fromVertex!==null&&n.toVertex!==null||e.push(n)}for(i=e.length,n=0;n<i;n++)t.Mj(e[n]);qe(e)}nr.prototype.Zx=function(t){t===void 0&&(t=!0),t&&(this.deleteArtificialVertexes(),gx(this),this.Ko()),t=new Kt;for(var e=!0;e;){e=!1;for(var i=this.wf.iterator;i.next();){var n=i.value;if(0<n.tg.count||0<n.mg.count){e=this.layout.createNetwork(),t.add(e),cv(this,e,n),e=!0;break}}}return t.sort(function(s,a){return s===null||a===null||s===a?0:a.vertexes.count-s.vertexes.count}),t};function cv(t,e,i){if(i!==null&&i.network!==e){pp(t,i),e.dh(i);for(var n=i.sourceEdges;n.next();){var s=n.value;s.network!==e&&(hv(t,s),uv(e,s),cv(t,e,s.fromVertex))}for(n=i.destinationEdges;n.next();)i=n.value,i.network!==e&&(hv(t,i),uv(e,i),cv(t,e,i.toVertex))}}nr.prototype.dz=function(){for(var t=new At,e=this.wf.iterator;e.next();)t.add(e.value.node);for(e=this.ye.iterator;e.next();)t.add(e.value.link);return t},ct.Object.defineProperties(nr.prototype,{layout:{get:function(){return this.Sc},set:function(t){t!==null&&(this.Sc=t)}},vertexes:{get:function(){return this.wf}},edges:{get:function(){return this.ye}}}),nr.prototype.findAllParts=nr.prototype.dz,nr.prototype.splitIntoSubNetworks=nr.prototype.Zx,nr.prototype.deleteSelfEdges=nr.prototype.Ko,nr.prototype.reverseEdge=nr.prototype.gm,nr.prototype.linkVertexes=nr.prototype.Zj,nr.prototype.findEdge=nr.prototype.Lo,nr.prototype.deleteLink=nr.prototype.Yy,nr.prototype.deleteEdge=nr.prototype.Mj,nr.prototype.addLink=nr.prototype.Dy,nr.prototype.addEdge=nr.prototype.Bo,nr.prototype.findVertex=nr.prototype.ki,nr.prototype.deleteNode=nr.prototype.Zy,nr.prototype.deleteVertex=nr.prototype.Iu,nr.prototype.addNode=nr.prototype.Bl,nr.prototype.addVertex=nr.prototype.dh,nr.prototype.addParts=nr.prototype.lg,nr.className="LayoutNetwork";function lo(t){vi(this),this.ob=t,this.j=new It(0,0,10,10).freeze(),this.o=new z(5,5).freeze(),this.Sh=this.ub=null,this.tg=new Kt,this.mg=new Kt}lo.prototype.clear=function(){this.Sh=this.ub=null,this.tg=new Kt,this.mg=new Kt},lo.prototype.toString=function(t){t===void 0&&(t=0);var e="LayoutVertex#"+Ti(this);if(0<t&&(e+=this.node!==null?"("+this.node.toString()+")":"",1<t)){t="";for(var i=!0,n=this.tg.iterator;n.next();){var s=n.value;i?i=!1:t+=",",t+=s.toString(0)}for(s="",i=!0,n=this.mg.iterator;n.next();){var a=n.value;i?i=!1:s+=",",s+=a.toString(0)}e+=" sources: "+t+" destinations: "+s}return e},lo.prototype.commit=function(){var t=this.ub;if(t!==null){var e=this.bounds,i=t.bounds;Tt(i)?(i.x=e.x,i.y=e.y,i.width=e.width,i.height=e.height):t.bounds=e.copy()}else if(t=this.node,t!==null){if(e=this.bounds,!(t instanceof ji)){i=It.alloc(),t.Va();var n=this.network.layout.ni(t,i),s=t.locationObject.ga(on);if(n.w()&&s.w()){t.moveTo(e.x+this.focusX-(s.x-n.x),e.y+this.focusY-(s.y-n.y)),It.free(i);return}It.free(i)}t.moveTo(e.x,e.y)}},lo.prototype.Cl=function(t){t!==null&&(this.tg.contains(t)||this.tg.add(t))},lo.prototype.Kl=function(t){t!==null&&this.tg.remove(t)},lo.prototype.zl=function(t){t!==null&&(this.mg.contains(t)||this.mg.add(t))},lo.prototype.Jl=function(t){t!==null&&this.mg.remove(t)};function My(t,e){return t=t.Sh,e=e.Sh,t?e?(t=t.text,e=e.text,t<e?-1:t>e?1:0):1:e!==null?-1:0}ct.Object.defineProperties(lo.prototype,{sourceEdgesArrayAccess:{get:function(){return this.tg._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.mg._dataArray}},data:{get:function(){return this.ub},set:function(t){if(this.ub=t,t!==null&&t.bounds){var e=t.bounds;t=e.x;var i=e.y,n=e.width;e=e.height,this.o.h(n/2,e/2),this.j.h(t,i,n,e)}}},node:{get:function(){return this.Sh},set:function(t){if(this.Sh!==t){this.Sh=t,t.Va();var e=this.network.layout,i=It.alloc(),n=e.ni(t,i);e=n.x;var s=n.y,a=n.width;if(n=n.height,isNaN(e)&&(e=0),isNaN(s)&&(s=0),this.j.h(e,s,a,n),It.free(i),!(t instanceof ji)&&(t=t.locationObject.ga(on),t.w())){this.o.h(t.x-e,t.y-s);return}this.o.h(a/2,n/2)}}},bounds:{get:function(){return this.j},set:function(t){this.j.D(t)||this.j.assign(t)}},focus:{get:function(){return this.o},set:function(t){this.o.D(t)||this.o.assign(t)}},centerX:{get:function(){return this.j.x+this.o.x},set:function(t){var e=this.j;e.x+this.o.x!==t&&(e.ka(),e.x=t-this.o.x,e.freeze())}},centerY:{get:function(){return this.j.y+this.o.y},set:function(t){var e=this.j;e.y+this.o.y!==t&&(e.ka(),e.y=t-this.o.y,e.freeze())}},focusX:{get:function(){return this.o.x},set:function(t){var e=this.o;e.x!==t&&(e.ka(),e.x=t,e.freeze())}},focusY:{get:function(){return this.o.y},set:function(t){var e=this.o;e.y!==t&&(e.ka(),e.y=t,e.freeze())}},x:{get:function(){return this.j.x},set:function(t){var e=this.j;e.x!==t&&(e.ka(),e.x=t,e.freeze())}},y:{get:function(){return this.j.y},set:function(t){var e=this.j;e.y!==t&&(e.ka(),e.y=t,e.freeze())}},width:{get:function(){return this.j.width},set:function(t){var e=this.j;e.width!==t&&(e.ka(),e.width=t,e.freeze())}},height:{get:function(){return this.j.height},set:function(t){var e=this.j;e.height!==t&&(e.ka(),e.height=t,e.freeze())}},network:{get:function(){return this.ob},set:function(t){this.ob=t}},sourceVertexes:{get:function(){for(var t=new At,e=this.sourceEdges;e.next();)t.add(e.value.fromVertex);return t.iterator}},destinationVertexes:{get:function(){for(var t=new At,e=this.destinationEdges;e.next();)t.add(e.value.toVertex);return t.iterator}},vertexes:{get:function(){for(var t=new At,e=this.sourceEdges;e.next();)t.add(e.value.fromVertex);for(e=this.destinationEdges;e.next();)t.add(e.value.toVertex);return t.iterator}},sourceEdges:{get:function(){return this.tg.iterator}},destinationEdges:{get:function(){return this.mg.iterator}},edges:{get:function(){for(var t=new Kt,e=this.sourceEdges;e.next();)t.add(e.value);for(e=this.destinationEdges;e.next();)t.add(e.value);return t.iterator}},edgesCount:{get:function(){return this.tg.count+this.mg.count}}}),lo.prototype.deleteDestinationEdge=lo.prototype.Jl,lo.prototype.addDestinationEdge=lo.prototype.zl,lo.prototype.deleteSourceEdge=lo.prototype.Kl,lo.prototype.addSourceEdge=lo.prototype.Cl,lo.className="LayoutVertex",lo.standardComparer=My,lo.smartComparer=function(t,e){if(t!==null){if(e!==null){t=t.Sh;var i=e.Sh;if(t!==null){if(i!==null){for(e=t.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),t=i.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),i=0;i<e.length;i++)if(t[i]!==""&&t[i]!==void 0){var n=parseFloat(e[i]),s=parseFloat(t[i]);if(isNaN(n))if(isNaN(s)){if(e[i].localeCompare(t[i])!==0)return e[i].localeCompare(t[i])}else return 1;else{if(isNaN(s))return-1;if(n-s!==0)return n-s}}else if(e[i]!=="")return 1;return t[i]!==""&&t[i]!==void 0?-1:0}return 1}return i!==null?-1:0}return 1}return e!==null?-1:0};function Na(t){vi(this),this.nb=t,this.qd=this.kd=this.$k=this.ub=null}Na.prototype.clear=function(){this.qd=this.kd=this.$k=this.ub=null},Na.prototype.toString=function(t){t===void 0&&(t=0);var e="LayoutEdge#"+Ti(this);return 0<t&&(e+=this.$k!==null?"("+this.$k.toString()+")":"",1<t&&(e+=" "+(this.kd?this.kd.toString():"null")+" --> "+(this.qd?this.qd.toString():"null"))),e},Na.prototype.gm=function(){var t=this.kd;this.kd=this.qd,this.qd=t},Na.prototype.commit=function(){},Na.prototype.Ax=function(t){return this.qd===t?this.kd:this.kd===t?this.qd:null},ct.Object.defineProperties(Na.prototype,{network:{get:function(){return this.nb},set:function(t){this.nb=t}},data:{get:function(){return this.ub},set:function(t){this.ub!==t&&(this.ub=t)}},link:{get:function(){return this.$k},set:function(t){this.$k!==t&&(this.$k=t)}},fromVertex:{get:function(){return this.kd},set:function(t){this.kd!==t&&(this.kd=t)}},toVertex:{get:function(){return this.qd},set:function(t){this.qd!==t&&(this.qd=t)}}}),Na.prototype.getOtherVertex=Na.prototype.Ax,Na.className="LayoutEdge";function es(t){pr.call(this),this.isViewportSized=!0,this.yo=this.zo=NaN,this.yg=new ii(NaN,NaN).freeze(),this.tf=new ii(10,10).freeze(),this.Jb=C0,this.Rb=mp,this.nd=Hm,this.hd=Cy,t&&Object.assign(this,t)}gi(es,pr),es.prototype.cloneProtected=function(t){pr.prototype.cloneProtected.call(this,t),t.zo=this.zo,t.yo=this.yo,t.yg.assign(this.yg),t.tf.assign(this.tf),t.Jb=this.Jb,t.Rb=this.Rb,t.nd=this.nd,t.hd=this.hd},es.prototype.qb=function(t){t.classType===es?t===Hm||t===fv||t===Mo||t===dv?this.sorting=t:t===mp||t===gl?this.arrangement=t:t===C0||t===Km?this.alignment=t:lt("Unknown enum value: "+t):pr.prototype.qb.call(this,t)},es.prototype.doLayout=function(t){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var e=this.ex(t);t=this.diagram;for(var i=e.copy().iterator;i.next();){var n=i.value;if(!n.ph()||n.fromNode===null&&n.toNode===null){if(n.Va(),n instanceof ji)for(n=n.memberParts;n.next();)e.remove(n.value)}else e.remove(n)}var s=e.Fa();if(s.length!==0){switch(this.sorting){case dv:s.reverse();break;case Hm:s.sort(this.comparer);break;case fv:s.sort(this.comparer),s.reverse()}var a=this.wrappingColumn;isNaN(a)&&(a=0);var l=this.wrappingWidth;switch(isNaN(l)&&t!==null?(e=t.padding,l=Math.max(t.viewportBounds.width-e.left-e.right,0)):l=Math.max(this.wrappingWidth,0),0>=a&&0>=l&&(a=1),e=this.spacing.width,isFinite(e)||(e=0),i=this.spacing.height,isFinite(i)||(i=0),t!==null&&t.Ea("Layout"),n=[],this.alignment){case Km:var c=e,f=i,m=It.alloc(),v=Math.max(this.cellSize.width,1);if(!isFinite(v))for(var w=v=0;w<s.length;w++){var C=this.ni(s[w],m);v=Math.max(v,C.width)}if(v=Math.max(v+c,1),w=Math.max(this.cellSize.height,1),!isFinite(w))for(C=w=0;C<s.length;C++){var k=this.ni(s[C],m);w=Math.max(w,k.height)}w=Math.max(w+f,1),C=this.arrangement;for(var L=k=this.arrangementOrigin.x,A=this.arrangementOrigin.y,H=0,R=0,X=0;X<s.length;X++){var Y=s[X],tt=this.ni(Y,m),st=Math.ceil((tt.width+c)/v)*v,bt=Math.ceil((tt.height+f)/w)*w;switch(C){case gl:var Te=Math.abs(L-tt.width);break;default:Te=L+tt.width}switch((0<a&&H>a-1||0<l&&0<H&&Te-k>l)&&(n.push(new It(0,A,l+c,R)),H=0,L=k,A+=R,R=0),R=Math.max(R,bt),C){case gl:tt=-tt.width;break;default:tt=0}switch(Y.moveTo(L+tt,A),C){case gl:L-=st;break;default:L+=st}H++}n.push(new It(0,A,l+c,R)),It.free(m);break;case C0:for(f=l,v=a,w=e,C=i,l=It.alloc(),k=Math.max(this.cellSize.width,1),a=A=m=0,c=z.alloc(),L=0;L<s.length;L++)R=s[L],H=this.ni(R,l),R=ch(R,R.locationObject,R.locationSpot,c),m=Math.max(m,R.x),A=Math.max(A,H.width-R.x),a=Math.max(a,R.y);switch(L=this.arrangement,L){case gl:m+=w;break;default:A+=w}k=isFinite(k)?Math.max(k+w,1):Math.max(m+A,1);var Ke=R=this.arrangementOrigin.x;for(X=this.arrangementOrigin.y,A=0,f>=m&&(f-=m),m=Y=0,st=Math.max(this.cellSize.height,1),tt=a=0,bt=!0,H=z.alloc(),Te=0;Te<s.length;Te++){var Oe=s[Te],he=this.ni(Oe,l),Gt=ch(Oe,Oe.locationObject,Oe.locationSpot,c);if(0<A)switch(L){case gl:Ke=(Ke-R-(he.width-Gt.x))/k,Ke=ht.$(Math.round(Ke),Ke)?Math.round(Ke):Math.floor(Ke),Ke=Ke*k+R;break;default:Ke=(Ke-R+Gt.x)/k,Ke=ht.$(Math.round(Ke),Ke)?Math.round(Ke):Math.ceil(Ke),Ke=Ke*k+R}else switch(L){case gl:Y=Ke+Gt.x+he.width;break;default:Y=Ke-Gt.x}switch(L){case gl:var Wi=-(Ke+Gt.x)+Y;break;default:Wi=Ke+he.width-Gt.x-Y}if(0<v&&A>v-1||0<f&&0<A&&Wi>f){for(n.push(new It(0,bt?X-a:X,f+w,tt+a+C)),Ke=0;Ke<A&&Te!==A;Ke++){Wi=s[Te-A+Ke];var Di=ch(Wi,Wi.locationObject,Wi.locationSpot,H);Wi.moveTo(Wi.position.x,Wi.position.y+a-Di.y)}tt+=C,X=bt?X+tt:X+(tt+a),A=tt=a=0,Ke=R,bt=!1}switch(Ke===R&&(m=L===gl?Math.max(m,he.width-Gt.x):Math.min(m,-Gt.x)),a=Math.max(a,Gt.y),tt=Math.max(tt,he.height-Gt.y),isFinite(st)&&(tt=Math.max(tt,Math.max(he.height,st)-Gt.y)),bt?Oe.moveTo(Ke-Gt.x,X-Gt.y):Oe.moveTo(Ke-Gt.x,X),L){case gl:Ke-=Gt.x+w;break;default:Ke+=he.width-Gt.x+w}A++}if(n.push(new It(0,X,f+w,(bt?tt:tt+a)+C)),s.length!==A)for(f=0;f<A;f++)v=s[s.length-A+f],w=ch(v,v.locationObject,v.locationSpot,c),v.moveTo(v.position.x,v.position.y+a-w.y);if(z.free(c),z.free(H),L===gl)for(s=0;s<n.length;s++)a=n[s],a.width+=m,a.x-=m;else for(s=0;s<n.length;s++)a=n[s],a.x>m&&(a.width+=a.x-m,a.x=m);It.free(l)}for(c=a=l=s=0;c<n.length;c++)f=n[c],s=Math.min(s,f.x),l=Math.min(l,f.y),a=Math.max(a,f.x+f.width);this.arrangement===gl?this.commitLayers(n,new z(s+e/2-(a+s),l-i/2)):this.commitLayers(n,new z(s-e/2,l-i/2)),t!==null&&t.eb("Layout"),this.isValidLayout=!0}},es.prototype.commitLayers=function(){};function Cy(t,e){return t=t.text,e=e.text,t<e?-1:t>e?1:0}ct.Object.defineProperties(es.prototype,{wrappingWidth:{get:function(){return this.zo},set:function(t){this.zo!==t&&(0<t||isNaN(t))&&(this.zo=t,this.isViewportSized=isNaN(t),this.C())}},wrappingColumn:{get:function(){return this.yo},set:function(t){this.yo!==t&&(0<t||isNaN(t))&&(this.yo=t,this.C())}},cellSize:{get:function(){return this.yg},set:function(t){this.yg.D(t)||(this.yg.assign(t),this.C())}},spacing:{get:function(){return this.tf},set:function(t){this.tf.D(t)||(this.tf.assign(t),this.C())}},alignment:{get:function(){return this.Jb},set:function(t){this.Jb===t||t!==C0&&t!==Km||(this.Jb=t,this.C())}},arrangement:{get:function(){return this.Rb},set:function(t){this.Rb===t||t!==mp&&t!==gl||(this.Rb=t,this.C())}},sorting:{get:function(){return this.nd},set:function(t){this.nd===t||t!==Mo&&t!==dv&&t!==Hm&&t!==fv||(this.nd=t,this.C())}},comparer:{get:function(){return this.hd},set:function(t){this.hd!==t&&(this.hd=t,this.C())}}});var Km=new mt(es,"Position",0),C0=new mt(es,"Location",1),mp=new mt(es,"LeftToRight",2),gl=new mt(es,"RightToLeft",3),Mo=new mt(es,"Forward",4),dv=new mt(es,"Reverse",5),Hm=new mt(es,"Ascending",6),fv=new mt(es,"Descending",7);es.className="GridLayout",es.standardComparer=Cy,es.smartComparer=function(t,e){if(t!==null){if(e!==null){t=t.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/),e=e.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/);for(var i=0;i<t.length;i++)if(e[i]!==""&&e[i]!==void 0){var n=parseFloat(t[i]),s=parseFloat(e[i]);if(isNaN(n))if(isNaN(s)){if(t[i].localeCompare(e[i])!==0)return t[i].localeCompare(e[i])}else return 1;else{if(isNaN(s))return-1;if(n-s!==0)return n-s}}else if(t[i]!=="")return 1;return e[i]!==""&&e[i]!==void 0?-1:0}return 1}return e!==null?-1:0},es.Position=Km,es.Location=C0,es.LeftToRight=mp,es.RightToLeft=gl,es.Forward=Mo,es.Reverse=dv,es.Ascending=Hm,es.Descending=fv;function _n(){this.On=new At,this.Dn=new At,this.Pa=new At,this.cf=new pe,this.bf=new pe,this.aj=new pe,this.H=null,this.tp=!1}T=_n.prototype,T.clear=function(){this.On.clear(),this.Dn.clear(),this.Pa.clear(),this.cf.clear(),this.bf.clear(),this.aj.clear()},T.Xe=function(t){this.H=t},T.oi=function(t){if(t instanceof Le){if(this.On.add(t),t instanceof ji){var e=t.containingGroup;e===null?this.H.ai.add(t):e.gl.add(t),e=t.layout,e!==null&&(e.diagram=this.H)}}else t instanceof ue?this.Dn.add(t):t instanceof Cn||this.Pa.add(t);e=t.data,e===null||t instanceof Cn||(t instanceof ue?this.bf.add(e,t):this.cf.add(e,t))},T.pc=function(t){if(t.Ej(),t instanceof Le){if(this.On.remove(t),t instanceof ji){var e=t.containingGroup;e===null?this.H.ai.remove(t):e.gl.remove(t),e=t.layout,e!==null&&(e.diagram=null)}}else t instanceof ue?this.Dn.remove(t):t instanceof Cn||this.Pa.remove(t);e=t.data,e===null||t instanceof Cn||(t instanceof ue?this.bf.remove(e):this.cf.remove(e))},T.Wd=function(){var t=this.H;if(t!==null){for(var e=t.nodeTemplateMap.iterator;e.next();){var i=e.value,n=e.key;(!i.Zc()||i instanceof ji)&&lt('Invalid node template in Diagram.nodeTemplateMap: template for "'+n+'" must be a Node or a simple Part, not a Group or Link: '+i)}for(e=t.groupTemplateMap.iterator;e.next();)i=e.value,n=e.key,i instanceof ji||lt('Invalid group template in Diagram.groupTemplateMap: template for "'+n+'" must be a Group, not a normal Node or Link: '+i);for(e=t.linkTemplateMap.iterator;e.next();)i=e.value,n=e.key,i instanceof ue||lt('Invalid link template in Diagram.linkTemplateMap: template for "'+n+'" must be a Link, not a normal Node or simple Part: '+i);for(e=Pe(),i=t.selection.iterator;i.next();)(n=i.value.data)&&e.push(n);for(i=Pe(),t=t.highlighteds.iterator;t.next();)(n=t.value.data)&&i.push(n);for(t=Pe(),n=this.nodes.iterator;n.next();){var s=n.value;s.data!==null&&(t.push(s.data),t.push(s.location))}for(n=this.links.iterator;n.next();)s=n.value,s.data!==null&&(t.push(s.data),t.push(s.location));for(n=this.parts.iterator;n.next();)s=n.value,s.data!==null&&(t.push(s.data),t.push(s.location));for(this.removeAllModeledParts(),this.addAllModeledParts(),n=0;n<e.length;n++)s=this.Lc(e[n]),s!==null&&(s.isSelected=!0);for(n=0;n<i.length;n++)s=this.Lc(i[n]),s!==null&&(s.isHighlighted=!0);for(n=0;n<t.length;n+=2)s=this.Lc(t[n]),s!==null&&(s.location=t[n+1]);qe(e),qe(i),qe(t)}},_n.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)},_n.prototype.addModeledParts=function(t,e){var i=this,n=this.diagram.model;t.forEach(function(s){n.lb(s)&&S1(i,s,!1)}),t.forEach(function(s){n.lb(s)&&i.resolveReferencesForData(s)}),e!==!1&&Jc(this.diagram,!1)};function S1(t,e,i){if(e!=null&&!t.diagram.undoManager.isUndoingRedoing&&!t.cf.contains(e)){i===void 0&&(i=!0);t:{if(e!=null&&!t.H.undoManager.isUndoingRedoing&&!t.cf.contains(e)){var n=t.Ro(e),s=M1(t,e,n);if(s!==null&&(_a(s),s=s.copy(),s!==null)){var a=t.diagram.skipsModelSourceBindings;t.diagram.skipsModelSourceBindings=!0,s.Tf=n,s.ub=e,t.tp&&(s.Jg="Tool"),t.diagram.add(s),s.ub=null,s.data=e,t.diagram.skipsModelSourceBindings=a,n=s;break t}}n=null}n!==null&&i&&t.resolveReferencesForData(e)}}_n.prototype.insertLink=function(){return null},_n.prototype.resolveReferencesForData=function(){},_n.prototype.Ro=function(t){return this.H.model.Ro(t)};function M1(t,e,i){t=t.H;var n=t.model;return n.Xj()&&n.Yu(e)?(e=t.groupTemplateMap.I(i),e===null&&(e=t.groupTemplateMap.I(""),e===null&&(gp||(gp=!0,Fe('No Group template found for category "'+i+'"'),Fe(" Using default group template")),e=t.ly))):(e=t.nodeTemplateMap.I(i),e===null&&(e=t.nodeTemplateMap.I(""),e===null&&(pv||(pv=!0,Fe('No Node template found for category "'+i+'"'),Fe(" Using default node template")),e=t.ny))),e}_n.prototype.getLinkCategoryForData=function(){return""},_n.prototype.setLinkCategoryForData=function(){},_n.prototype.setFromNodeForLink=function(){},_n.prototype.setToNodeForLink=function(){},_n.prototype.findLinkTemplateForCategory=function(t){var e=this.H,i=e.linkTemplateMap.I(t);return i===null&&(i=e.linkTemplateMap.I(""),i===null&&(mv||(mv=!0,Fe('No Link template found for category "'+t+'"'),Fe(" Using default link template")),i=e.my)),i},_n.prototype.removeAllModeledParts=function(){this.Gs(this.diagram.model.nodeDataArray)},_n.prototype.Gs=function(t){var e=this;t.forEach(function(i){e.ip(i)})},_n.prototype.ip=function(t){t=this.Lc(t),t!==null&&(ou(this.diagram,t,!1),this.unresolveReferencesForPart(t))},_n.prototype.unresolveReferencesForPart=function(){},_n.prototype.removeDataForLink=function(){},_n.prototype.findPartForKey=function(t){return t==null?null:(t=this.H.model.hc(t),t!==null?this.cf.I(t):null)},_n.prototype.Vb=function(t){return t==null||(t=this.H.model.hc(t),t===null)?null:(t=this.cf.I(t),t instanceof Le?t:null)},_n.prototype.findLinkForKey=function(){return null},T=_n.prototype,T.Lc=function(t){if(t===null)return null;var e=this.cf.I(t);return e!==null?e:e=this.bf.I(t)},T.ii=function(t){return t===null?null:(t=this.cf.I(t),t instanceof Le?t:null)},T.Kc=function(t){return t===null?null:this.bf.I(t)},T.ms=function(t){for(var e=0;e<arguments.length;++e);e=new At;for(var i=this.On.iterator;i.next();){var n=i.value,s=n.data;if(s!==null)for(var a=0;a<arguments.length;a++){var l=arguments[a];if(Tt(l)&&ky(this,s,l)){e.add(n);break}}}return e.iterator},T.ls=function(t){for(var e=0;e<arguments.length;++e);e=new At;for(var i=this.Dn.iterator;i.next();){var n=i.value,s=n.data;if(s!==null)for(var a=0;a<arguments.length;a++){var l=arguments[a];if(Tt(l)&&ky(this,s,l)){e.add(n);break}}}return e.iterator};function ky(t,e,i){for(var n in i){var s=e[n],a=i[n];if(ce(a)){if(!ce(s)||s.length<a.length)return!1;for(var l=0;l<s.length;l++){var c=a[l];if(c!==void 0&&!C1(t,s[l],c))return!1}}else if(!C1(t,s,a))return!1}return!0}function C1(t,e,i){if(typeof i=="function"){if(!i(e))return!1}else if(i instanceof RegExp){if(!e||!i.test(e.toString()))return!1}else if(Tt(e)&&Tt(i)){if(!ky(t,e,i))return!1}else if(e!==i)return!1;return!0}_n.prototype.doModelChanged=function(t){if(this.H){var e=this.H;if(t.model===e.model){var i=t.change;if(e.doModelChanged(t),e.aa){e.aa=!1;try{var n=t.modelChange;if(n!=="")if(i===Sr){if(n==="nodeCategory"){var s=this.Lc(t.object),a=t.newValue;s!==null&&typeof a=="string"&&(s.category=a)}else n==="nodeDataArray"&&(this.Gs(t.oldValue),this.addModeledParts(t.newValue));e.isModified=!0}else if(i===Yr){var l=t.newValue;n==="nodeDataArray"&&Tt(l)&&S1(this,l),e.isModified=!0}else if(i===Jr){var c=t.oldValue;n==="nodeDataArray"&&Tt(c)&&this.ip(c),e.isModified=!0}else i===wa&&(n==="SourceChanged"?t.object!==null?this.updateDataBindings(t.object,t.propertyName):(this.rp(),this.updateAllTargetBindings()):n==="ModelDisplaced"&&this.Wd());else if(i===Sr){var f=t.propertyName,m=t.object;m===e.model?(f==="nodeKeyProperty"||f==="nodeCategoryProperty")&&(e.undoManager.isUndoingRedoing||this.Wd()):this.updateDataBindings(m,f),e.isModified=!0}else if(i===Yr||i===Jr){var v=t.change===Yr,w=v?t.newParam:t.oldParam,C=v?t.newValue:t.oldValue,k=this.aj.I(t.object);if(Array.isArray(k))for(t=0;t<k.length;t++){var L=k[t];if(v)vm(L,C,w,!0);else if(!(0>w)){var A=w+Xd(L);L.pc(A,!0),Yd(L,A,w)}}e.isModified=!0}}finally{e.aa=!0}}}}},_n.prototype.updateAllTargetBindings=function(t){t===void 0&&(t="");for(var e=this.parts.iterator;e.next();)e.value.La(t);for(e=this.nodes.iterator;e.next();)e.value.La(t);for(e=this.links.iterator;e.next();)e.value.La(t)},_n.prototype.rp=function(){for(var t=this.H.model,e=new At,i=t.nodeDataArray,n=0;n<i.length;n++)e.add(i[n]);var s=[];for(this.nodes.each(function(l){l.data===null||e.contains(l.data)||s.push(l.data)}),this.parts.each(function(l){l.data===null||e.contains(l.data)||s.push(l.data)}),s.forEach(function(l){vp(t,l,!1)}),n=0;n<i.length;n++){var a=i[n];this.Lc(a)===null&&vv(t,a,!1)}for(this.refreshDataBoundLinks(),i=this.parts.iterator;i.next();)i.value.updateRelationshipsFromData();for(i=this.nodes.iterator;i.next();)i.value.updateRelationshipsFromData();for(i=this.links.iterator;i.next();)i.value.updateRelationshipsFromData()},_n.prototype.refreshDataBoundLinks=function(){},_n.prototype.updateRelationshipsFromData=function(){},_n.prototype.updateDataBindings=function(t,e){if(typeof e=="string"){var i=this.Lc(t);if(i!==null)i.La(e);else{i=null;for(var n=this.aj.iterator;n.next();){for(var s=n.value,a=0;a<s.length;a++){var l=s[a].sx(t);l!==null&&(i===null&&(i=Pe()),i.push(l))}if(i!==null)break}if(i!==null){for(n=0;n<i.length;n++)i[n].La(e);qe(i)}}t===this.diagram.model.modelData&&this.updateAllTargetBindings(e)}};function Gr(t,e){var i=e.Hh;if(ce(i)){var n=t.aj.I(i);if(n===null)n=[],n.push(e),t.aj.add(i,n);else{for(t=0;t<n.length;t++)if(n[t]===e)return;n.push(e)}}}function dd(t,e,i){Hh(e,function(l){l=l.O.s;for(var c=l.length,f=0;f<c;f++)em(i,l[f])});var n=e.Hh;if(ce(n)){var s=t.aj.I(n);if(s!==null){for(var a=0;a<s.length;a++)if(s[a]===e){s.splice(a,1),s.length===0&&t.aj.remove(n);break}}}}_n.prototype.Kj=function(t,e,i){i===void 0&&(i=!1);var n=new pe;if(ce(t))for(var s=0;s<t.length;s++)fd(this,t[s],e,n,i);else for(t=t.iterator;t.next();)fd(this,t.value,e,n,i);if(e!==null){i=e.model,t=e.toolManager.findTool("Dragging"),t=t!==null?t.dragOptions.dragsLink:e.Wm.dragsLink,s=new At;for(var a=new pe,l=n.iterator;l.next();){var c=l.value;if(c instanceof ue)t||c.fromNode!==null&&c.toNode!==null||s.add(c);else if(c instanceof Le&&c.data!==null&&i.Tl()){var f=c;c=l.key;var m=c.pg();m!==null&&(m=n.I(m),m!==null?(i.qe(f.data,i.wa(m.data)),f=e.Kc(f.data),c=c.kh(),c!==null&&f!==null&&a.add(c,f)):i.qe(f.data,void 0))}}if(0<s.count&&e.Is(s,!1),0<a.count)for(i=a.iterator;i.next();)n.add(i.key,i.value)}if(e!==null&&this.H!==null&&(e=e.model,i=e.afterCopyFunction,i!==null)){var v=new pe;n.each(function(w){w.key.data!==null&&v.add(w.key.data,w.value.data)}),i(v,e,this.H.model)}for(e=n.iterator;e.next();)e.value.La();return n};function fd(t,e,i,n,s){if(e===null||s&&!e.canCopy())return null;if(n.contains(e))return n.I(e);var a=t.copyPartData(e,i);if(!(a instanceof ui))return null;if(a.isSelected=!1,a.isHighlighted=!1,n.add(e,a),e instanceof Le){for(var l=e.linksConnected;l.next();){var c=l.value;if(c.fromNode===e){var f=n.I(c);f!==null&&(f.fromNode=a)}c.toNode===e&&(c=n.I(c),c!==null&&(c.toNode=a))}if(e instanceof ji&&a instanceof ji)for(e=e.memberParts;e.next();)l=fd(t,e.value,i,n,s),l instanceof ue||l===null||(l.containingGroup=a)}else if(e instanceof ue&&a instanceof ue)for(l=e.fromNode,l!==null&&(l=n.I(l),l!==null&&(a.fromNode=l)),l=e.toNode,l!==null&&(l=n.I(l),l!==null&&(a.toNode=l)),e=e.labelNodes;e.next();)l=fd(t,e.value,i,n,s),l!==null&&l instanceof Le&&(l.labeledLink=a);return a}_n.prototype.copyPartData=function(t,e){var i=null,n=t.data;if(n!==null&&e!==null){var s=e.model;t instanceof ue||(n=s.copyNodeData(n),Tt(n)&&(s.xf(n),i=e.Lc(n)))}else _a(t),i=t.copy(),i!==null&&(s=this.H,e!==null?e.add(i):n!==null&&s!==null&&s.commandHandler!==null&&s.commandHandler.copiesClipboardData&&(e=s.model,s=null,i instanceof ue||(s=e.copyNodeData(n)),Tt(s)&&(i.data=s)));return i},ct.Object.defineProperties(_n.prototype,{nodes:{get:function(){return this.On}},links:{get:function(){return this.Dn}},parts:{get:function(){return this.Pa}},diagram:{get:function(){return this.H}},addsToTemporaryLayer:{get:function(){return this.tp},set:function(t){this.tp=t}}}),_n.prototype.updateAllRelationshipsFromData=_n.prototype.rp,_n.prototype.findLinksByExample=_n.prototype.ls,_n.prototype.findNodesByExample=_n.prototype.ms,_n.prototype.findLinkForData=_n.prototype.Kc,_n.prototype.findNodeForData=_n.prototype.ii,_n.prototype.findPartForData=_n.prototype.Lc,_n.prototype.findNodeForKey=_n.prototype.Vb,_n.prototype.removeModeledPart=_n.prototype.ip,_n.prototype.removeModeledParts=_n.prototype.Gs,_n.prototype.rebuildParts=_n.prototype.Wd;var pv=!1,gp=!1,mv=!1;_n.className="PartManager";function Zo(t){_n.apply(this,arguments)}gi(Zo,_n),Zo.prototype.addAllModeledParts=function(){var t=this.diagram.model;this.addModeledParts(t.nodeDataArray),k0(this,t.linkDataArray)},Zo.prototype.addModeledParts=function(t){for(_n.prototype.addModeledParts.call(this,t,!1),t=this.links.iterator;t.next();)hp(t.value);Jc(this.diagram,!1)};function k0(t,e){e.forEach(function(i){k1(t,i)}),Jc(t.diagram,!1)}function k1(t,e){if(e!=null&&!t.diagram.undoManager.isUndoingRedoing&&!t.bf.contains(e)){var i=t.getLinkCategoryForData(e),n=t.findLinkTemplateForCategory(i);if(n!==null){_a(n);var s=n.copy();if(s!==null){n=t.diagram.skipsModelSourceBindings,t.diagram.skipsModelSourceBindings=!0,s.Tf=i,s.ub=e,i=t.diagram.model;var a=xv(i,e,!0);a!==""&&(s.fromPortId=a),a=tl(i,e,!0),a!==void 0&&(a=t.Vb(a),a instanceof Le&&(s.fromNode=a)),a=xv(i,e,!1),a!==""&&(s.toPortId=a),a=tl(i,e,!1),a!==void 0&&(a=t.Vb(a),a instanceof Le&&(s.toNode=a)),i=i.Ef(e),Array.isArray(i)&&i.forEach(function(l){l=t.Vb(l),l!==null&&(l.labeledLink=s)}),t.tp&&(s.Jg="Tool"),t.diagram.add(s),s.ub=null,s.data=e,t.diagram.skipsModelSourceBindings=n}}}}Zo.prototype.removeAllModeledParts=function(){var t=this.diagram.model;Ly(this,t.linkDataArray),this.Gs(t.nodeDataArray)};function Ly(t,e){e.forEach(function(i){t.ip(i)})}Zo.prototype.getLinkCategoryForData=function(t){return this.diagram.model.ps(t)},Zo.prototype.setLinkCategoryForData=function(t,e){return this.diagram.model.lp(t,e)},Zo.prototype.setFromNodeForLink=function(t,e){var i=this.diagram.model;i.wv(t.data,i.wa(e!==null?e.data:null))},Zo.prototype.setToNodeForLink=function(t,e){var i=this.diagram.model;i.Bv(t.data,i.wa(e!==null?e.data:null))},Zo.prototype.removeDataForLink=function(t){this.diagram.model.bm(t.data)},Zo.prototype.findPartForKey=function(t){var e=_n.prototype.findPartForKey.call(this,t);return e===null&&(t=this.diagram.model.jh(t),t!==null)?this.bf.I(t):e},Zo.prototype.findLinkForKey=function(t){return t==null?null:(t=this.diagram.model.jh(t),t!==null?this.bf.I(t):null)},Zo.prototype.doModelChanged=function(t){var e=this;if(_n.prototype.doModelChanged.call(this,t),this.diagram){var i=this.diagram;if(t.model===i.model){var n=t.change;if(i.aa){i.aa=!1;try{var s=t.modelChange;if(s!==""){if(n===Sr){if(s==="linkFromKey"){var a=this.Kc(t.object);if(a!==null){var l=this.Vb(t.newValue);a.fromNode=l}}else if(s==="linkToKey"){var c=this.Kc(t.object);if(c!==null){var f=this.Vb(t.newValue);c.toNode=f}}else if(s==="linkFromPortId"){var m=this.Kc(t.object);if(m!==null){var v=t.newValue;typeof v=="string"&&(m.fromPortId=v)}}else if(s==="linkToPortId"){var w=this.Kc(t.object);if(w!==null){var C=t.newValue;typeof C=="string"&&(w.toPortId=C)}}else if(s==="nodeGroupKey"){var k=this.Lc(t.object);if(k!==null){var L=t.newValue;if(L!==void 0){var A=this.Vb(L);A instanceof ji?k.containingGroup=A:k.containingGroup=null}else k.containingGroup=null}}else if(s==="linkLabelKeys"){var H=this.Kc(t.object);if(H!==null){var R=t.oldValue,X=t.newValue;Array.isArray(R)&&R.forEach(function(Gt){0<=X.indexOf(Gt)||(Gt=e.Vb(Gt),Gt!==null&&(Gt.labeledLink=null))}),Array.isArray(X)&&X.forEach(function(Gt){Gt=e.Vb(Gt),Gt!==null&&(Gt.labeledLink=H)})}}else if(s==="linkCategory"){var Y=this.Kc(t.object),tt=t.newValue;Y!==null&&typeof tt=="string"&&(Y.category=tt)}else s==="linkDataArray"&&(Ly(this,t.oldValue),k0(this,t.newValue));i.isModified=!0}else if(n===Yr){var st=t.newValue;if(s==="linkDataArray"&&typeof st=="object"&&st!==null)k1(this,st);else if(s==="linkLabelKeys"&&cf(st)){var bt=this.Kc(t.object),Te=this.Vb(st);bt!==null&&Te!==null&&(Te.labeledLink=bt)}i.isModified=!0}else if(n===Jr){var Ke=t.oldValue;if(s==="linkDataArray"&&typeof Ke=="object"&&Ke!==null)this.ip(Ke);else if(s==="linkLabelKeys"&&cf(Ke)){var Oe=this.Vb(Ke);Oe!==null&&(Oe.labeledLink=null)}i.isModified=!0}}else if(n===Sr){var he=t.propertyName;t.object!==i.model||he!=="linkFromKeyProperty"&&he!=="linkToKeyProperty"&&he!=="linkFromPortIdProperty"&&he!=="linkToPortIdProperty"&&he!=="linkLabelKeysProperty"&&he!=="nodeIsGroupProperty"&&he!=="nodeGroupKeyProperty"&&he!=="linkCategoryProperty"||i.undoManager.isUndoingRedoing||this.Wd(),i.isModified=!0}}finally{i.aa=!0}}}}},Zo.prototype.refreshDataBoundLinks=function(){var t=this,e=this.diagram.model,i=new At,n=e.linkDataArray;n.forEach(function(a){i.add(a)});var s=[];this.links.each(function(a){a.data===null||i.contains(a.data)||s.push(a.data)}),s.forEach(function(a){df(e,a,!1)}),n.forEach(function(a){t.Kc(a)===null&&T1(e,a,!1)})},Zo.prototype.updateRelationshipsFromData=function(t){var e=t.data;if(e!==null){var i=t.diagram;if(i!==null){var n=i.model;if(t instanceof ue){var s=tl(n,e,!0);if(s=i.Vb(s),t.fromNode=s,s=tl(n,e,!1),s=i.Vb(s),t.toNode=s,e=n.Ef(e),0<e.length||0<t.labelNodes.count){if(e.length===1&&t.labelNodes.count===1){s=e[0];var a=t.labelNodes.first();if(n.wa(a.data)===s)return}s=new At().addAll(e);var l=new At;t.labelNodes.each(function(c){c.data!==null&&(c=n.wa(c.data),c!==void 0&&l.add(c))}),e=l.copy(),e.hp(s),s=s.copy(),s.hp(l),(0<e.count||0<s.count)&&(e.each(function(c){c=i.Vb(c),c!==null&&c.labeledLink===t&&(c.labeledLink=null)}),s.each(function(c){c=i.Vb(c),c!==null&&c.labeledLink!==t&&(c.labeledLink=t)}))}}else!(t instanceof Cn)&&(e=n.lh(e),e=i.findPartForKey(e),e===null||e instanceof ji)&&(t.containingGroup=e)}}},Zo.prototype.resolveReferencesForData=function(t){var e=this.diagram.model,i=e.wa(t);if(i!==void 0){var n=Vm(e,i),s=this.Lc(t);if(n!==null&&s!==null){n=n.iterator;for(var a={};n.next();){var l=n.value;e.lb(l)?s instanceof ji&&e.lh(l)===i&&(l=this.Lc(l),l!==null&&(l.containingGroup=s)):(a.link=this.Kc(l),a.link!==null&&s instanceof Le&&(tl(e,l,!0)===i&&(a.link.fromNode=s),tl(e,l,!1)===i&&(a.link.toNode=s),l=e.Ef(l),Array.isArray(l)&&l.some(function(c){return function(f){return f===i?(s.labeledLink=c.link,!0):!1}}(a)))),a={link:a.link}}Al(e,i)}t=e.lh(t),t!==void 0&&(t=this.Vb(t),t instanceof ji&&(s.containingGroup=t))}},Zo.prototype.unresolveReferencesForPart=function(t){var e=this.diagram.model;if(t instanceof Le){var i=e.wa(t.data);if(i!==void 0){for(var n=t.linksConnected;n.next();)du(e,i,n.value.data);if(t.isLinkLabel&&(n=t.labeledLink,n!==null&&du(e,i,n.data)),t instanceof ji)for(t=t.memberParts;t.next();)n=t.value.data,e.lb(n)&&du(e,i,n)}}},Zo.prototype.copyPartData=function(t,e){var i=_n.prototype.copyPartData.call(this,t,e);if(t instanceof ue)if(t=t.data,t!==null&&e!==null){var n=e.model;t=n.Jo(t),typeof t=="object"&&t!==null&&(n.fi(t),i=e.Kc(t))}else i!==null&&(e=this.diagram,t!==null&&e!==null&&e.commandHandler!==null&&e.commandHandler.copiesClipboardData&&(e=e.model.Jo(t),typeof e=="object"&&e!==null&&(i.data=e)));return i},Zo.prototype.insertLink=function(t,e,i,n){var s=this.diagram,a=s.model,l=s.toolManager.findTool("Linking"),c="";if(t!==null&&(e===null&&(e=t),c=e.portId,c===null&&(c="")),e="",i!==null&&(n===null&&(n=i),e=n.portId,e===null&&(e="")),n=l.archetypeLinkData,n instanceof ue){if(_a(n),a=n.copy(),a!==null)return a.fromNode=t,a.fromPortId=c,a.toNode=i,a.toPortId=e,s.add(a),t=l.archetypeLabelNodeData,t instanceof Le&&(_a(t),t=t.copy(),t!==null&&(t.labeledLink=a,s.add(t))),a}else if(n!==null&&(n=a.Jo(n),typeof n=="object"&&n!==null))return t!==null&&_0(a,n,a.wa(t.data),!0),T0(a,n,c,!0),i!==null&&_0(a,n,a.wa(i.data),!1),T0(a,n,e,!1),a.fi(n),t=l.archetypeLabelNodeData,t===null||t instanceof Le||(t=a.copyNodeData(t),typeof t=="object"&&t!==null&&(a.xf(t),t=a.wa(t),t!==void 0&&a.Bu(n,t))),s.Kc(n);return null},Zo.prototype.findLinkForKey=Zo.prototype.findLinkForKey,Zo.prototype.findPartForKey=Zo.prototype.findPartForKey,Zo.prototype.removeAllModeledParts=Zo.prototype.removeAllModeledParts,Zo.prototype.addModeledParts=Zo.prototype.addModeledParts,Zo.prototype.addAllModeledParts=Zo.prototype.addAllModeledParts,Zo.className="GraphLinksPartManager";function vl(){_n.apply(this,arguments),this.Sg=null}gi(vl,_n);function kr(t,e,i){if(e!==null&&i!==null&&i.kh()===null){var n=t.diagram.toolManager.findTool("Linking"),s=e,a=i;if(t.diagram.isTreePathToChildren||(s=i,a=e),(n===null||!Ko(n,s,a,null,!0))&&(e=t.getLinkCategoryForData(i.data),n=t.findLinkTemplateForCategory(e),n!==null&&(_a(n),n=n.copy(),n!==null))){var l=t.diagram.skipsModelSourceBindings;t.diagram.skipsModelSourceBindings=!0,n.Tf=e,n.ub=i.data,n.fromNode=s,n.toNode=a,t.diagram.add(n),n.ub=null,n.data=i.data,t.diagram.skipsModelSourceBindings=l}}}vl.prototype.getLinkCategoryForData=function(t){return this.diagram.model.ss(t)},vl.prototype.setLinkCategoryForData=function(t,e){this.diagram.model.Ms(t,e)},vl.prototype.setFromNodeForLink=function(t,e,i){var n=this.diagram.model;if(i===void 0&&(i=null),e=e!==null?e.data:null,this.diagram.isTreePathToChildren)n.qe(t.data,n.wa(e));else{var s=this.Sg;this.Sg=t,i!==null&&n.qe(i.data,void 0),n.qe(e,n.wa(t.toNode!==null?t.toNode.data:null)),this.Sg=s}},vl.prototype.setToNodeForLink=function(t,e,i){var n=this.diagram.model;if(i===void 0&&(i=null),e=e!==null?e.data:null,this.diagram.isTreePathToChildren){var s=this.Sg;this.Sg=t,i!==null&&n.qe(i.data,void 0),n.qe(e,n.wa(t.fromNode!==null?t.fromNode.data:null)),this.Sg=s}else n.qe(t.data,n.wa(e))},vl.prototype.removeDataForLink=function(t){this.diagram.model.qe(t.data,void 0)},vl.prototype.findLinkForKey=function(t){return t==null?null:(t=this.diagram.model.hc(t),t!==null?this.bf.I(t):null)},vl.prototype.doModelChanged=function(t){if(_n.prototype.doModelChanged.call(this,t),this.diagram){var e=this.diagram;if(t.model===e.model){var i=t.change;if(e.aa){e.aa=!1;try{var n=t.modelChange;if(n!==""){if(i===Sr){if(n==="nodeParentKey"){var s=t.object,a=this.Vb(t.newValue),l=this.ii(s);if(this.Sg!==null)a!==null&&(this.Sg.data=s,this.Sg.category=this.getLinkCategoryForData(s));else if(l!==null){var c=l.kh();c!==null?a===null?e.remove(c):e.isTreePathToChildren?c.fromNode=a:c.toNode=a:kr(this,a,l)}}else if(n==="parentLinkCategory"){var f=this.ii(t.object),m=t.newValue;if(f!==null&&typeof m=="string"){var v=f.kh();v!==null&&(v.category=m)}}e.isModified=!0}}else if(i===Sr){var w=t.propertyName;t.object===e.model&&w==="nodeParentKeyProperty"&&(e.undoManager.isUndoingRedoing||this.Wd()),e.isModified=!0}}finally{e.aa=!0}}}}},vl.prototype.updateRelationshipsFromData=function(t){var e=t.data;if(e!==null){var i=t.diagram;if(i!==null){var n=i.model;t instanceof Le&&(e=n.mh(e),e=i.Vb(e),n=t.pg(),e!==n&&(n=t.kh(),e!==null?n!==null?i.isTreePathToChildren?n.fromNode=e:n.toNode=e:kr(this,e,t):n!==null&&ou(i,n,!1)))}}},vl.prototype.updateDataBindings=function(t,e){_n.prototype.updateDataBindings.call(this,t,e),typeof e=="string"&&this.Lc(t)!==null&&(t=this.Kc(t),t!==null&&t.La(e))},vl.prototype.resolveReferencesForData=function(t){var e=this.diagram.model,i=e.wa(t);if(i!==void 0){var n=Vm(e,i),s=this.Lc(t);if(n!==null&&s!==null){for(n=n.iterator;n.next();){var a=n.value;e.lb(a)&&s instanceof Le&&e.mh(a)===i&&kr(this,s,this.ii(a))}Al(e,i)}t=e.mh(t),t!==void 0&&s instanceof Le&&(t=this.Vb(t),kr(this,t,s))}},vl.prototype.unresolveReferencesForPart=function(t){var e=this.diagram.model;if(t instanceof Le){var i=e.wa(t.data),n=this.Kc(t.data);if(n!==null){n.isSelected=!1,n.isHighlighted=!1;var s=n.layer;if(s!==null){var a=s.pc(-1,n,!1);0<=a&&this.diagram.cb(Jr,"parts",s,n,null,a,null),a=n.layerChanged,a!==null&&a(n,s,null)}}for(n=this.diagram.isTreePathToChildren,t=t.linksConnected;t.next();)s=t.value,s=(n?s.toNode:s.fromNode).data,e.lb(s)&&du(e,i,s)}},vl.prototype.insertLink=function(t,e,i){e=this.diagram.model;var n=t,s=i;return this.diagram.isTreePathToChildren||(n=i,s=t),n!==null&&s!==null?(e.qe(s.data,e.wa(n.data)),s.kh()):null},vl.prototype.findLinkForKey=vl.prototype.findLinkForKey,vl.className="TreePartManager";function Ve(t,e){this.kl=new At,this.il=new At,this.Wv=`,
"insertedNodeKeys": `,this.jy=`,
"modifiedNodeData": `,this.Yv=`,
"removedNodeKeys": `,this.vh=null,vi(this),this.Sm=this.xa="",this.Gg=!1,this.j={},this.Tc=[],this.kb=new pe,this.Th="key",this.Bk=this.bl=null,this.Jm=this.Km=!1,this.Mm=!0,this.xm=null,this.lj="category",this.Vf=new pe,this.Lt=new Kt,this.Wg=!1,this.o=null,this.undoManager=new Tr,t!==void 0&&(ce(t)?this.nodeDataArray=t:e=t),e&&(Object.assign(this,e),t=e.Changed)&&(delete this.Changed,this.Pe(t))}Ve.prototype.cloneProtected=function(t){t.xa=this.xa,t.Sm=this.Sm,t.Gg=this.Gg,t.Th=this.Th,t.bl=this.bl,t.Bk=this.Bk,t.Km=this.Km,t.Jm=this.Jm,t.Mm=this.Mm,t.xm=this.xm,t.lj=this.lj},Ve.prototype.copy=function(){var t=new this.constructor;return this.cloneProtected(t),t},Ve.prototype.clear=function(){this.Tc=[],this.kb.clear(),this.Vf.clear(),this.undoManager.clear()},Ve.prototype.toString=function(t){if(t===void 0&&(t=0),1<t)return this.np();var e=(this.name!==""?this.name:"")+" Model";if(0<t){e+=`
node data:`,t=this.nodeDataArray;for(var i=t.length,n=0;n<i;n++){var s=t[n];e+=" "+this.wa(s)+":"+ni(s)}}return e},Ve.prototype.xA=function(t){t.change!==wa&&lt("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+t.toString());var e=t.object;return t.isTransactionFinished&&e instanceof Bo?(L1(this,e),t=this.Qv(e,t.propertyName==="FinishedUndo"),this.vh=null,t):null},Ve.prototype.Qv=function(t,e){var i=this,n=!1,s=new At,a=new At,l=new At,c=this.vh;t.changes.each(function(w){w.model===i&&(w.modelChange==="nodeDataArray"?w.change===Yr?s.add(w.newValue):w.change===Jr&&l.add(w.oldValue):i.lb(w.object)?a.add(w.object):w.change!==Sr||i.modelData!==w.object&&w.propertyName!=="modelData"?w.object!==null&&(c&&c.contains(w.object)?c.get(w.object).each(function(C){i.lb(C)&&a.add(C)}):w.object instanceof Ve||i.ri()&&i.Jc(w.object)||_s(i,w.object).each(function(C){a.add(C)})):n=!0)});var f=this.il;f.clear(),s.each(function(w){f.add(i.wa(w)),e||a.add(w)});var m=this.kl;m.clear(),l.each(function(w){m.add(i.wa(w)),e&&a.add(w)}),t=i.cloneDeep(a.Fa());var v=null;return n&&(v===null&&(v={}),v.modelData=this.cloneDeep(this.modelData)),0<f.count&&(v===null&&(v={}),e?v.removedNodeKeys=f.Fa():v.insertedNodeKeys=f.Fa()),0<t.length&&(v===null&&(v={}),v.modifiedNodeData=t),0<m.count&&(v===null&&(v={}),e?v.insertedNodeKeys=m.Fa():v.removedNodeKeys=m.Fa()),m.clear(),f.clear(),v},Ve.prototype.cloneDeep=function(t){return Ec(this,t,!0)};function Ec(t,e,i,n,s,a){function l(w,C){c?(w.__gohashid===void 0&&a.push(w),n.set(w,C)):(w=gn++,n.set(w,C),s.set(w,e))}if(!Tt(e))return e;a||(a=[]);var c=Object.isExtensible(e);if(n||(n=new pe),c){var f=n.get(e);if(f)return f}else for(s||(s=new pe),f=s.iterator;f.next();){var m=f.key;if(f.value===e&&(m=n.get(m)))return m}if(Array.isArray(e)){f=[],l(e,f);for(var v=0;v<e.length;v++)f.push(Ec(t,e[v],!1,n,s,a))}else if(e instanceof z||e instanceof ii||e instanceof It||e instanceof ai||e instanceof Ze)f=e.copy(),l(e,f);else{if(e instanceof Tn||e instanceof fe||e instanceof mt)return e;if(e instanceof Kt)f=new Kt().addAll(Ec(t,e.Fa(),!1,n,s,a)),l(e,f);else if(e instanceof At)f=new At().addAll(Ec(t,e.Fa(),!1,n,s,a)),l(e,f);else if(e instanceof pe)f=new pe().addAll(Ec(t,e.Fa(),!1,n,s,a)),l(e,f);else if(e instanceof Date)f=new Date(e.getTime()),l(e,f);else if(e instanceof RegExp)f=new RegExp(e),l(e,f),f.lastIndex=e.lastIndex;else if(typeof e.copy=="function")f=e.copy(),l(e,f);else for(v in f={},l(e,f),e)v!=="__gohashid"&&(f[v]=Ec(t,e[v],!1,n,s,a))}return i&&a.forEach(function(w){delete w.__gohashid}),f}T=Ve.prototype,T.quote=function(t){return JSON.stringify(t).replace(/[\u007F-\uFFFF]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).substr(-4)})},T.rm=function(){var t="";return this.name!==""&&(t+=`,
"name": `+this.quote(this.name)),this.dataFormat!==""&&(t+=`,
"dataFormat": `+this.quote(this.dataFormat)),this.isReadOnly&&(t+=`,
"isReadOnly": `+this.isReadOnly),this.nodeKeyProperty!=="key"&&typeof this.nodeKeyProperty=="string"&&(t+=`,
"nodeKeyProperty": `+this.quote(this.nodeKeyProperty)),this.copiesArrays&&(t+=`,
"copiesArrays": true`),this.copiesArrayObjects&&(t+=`,
"copiesArrayObjects": true`),this.copiesKey||(t+=`,
"copiesKey": false`),this.nodeCategoryProperty!=="category"&&typeof this.nodeCategoryProperty=="string"&&(t+=`,
"nodeCategoryProperty": `+this.quote(this.nodeCategoryProperty)),t},T.gp=function(t){t.name&&(this.name=t.name),t.dataFormat&&(this.dataFormat=t.dataFormat),t.isReadOnly&&(this.isReadOnly=!0),t.nodeKeyProperty&&(this.nodeKeyProperty=t.nodeKeyProperty),t.copiesArrays&&(this.copiesArrays=!0),t.copiesArrayObjects&&(this.copiesArrayObjects=!0),t.copiesKey===!1&&(this.copiesKey=!1),t.nodeCategoryProperty&&(this.nodeCategoryProperty=t.nodeCategoryProperty)};function L0(t,e){e=e.modelData,Tt(e)&&(t.dm(e),t.modelData=e)}T.Rv=function(){var t=this.modelData,e=!1,i;for(i in t)if(!vx(i,t[i])){e=!0;break}return t="",e&&(t=`,
"modelData": `+Ey(this,this.modelData)),t+`,
"nodeDataArray": `+hs(this,this.nodeDataArray,!0)},T.kv=function(t){L0(this,t),t=t.nodeDataArray,ce(t)&&(this.dm(t),this.nodeDataArray=t)};function L1(t,e){function i(s,a){if((a=a.part)&&(a=a.data,s!==a)){var l=n.get(s);l===null?(l=new At,l.add(a),n.add(s,l)):l.add(a)}}var n=t.vh;n===null&&(n=new pe,e.changes.each(function(s){if(s.diagram!==null){var a=s.change;a===Sr?(s=s.object.panel)&&(a=s.data)&&i(a,s):(a===Yr||a===Jr)&&(s=s.object,(a=s.itemArray)&&i(a,s))}}),t.vh=n)}function _s(t,e){for(var i=new At,n=0;n<t.nodeDataArray.length;n++){var s=t.nodeDataArray[n];gv(t,e,s,s,i)}return i}function gv(t,e,i,n,s){if(Array.isArray(i))for(var a=0;a<i.length;a++){var l=i[a];if(l===e)return s.add(n),!0;if(gv(t,e,l,n,s))return!0}else if(Tt(i)&&Object.getPrototypeOf(i)===Object.prototype)for(a in i){if(l=i[a],l===e)return s.add(n),!0;if(gv(t,e,l,n,s))return!0}return!1}T.Pv=function(t,e){var i=this,n=!1,s=new At,a=new At,l=new At,c=this.vh;t.changes.each(function(v){v.model===i&&(v.modelChange==="nodeDataArray"?v.change===Yr?s.add(v.newValue):v.change===Jr&&l.add(v.oldValue):i.lb(v.object)?a.add(v.object):v.change!==Sr||i.modelData!==v.object&&v.propertyName!=="modelData"?v.object!==null&&(c&&c.contains(v.object)?c.get(v.object).each(function(w){i.lb(w)&&a.add(w)}):v.object instanceof Ve||i.ri()&&i.Jc(v.object)||_s(i,v.object).each(function(w){a.add(w)})):n=!0)});var f=this.il;f.clear(),s.each(function(v){f.add(i.wa(v)),e||a.add(v)});var m=this.kl;return m.clear(),l.each(function(v){m.add(i.wa(v)),e&&a.add(v)}),t="",n&&(t+=`,
"modelData": `+Ey(this,this.modelData)),0<f.count&&(t+=(e?this.Yv:this.Wv)+hs(this,f.Fa(),!0)),0<a.count&&(t+=this.jy+hs(this,a.Fa(),!0)),0<m.count&&(t+=(e?this.Wv:this.Yv)+hs(this,m.Fa(),!0)),m.clear(),f.clear(),t},T.fp=function(t){(t.name!==void 0&&t.name!==this.name||t.dataFormat!==void 0&&t.dataFormat!==this.dataFormat||t.isReadOnly!==void 0&&t.isReadOnly!==this.isReadOnly||t.nodeKeyProperty!==void 0&&t.nodeKeyProperty!==this.nodeKeyProperty||t.copiesArrays!==void 0&&t.copiesArrays!==this.copiesArrays||t.copiesArrayObjects!==void 0&&t.copiesArrayObjects!==this.copiesArrayObjects||t.copiesKey!==void 0&&t.copiesKey!==this.copiesKey||t.nodeCategoryProperty!==void 0&&t.nodeCategoryProperty!==this.nodeCategoryProperty)&&lt("applyIncrementalJson cannot change Model properties"),L0(this,t);var e=t.insertedNodeKeys,i=t.modifiedNodeData,n=new pe;if(Array.isArray(i))for(var s=0;s<i.length;s++){var a=i[s],l=this.wa(a);l!=null&&n.set(l,a)}if(Array.isArray(e))for(s=e.length,a=0;a<s;a++){l=e[a];var c=this.hc(l);c===null&&(c=(c=n.get(l))?c:this.copyNodeData({}),this.km(c,l),this.xf(c))}if(Array.isArray(i)){for(e=i.length,n=0;n<e;n++)if(s=i[n],a=this.wa(s),a=this.hc(a),a!==null){for(var f in s)f==="__gohashid"||f===this.nodeKeyProperty||this.Wj()&&f===this.nodeIsGroupProperty||this.setDataProperty(a,f,s[f]);this.lm(s,a)}}if(t=t.removedNodeKeys,Array.isArray(t))for(i=t.length,f=0;f<i;f++)e=this.hc(t[f]),e!==null&&this.cm(e)},T.$x=function(t,e){t.change!==wa&&lt("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+t.toString());var i=t.object;return t.isTransactionFinished&&i instanceof Bo?(e===void 0&&(e=yp(this,this)),L1(this,i),t=this.Pv(i,t.propertyName==="FinishedUndo"),this.vh=null,e==="2"?'{ "incremental": 2'+t+"}":'{ "class": '+this.quote(e)+', "incremental": 1'+this.rm()+t+"}"):'{ "incremental": 0 }'},T.yA=function(t,e){return this.$x(t,e)},T.np=function(t){return t===void 0&&(t=yp(this,this)),'{ "class": '+this.quote(t)+this.rm()+this.Rv()+"}"},T.toJSON=function(t){return this.np(t)},T.Zw=function(t){var e=null;if(typeof t=="string")try{e=Z.JSON.parse(t)}catch(n){}else typeof t=="object"?e=t:lt("Unable to modify a Model from: "+t);var i=e.incremental;typeof i!="number"&&lt("Unable to apply non-incremental changes to Model: "+t),i!==0&&(this.Ea("applyIncrementalJson"),this.fp(e),this.eb("applyIncrementalJson"))},T.Ky=function(t){return this.Zw(t)},Ve.constructGraphLinksModel=function(){return new Ve},T=Ve.prototype,T.dm=function(t){if(ce(t))for(var e=t.length,i=0;i<e;i++){var n=t[i];if(Tt(n)){var s=i;n=this.dm(n),Array.isArray(t)?t[s]=n:lt("Cannot replace an object in an HTMLCollection or NodeList at "+s)}}else if(Tt(t)){for(e in t)if(i=t[e],Tt(i)&&(i=this.dm(i),t[e]=i,e==="points"&&Array.isArray(i))){for(s=i.length%2===0,n=0;n<i.length;n++)if(typeof i[n]!="number"){s=!1;break}if(s){for(s=new Kt,n=0;n<i.length/2;n++)s.add(new z(i[2*n],i[2*n+1]));s.freeze(),t[e]=s}}return yx(t)}return t},T.sm=function(t){return t===void 0?"undefined":t===null?"null":t===!0?"true":t===!1?"false":typeof t=="string"?this.quote(t):typeof t=="number"?t===1/0?"9e9999":t===-1/0?"-9e9999":isNaN(t)?'{"class":"NaN"}':t.toString():t instanceof Date?'{"class":"Date", "value":"'+t.toJSON()+'"}':t instanceof Number?this.sm(t.valueOf()):ce(t)?hs(this,t):Tt(t)?Ey(this,t):typeof t=="function"?"null":t.toString()};function hs(t,e,i){i===void 0&&(i=!1);var n=e.length;if(0>=n)return"[]";var s=new pi;s.add("["),i&&1<n&&s.add(`
`);for(var a=0;a<n;a++){var l=e[a];l!==void 0&&(0<a&&(s.add(","),i&&s.add(`
`)),s.add(t.sm(l)))}return i&&1<n&&s.add(`
`),s.add("]"),s.toString()}function vx(t,e){return e===void 0||t==="__gohashid"||t[0]==="_"||typeof e=="function"}function ia(t){return isNaN(t)?"NaN":t===1/0?"9e9999":t===-1/0?"-9e9999":t}function Ey(t,e){var i=e;if(i instanceof z)e={class:"go.Point",x:ia(i.x),y:ia(i.y)};else if(i instanceof ii)e={class:"go.Size",width:ia(i.width),height:ia(i.height)};else if(i instanceof It)e={class:"go.Rect",x:ia(i.x),y:ia(i.y),width:ia(i.width),height:ia(i.height)};else if(i instanceof ai)e={class:"go.Margin",top:ia(i.top),right:ia(i.right),bottom:ia(i.bottom),left:ia(i.left)};else if(i instanceof Ze)i.sb()?e={class:"go.Spot",x:ia(i.x),y:ia(i.y),offsetX:ia(i.offsetX),offsetY:ia(i.offsetY)}:e={class:"go.Spot",enum:i.toString()};else if(i instanceof Tn){if(e={class:"go.Brush",type:i.type.name},i.type===$h?e.color=i.color:(i.type===Kh||i.type===fl)&&(e.start=i.start,e.end=i.end,i.type===fl&&(i.startRadius!==0&&(e.startRadius=ia(i.startRadius)),isNaN(i.endRadius)||(e.endRadius=ia(i.endRadius)))),i.colorStops!==null){var n={};for(i=i.colorStops.iterator;i.next();)n[i.key]=i.value;e.colorStops=n}}else i instanceof fe?(e={class:"go.Geometry",type:i.type.name},i.startX!==0&&(e.startX=ia(i.startX)),i.startY!==0&&(e.startY=ia(i.startY)),i.endX!==0&&(e.endX=ia(i.endX)),i.endY!==0&&(e.endY=ia(i.endY)),i.spot1.D(An)||(e.spot1=i.spot1),i.spot2.D(Go)||(e.spot2=i.spot2),i.type===fe.o&&(e.path=fe.ia(i))):i instanceof mt&&(e={class:"go.EnumValue",classType:yp(t,i.classType),name:i.name});n="{",i=!0;for(var s in e){var a=eo(e,s);if(!vx(s,a))if(i?i=!1:n+=",",n+=t.quote(s)+":",s==="points"&&a instanceof Kt){var l="[";for(a=a.iterator;a.next();){var c=a.value;1<l.length&&(l+=","),l+=t.sm(c.x),l+=",",l+=t.sm(c.y)}l+="]",n+=l}else n+=t.sm(a)}return n+"}"}function Ts(t){return typeof t=="number"?t:t==="NaN"?NaN:t==="9e9999"?1/0:t==="-9e9999"?-1/0:parseFloat(t)}function yx(t){if(typeof t!="object")return t;var e=t.class||"";if(e==="NaN")return NaN;if(e==="Date")return new Date(t.value);if(e.indexOf("go.")!==0)return t;e=e.substr(3);var i=t;if(e==="Point")i=new z(Ts(t.x),Ts(t.y));else if(e==="Size")i=new ii(Ts(t.width),Ts(t.height));else if(e==="Rect")i=new It(Ts(t.x),Ts(t.y),Ts(t.width),Ts(t.height));else if(e==="Margin")i=new ai(Ts(t.top),Ts(t.right),Ts(t.bottom),Ts(t.left));else if(e==="Spot")typeof t.enum=="string"?i=tc(t.enum):i=new Ze(Ts(t.x),Ts(t.y),Ts(t.offsetX),Ts(t.offsetY));else if(e==="Brush"){if(i=new Tn,i.type=Xe(Tn,t.type),typeof t.color=="string"&&(i.color=t.color),t.start instanceof Ze&&(i.start=t.start),t.end instanceof Ze&&(i.end=t.end),typeof t.startRadius=="number"&&(i.startRadius=Ts(t.startRadius)),typeof t.endRadius=="number"&&(i.endRadius=Ts(t.endRadius)),t=t.colorStops,Tt(t))for(var n in t)i.addColorStop(parseFloat(n),t[n])}else e==="Geometry"?(i=null,typeof t.path=="string"?i=fe.parse(t.path):i=new fe,i.type=Xe(fe,t.type),typeof t.startX=="number"&&(i.startX=Ts(t.startX)),typeof t.startY=="number"&&(i.startY=Ts(t.startY)),typeof t.endX=="number"&&(i.endX=Ts(t.endX)),typeof t.endY=="number"&&(i.endY=Ts(t.endY)),t.spot1 instanceof Ze&&(i.spot1=t.spot1),t.spot2 instanceof Ze&&(i.spot2=t.spot2)):e==="EnumValue"&&(n=t.classType,n.indexOf("go.")===0&&(n=n.substr(3)),n=yv(n),typeof n=="function"&&(i=Xe(n,t.name)));return i}T.Pe=function(t){return this.Lt.add(t),this},T.ik=function(t){this.Lt.remove(t)},T.ds=function(t){this.skipsUndoManager||this.undoManager.Tu(t);for(var e=this.Lt,i=e.length,n=0;n<i;n++)e.M(n)(t)},T.cb=function(t,e,i,n,s,a,l){Co(this,"",t,e,i,n,s,a,l)},T.g=function(t,e,i,n,s){Co(this,"",Sr,t,this,e,i,n,s)},T.Fs=function(t,e,i,n,s,a){Co(this,"",Sr,e,t,i,n,s,a)};function Co(t,e,i,n,s,a,l,c,f){c===void 0&&(c=null),f===void 0&&(f=null);var m=new Cr;m.model=t,m.change=i,m.modelChange=e,m.propertyName=n,m.object=s,m.oldValue=a,m.oldParam=c,m.newValue=l,m.newParam=f,t.ds(m)}Ve.prototype.changeState=function(t,e){if(t!==null&&t.model===this)if(t.change===Sr){var i=t.object,n=t.propertyName,s=t.I(e);n===this.nodeKeyProperty&&this.lb(i)&&(e=t.I(!e),e!==void 0&&this.kb.remove(e),s!==void 0&&this.kb.add(s,i)),mr(i,n,s)}else t.change===Yr?(i=t.newParam,t.modelChange==="nodeDataArray"?(t=t.newValue,Tt(t)&&typeof i=="number"&&(n=this.wa(t),e?(this.Tc[i]===t&&Mi(this.Tc,i),n!==void 0&&this.kb.remove(n)):(this.Tc[i]!==t&&li(this.Tc,i,t),n!==void 0&&this.kb.add(n,t)))):t.modelChange===""?((n=t.object)&&!ce(n)&&t.propertyName&&(n=eo(t.object,t.propertyName)),ce(n)&&typeof i=="number"&&(t=t.newValue,e?Mi(n,i):li(n,i,t))):lt("unknown ChangedEvent.Insert modelChange: "+t.toString())):t.change===Jr?(i=t.oldParam,t.modelChange==="nodeDataArray"?(t=t.oldValue,Tt(t)&&typeof i=="number"&&(n=this.wa(t),e?(this.Tc[i]!==t&&li(this.Tc,i,t),n!==void 0&&this.kb.add(n,t)):(this.Tc[i]===t&&Mi(this.Tc,i),n!==void 0&&this.kb.remove(n)))):t.modelChange===""?((n=t.object)&&!ce(n)&&t.propertyName&&(n=eo(t.object,t.propertyName)),ce(n)&&typeof i=="number"&&(t=t.oldValue,e?li(n,i,t):Mi(n,i))):lt("unknown ChangedEvent.Remove modelChange: "+t.toString())):t.change!==wa&&lt("unknown ChangedEvent: "+t.toString())},Ve.prototype.Ea=function(t){return this.undoManager.Ea(t)},Ve.prototype.eb=function(t){return this.undoManager.eb(t)},Ve.prototype.Kf=function(){return this.undoManager.Kf()},Ve.prototype.commit=function(t,e){e===void 0&&(e="");var i=this.skipsUndoManager;e===null&&(this.skipsUndoManager=!0,e=""),this.undoManager.Ea(e);var n=!1;try{t(this),n=!0}finally{n?this.undoManager.eb(e):this.undoManager.Kf(),this.skipsUndoManager=i}},T=Ve.prototype,T.La=function(t,e){e===void 0&&(e=""),Co(this,"SourceChanged",wa,e,t,null,null)},T.wa=function(t){if(t!==null){var e=this.Th;if(e!==""&&(e=eo(t,e),e!==void 0)){if(cf(e))return e;lt("Key value for node data "+t+" is not a number or a string: "+e)}}},T.km=function(t,e){if(t!==null){var i=this.Th;if(i!=="")if(this.lb(t)){var n=eo(t,i);n!==e&&this.hc(e)===null&&(mr(t,i,e),n!==void 0&&this.kb.remove(n),this.kb.add(e,t),Co(this,"nodeKey",Sr,i,t,n,e),typeof i=="string"&&this.La(t,i),this.jp(n,e))}else mr(t,i,e)}};function cf(t){return typeof t=="number"||typeof t=="string"}T.lb=function(t){var e=this.wa(t);return e===void 0?!1:this.kb.I(e)===t},T.hc=function(t){return t===null&&lt("Model.findNodeDataForKey:key must not be null"),t!==void 0&&cf(t)?this.kb.I(t):null},T.$u=function(t){if(t!==null){var e=this.Th;if(e!==""){var i=this.wa(t);if(i===void 0||this.kb.contains(i)){var n=this.bl;if(n!==null&&(i=n(this,t),i!=null&&!this.kb.contains(i))){mr(t,e,i);return}if(typeof i=="string"){for(n=2;this.kb.contains(i+n);)n++;mr(t,e,i+n)}else if(i===void 0||typeof i=="number"){for(i=-this.kb.count-1;this.kb.contains(i);)i--;mr(t,e,i)}}}}},T.xf=function(t){t!==null&&(Qi(t),this.lb(t)||vv(this,t,!0))};function vv(t,e,i){var n=t.wa(e);(n===void 0||t.kb.I(n)!==e)&&(t.$u(e),n=t.wa(e),n===void 0&&lt("Model.makeNodeDataKeyUnique failed on "+e+". Data not added to Model."),t.kb.add(n,e),n=null,i&&(n=t.Tc.length,li(t.Tc,n,e)),Co(t,"nodeDataArray",Yr,"nodeDataArray",t,null,e,null,n),t.fm(e),t.em(e))}T.Fy=function(t){if(ce(t))for(var e=t.length,i=0;i<e;i++)this.xf(t[i]);else for(t=t.iterator;t.next();)this.xf(t.value)},T.cm=function(t){t!==null&&vp(this,t,!0)};function vp(t,e,i){var n=t.wa(e);if(n!==void 0&&t.kb.remove(n),n=null,i){t:if(i=t.Tc,Array.isArray(i))n=i.indexOf(e);else{n=i.length;for(var s=0;s<n;s++)if(i[s]===e){n=s;break t}n=-1}if(0>n)return;Mi(t.Tc,n)}Co(t,"nodeDataArray",Jr,"nodeDataArray",t,e,null,n,null),t.qp(e)}T.nA=function(t){if(ce(t))for(var e=t.length,i=0;i<e;i++)this.cm(t[i]);else for(t=t.iterator;t.next();)this.cm(t.value)},T.$z=function(t){if(t!==this.nodeDataArray&&ce(t)){var e=this.kl;e.clear(),e.addAll(this.kb.iteratorKeys);var i=this.il;i.clear();for(var n=t.length,s=0;s<n;s++){var a=t[s],l=this.wa(a);if(l!==void 0){i.add(l);var c=this.hc(l);c!==a&&(c!==null?(this.Do(c,a),this.lm(a,c)):(a=this.cloneDeep(a),this.km(a,l),this.xf(a)))}else l=this.cloneDeep(a),this.xf(l),i.add(this.wa(l))}for(t=e.iterator;t.next();)n=t.value,i.contains(n)||(n=this.hc(n))&&this.cm(n);e.clear(),i.clear()}},T.jp=function(t,e){e!==void 0&&(t=Vm(this,t),t instanceof At&&this.Vf.add(e,t))},T.Lv=function(){},T.fm=function(){},T.em=function(){},T.qp=function(){};function du(t,e,i){if(e!==void 0){var n=t.Vf.I(e);n===null&&(n=new At,t.Vf.add(e,n)),n.add(i)}}function Al(t,e,i){if(e!==void 0){var n=t.Vf.I(e);n instanceof At&&(i==null?t.Vf.remove(e):(n.remove(i),n.count===0&&t.Vf.remove(e)))}}function Vm(t,e){return e===void 0?null:(t=t.Vf.I(e),t instanceof At?t:null)}T.Qy=function(t){t===void 0?this.Vf.clear():this.Vf.remove(t)},Ve.prototype.copyNodeData=function(t){if(t===null)return null;var e=this.Bk;return t=e!==null?e(t,this):E0(this,t,!0),Tt(t)&&vi(t),t};function E0(t,e,i){if(t.copiesArrays&&Array.isArray(e)){var n=[];for(i=0;i<e.length;i++){var s=E0(t,e[i],t.copiesArrayObjects);n.push(s)}return vi(n),n}if(i&&Tt(e)){i=(i=e.constructor)?new i:{},s=t.copiesKey||typeof t.nodeKeyProperty!="string"?null:t.nodeKeyProperty;for(n in e)if(n==="__gohashid")i.__gohashid=void 0;else if(n===s)i[s]=void 0;else{var a=eo(e,n),l=yp(t,a);l==="GraphObject"||l==="Diagram"||l==="Layer"||l==="RowColumnDefinition"||l==="AnimationManager"||l==="Tool"||l==="CommandHandler"||l==="Layout"||l==="InputEvent"||l==="DiagramEvent"||a instanceof Ve||a instanceof Tr||a instanceof Bo||a instanceof Cr||(a=E0(t,a,!1)),mr(i,n,a)}return vi(i),i}return e instanceof z||e instanceof ii||e instanceof It||e instanceof Ze||e instanceof ai?e.copy():e}Ve.prototype.setDataProperty=function(t,e,i){if(this.lb(t)){if(e===this.nodeKeyProperty){this.km(t,i);return}if(e===this.nodeCategoryProperty){this.jm(t,i);return}}else!_y&&t instanceof at&&(_y=!0,Fe('Model.setDataProperty is modifying a GraphObject, "'+t.toString()+'"'),Fe(" Is that really your intent?"));var n=eo(t,e);n!==i&&(mr(t,e,i),this.Fs(t,e,n,i))},T=Ve.prototype,T.set=function(t,e,i){this.setDataProperty(t,e,i)},T.Do=function(t,e){if(e){var i=this.lb(t),n;for(n in e)n==="__gohashid"||i&&n===this.nodeKeyProperty||this.setDataProperty(t,n,e[n])}},T.Ay=function(t,e){this.ts(t,-1,e)},T.ts=function(t,e,i){0>e&&(e=t.length),li(t,e,i),Co(this,"",Yr,"",t,null,i,null,e)},T.ov=function(t,e){e===void 0&&(e=-1),t===this.Tc&&lt("Model.removeArrayItem should not be called on the Model.nodeDataArray"),e===-1&&(e=t.length-1);var i=t[e];Mi(t,e),Co(this,"",Jr,"",t,i,null,e,null)},T.Ro=function(t){if(t===null)return"";var e=this.lj;if(e===""||(e=eo(t,e),e===void 0))return"";if(typeof e=="string")return e;lt("getCategoryForNodeData found a non-string category for "+t+": "+e)},T.jm=function(t,e){if(t!==null){var i=this.lj;if(i!=="")if(this.lb(t)){var n=eo(t,i);n===void 0&&(n=""),n!==e&&(mr(t,i,e),Co(this,"nodeCategory",Sr,i,t,n,e))}else mr(t,i,e)}},T.lm=function(t,e){this.jm(e,this.Ro(t))},T.Tl=function(){return!1},T.Wj=function(){return!1},T.ri=function(){return!1},T.xs=function(){return!1},T.Xj=function(){return!1};function Wm(){return new Ve}function yp(t,e){if(typeof e=="function"){if(e.className)return e.className;if(e.name)return e.name}else if(typeof e=="object"&&e!==null&&e.constructor)return yp(t,e.constructor);return typeof e}function yv(t){return Xl[t]?Xl[t]:Z.go!==void 0&&Z.go[t]?Z.go[t]:null}function eo(t,e){if(!t||!e)return null;try{if(typeof e=="function")var i=e(t);else typeof t.getAttribute=="function"?(i=t.getAttribute(e),i===null&&(i=void 0)):i=t[e]}catch(n){}return i}function mr(t,e,i){if(t&&e)try{typeof e=="function"?e(t,i):typeof t.setAttribute=="function"?t.setAttribute(e,i):t[e]=i}catch(n){}}ct.Object.defineProperties(Ve.prototype,{name:{get:function(){return this.xa},set:function(t){var e=this.xa;e!==t&&(this.xa=t,this.g("name",e,t))}},dataFormat:{get:function(){return this.Sm},set:function(t){var e=this.Sm;e!==t&&(this.Sm=t,this.g("dataFormat",e,t))}},isReadOnly:{get:function(){return this.Gg},set:function(t){var e=this.Gg;e!==t&&(this.Gg=t,this.g("isReadOnly",e,t))}},modelData:{get:function(){return this.j},set:function(t){var e=this.j;e!==t&&(this.j=t,this.g("modelData",e,t),this.La(t))}},undoManager:{get:function(){return this.o},set:function(t){var e=this.o;e!==t&&(e!==null&&e.Rx(this),this.o=t,t!==null&&t.Xw(this))}},skipsUndoManager:{get:function(){return this.Wg},set:function(t){this.Wg=t}},nodeKeyProperty:{get:function(){return this.Th},set:function(t){var e=this.Th;e!==t&&(t===""&&lt("Model.nodeKeyProperty may not be the empty string"),0<this.kb.count&&lt("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Th=t,this.g("nodeKeyProperty",e,t))}},makeUniqueKeyFunction:{get:function(){return this.bl},set:function(t){var e=this.bl;e!==t&&(this.bl=t,this.g("makeUniqueKeyFunction",e,t))}},nodeDataArray:{get:function(){return this.Tc},set:function(t){var e=this.Tc;if(e!==t){this.kb.clear(),this.Lv();for(var i=t.length,n=0;n<i;n++){var s=t[n];Tt(s)||lt("Model.nodeDataArray must only contain Objects, not: "+s),Qi(s)}for(this.Tc=t,n=new Kt,s=0;s<i;s++){var a=t[s],l=this.wa(a);l===void 0||this.kb.I(l)!==null?n.add(a):this.kb.add(l,a)}for(n=n.iterator;n.next();)s=n.value,this.$u(s),a=this.wa(s),a!==void 0&&this.kb.add(a,s);for(Co(this,"nodeDataArray",Sr,"nodeDataArray",this,e,t),e=0;e<i;e++)n=t[e],this.fm(n),this.em(n);Array.isArray(t)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{get:function(){return this.Bk},set:function(t){var e=this.Bk;e!==t&&(this.Bk=t,this.g("copyNodeDataFunction",e,t))}},copiesArrays:{get:function(){return this.Km},set:function(t){var e=this.Km;e!==t&&(this.Km=t,this.g("copiesArrays",e,t))}},copiesArrayObjects:{get:function(){return this.Jm},set:function(t){var e=this.Jm;e!==t&&(this.Jm=t,this.g("copiesArrayObjects",e,t))}},copiesKey:{get:function(){return this.Mm},set:function(t){var e=this.Mm;e!==t&&(this.Mm=t,this.g("copiesKey",e,t))}},afterCopyFunction:{get:function(){return this.xm},set:function(t){var e=this.xm;e!==t&&(this.xm=t,this.g("afterCopyFunction",e,t))}},nodeCategoryProperty:{get:function(){return this.lj},set:function(t){var e=this.lj;e!==t&&(this.lj=t,this.g("nodeCategoryProperty",e,t))}},type:{get:function(){return"Model"}}}),Ve.prototype.setCategoryForNodeData=Ve.prototype.jm,Ve.prototype.getCategoryForNodeData=Ve.prototype.Ro,Ve.prototype.removeArrayItem=Ve.prototype.ov,Ve.prototype.insertArrayItem=Ve.prototype.ts,Ve.prototype.addArrayItem=Ve.prototype.Ay,Ve.prototype.assignAllDataProperties=Ve.prototype.Do,Ve.prototype.set=Ve.prototype.set,Ve.prototype.clearUnresolvedReferences=Ve.prototype.Qy,Ve.prototype.mergeNodeDataArray=Ve.prototype.$z,Ve.prototype.removeNodeDataCollection=Ve.prototype.nA,Ve.prototype.removeNodeData=Ve.prototype.cm,Ve.prototype.addNodeDataCollection=Ve.prototype.Fy,Ve.prototype.addNodeData=Ve.prototype.xf,Ve.prototype.makeNodeDataKeyUnique=Ve.prototype.$u,Ve.prototype.findNodeDataForKey=Ve.prototype.hc,Ve.prototype.containsNodeData=Ve.prototype.lb,Ve.prototype.setKeyForNodeData=Ve.prototype.km,Ve.prototype.getKeyForNodeData=Ve.prototype.wa,Ve.prototype.updateTargetBindings=Ve.prototype.La,Ve.prototype.commit=Ve.prototype.commit,Ve.prototype.rollbackTransaction=Ve.prototype.Kf,Ve.prototype.commitTransaction=Ve.prototype.eb,Ve.prototype.startTransaction=Ve.prototype.Ea,Ve.prototype.raiseDataChanged=Ve.prototype.Fs,Ve.prototype.raiseChanged=Ve.prototype.g,Ve.prototype.raiseChangedEvent=Ve.prototype.cb,Ve.prototype.removeChangedListener=Ve.prototype.ik,Ve.prototype.addChangedListener=Ve.prototype.Pe,Ve.prototype.writeJsonValue=Ve.prototype.sm,Ve.prototype.replaceJsonObjects=Ve.prototype.dm,Ve.prototype.applyIncrementalJSON=Ve.prototype.Ky,Ve.prototype.applyIncrementalJson=Ve.prototype.Zw,Ve.prototype.toJSON=Ve.prototype.toJSON,Ve.prototype.toJson=Ve.prototype.np,Ve.prototype.toIncrementalJSON=Ve.prototype.yA,Ve.prototype.toIncrementalJson=Ve.prototype.$x,Ve.prototype.toIncrementalData=Ve.prototype.xA,Ve.prototype.clear=Ve.prototype.clear;var _y=!1,Xl={};Ve.className="Model",Ve.fromJSON=Ve.fromJson=function(t,e){e===void 0&&(e=null);var i=null;if(typeof t=="string")try{i=Z.JSON.parse(t)}catch(a){}else typeof t=="object"?i=t:lt("Unable to construct a Model from: "+t);if(e===null){t=null;var n=i.class;if(typeof n=="string")try{var s=null;n.indexOf("go.")===0?(n=n.substr(3),s=yv(n)):(s=yv(n),s===null&&(s=Z[n])),typeof s=="function"&&(t=new s)}catch(a){}t===null||t instanceof Ve?e=t:lt("Unable to construct a Model of declared class: "+i.class)}return e===null&&(e=Ve.constructGraphLinksModel()),e.gp(i),e.kv(i),e},Ve.safePropertyValue=eo,Ve.safePropertySet=mr,Xl.Brush=Tn,Xl.ChangedEvent=Cr,Xl.Geometry=fe,Xl.Margin=ai,Xl.Panel=ne,Xl.Point=z,Xl.Rect=It,Xl.Size=ii,Xl.Spot=Ze,Xl.Transaction=Bo,Xl.UndoManager=Tr;function Un(t,e,i,n){vi(this),this._isFrozen=!1,t===void 0&&(t=""),e===void 0&&(e=t),i===void 0&&(i=null),this.j=-1,this.xd=null,this.xl=t,this.wl=this.to=0,this.Cr=null,this.wn=!1,this.sl=e,this.Im=i,n===void 0?(this.el=E1,this.wk=null):(this.el=Um,this.wk=n),this.st=new At}Un.prototype.copy=function(){var t=new Un;return t.xl=this.xl,t.to=this.to,t.wl=this.wl,t.Cr=this.Cr,t.wn=this.wn,t.sl=this.sl,t.Im=this.Im,t.el=this.el,t.wk=this.wk,t},T=Un.prototype,T.qb=function(t){t.classType===Un&&(this.mode=t)},T.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(this.Ai!==-1?" "+this.Ai:"")+" "+this.mode.name+")"},T.freeze=function(){return this._isFrozen=!0,this},T.ka=function(){return this._isFrozen=!1,this},T.Kx=function(t){return t===void 0&&(t=null),this.mode=Um,this.backConverter=t,this},T.cp=function(t){return t===void 0&&(t=""),this.sourceName=t,this.isToModel=!1,this},T.dA=function(){return this.sourceName=null,this.isToModel=!0,this};function Ty(t,e,i){return t=t.sourceName,t===null||t===""?e:t==="/"?i.part:t==="."?i:t===".."?i.panel:e.fb(t)}T.Mv=function(t,e,i){var n=this.sl;if(i===void 0||n===""||n===i){i=this.xl;var s=this.Im;if(s===null&&i==="")Fe("Binding error: target property is the empty string: "+this.toString());else{var a=e;if(n!==""&&(a=eo(e,n)),a!==void 0)if(s===null)i!==""&&mr(t,i,a);else try{if(i!==""){var l=s(a,t);mr(t,i,l)}else s(a,t)}catch(c){}}}},T.sp=function(t,e,i,n){if(this.el===Um){var s=this.xl;if(i===void 0||s===i){i=this.sl;var a=this.wk,l=t;if(s!==""&&(l=eo(t,s)),l!==void 0&&!this.st.contains(t))try{this.st.add(t);var c=n!==null?n.diagram:null,f=c!==null?c.model:null;if(a===null){if(i!=="")f!==null?f.setDataProperty(e,i,l):mr(e,i,l);else if(f!==null&&n!==null&&0<=n.itemIndex&&n.panel!==null&&Array.isArray(n.panel.itemArray)){var m=n.itemIndex,v=n.panel.itemArray;f.ov(v,m),f.ts(v,m,l)}}else try{if(i!==""){var w=a(l,e,f);f!==null?f.setDataProperty(e,i,w):mr(e,i,w)}else{var C=a(l,e,f);if(C!==void 0&&f!==null&&n!==null&&0<=n.itemIndex&&n.panel!==null&&Array.isArray(n.panel.itemArray)){var k=n.itemIndex,L=n.panel.itemArray;f.ov(L,k),f.ts(L,k,C)}}}catch(A){}}finally{this.st.remove(t)}}}},ct.Object.defineProperties(Un.prototype,{Ai:{get:function(){return this.j},set:function(t){this._isFrozen&&Qt(this),this.j=t}},targetProperty:{get:function(){return this.xl},set:function(t){this._isFrozen&&Qt(this),this.xl=t}},sourceName:{get:function(){return this.Cr},set:function(t){this._isFrozen&&Qt(this),this.Cr=t,t!==null&&(this.wn=!1)}},isToModel:{get:function(){return this.wn},set:function(t){this._isFrozen&&Qt(this),this.wn=t}},sourceProperty:{get:function(){return this.sl},set:function(t){this._isFrozen&&Qt(this),this.sl=t}},converter:{get:function(){return this.Im},set:function(t){this._isFrozen&&Qt(this),this.Im=t}},backConverter:{get:function(){return this.wk},set:function(t){this._isFrozen&&Qt(this),this.wk=t}},mode:{get:function(){return this.el},set:function(t){this._isFrozen&&Qt(this),this.el=t}}}),Un.prototype.updateSource=Un.prototype.sp,Un.prototype.updateTarget=Un.prototype.Mv,Un.prototype.ofModel=Un.prototype.dA,Un.prototype.ofObject=Un.prototype.cp,Un.prototype.makeTwoWay=Un.prototype.Kx;var xx="Binding",E1=new mt(Un,"OneWay",1),Um=new mt(Un,"TwoWay",2);Un.className="Binding",Un.parseEnum=function(t,e){return function(i){return i=Xe(t,i),i===null?e:i}},Un.toString=ni,Un.OneWay=E1,Un.TwoWay=Um;function xn(t,e,i){Ve.call(this),this.Vv=`,
"insertedLinkKeys": `,this.iy=`,
"modifiedLinkData": `,this.Xv=`,
"removedLinkKeys": `,this.md=[],this.$f=new At,this.wb=new pe,this.Jh="",this.Ri=this.Ak=this.cl=null,this.lf="from",this.mf="to",this.fj=this.ej="",this.dj="category",this.je="",this.jl="isGroup",this.Je="group",this.Lm=!1,e!==void 0&&(this.linkDataArray=e),t!==void 0&&(ce(t)?this.nodeDataArray=t:i=t),i&&(Object.assign(this,i),t=i.Changed)&&(delete this.Changed,this.Pe(t))}gi(xn,Ve),xn.constructGraphLinksModel=Ve.constructGraphLinksModel,xn.prototype.cloneProtected=function(t){Ve.prototype.cloneProtected.call(this,t),t.Jh=this.Jh,t.cl=this.cl,t.Ak=this.Ak,t.lf=this.lf,t.mf=this.mf,t.ej=this.ej,t.fj=this.fj,t.dj=this.dj,t.je=this.je,t.jl=this.jl,t.Je=this.Je,t.Lm=this.Lm},T=xn.prototype,T.clear=function(){Ve.prototype.clear.call(this),this.md=[],this.wb.clear(),this.$f.clear()},T.toString=function(t){if(t===void 0&&(t=0),2<=t)return this.np();var e=(this.name!==""?this.name:"")+" GraphLinksModel";if(0<t){e+=`
node data:`,t=this.nodeDataArray;var i=t.length,n;for(n=0;n<i;n++){var s=t[n];e+=" "+this.wa(s)+":"+ni(s)}for(e+=`
link data:`,t=this.linkDataArray,i=t.length,n=0;n<i;n++)s=t[n],e+=" "+tl(this,s,!0)+"-->"+tl(this,s,!1)}return e},T.Qv=function(t,e){this.linkKeyProperty===""&&lt("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var i=Ve.prototype.Qv.call(this,t,e),n=this,s=new At,a=new At,l=new At,c=this.vh;t.changes.each(function(v){v.model===n&&(v.modelChange==="linkDataArray"?v.change===Yr?s.add(v.newValue):v.change===Jr&&l.add(v.oldValue):n.Jc(v.object)?a.add(v.object):v.object!==null&&(v.object!==null&&c&&c.contains(v.object)?c.get(v.object).each(function(w){n.Jc(w)&&a.add(w)}):v.object instanceof Ve||n.lb(v.object)||_1(n,v.object).each(function(w){a.add(w)})))});var f=this.il;f.clear(),s.each(function(v){f.add(n.Ac(v)),e||a.add(v)});var m=this.kl;return m.clear(),l.each(function(v){m.add(n.Ac(v)),e&&a.add(v)}),t=n.cloneDeep(a.Fa()),0<f.count&&(i===null&&(i={}),e?i.removedLinkKeys=f.Fa():i.insertedLinkKeys=f.Fa()),0<t.length&&(i===null&&(i={}),i.modifiedLinkData=t),0<m.count&&(i===null&&(i={}),e?i.insertedLinkKeys=m.Fa():i.removedLinkKeys=m.Fa()),m.clear(),f.clear(),i},T.rm=function(){var t=Ve.prototype.rm.call(this),e="";return this.linkCategoryProperty!=="category"&&typeof this.linkCategoryProperty=="string"&&(e+=`,
"linkCategoryProperty": `+this.quote(this.linkCategoryProperty)),this.linkKeyProperty!==""&&typeof this.linkKeyProperty=="string"&&(e+=`,
"linkKeyProperty": `+this.quote(this.linkKeyProperty)),this.linkFromKeyProperty!=="from"&&typeof this.linkFromKeyProperty=="string"&&(e+=`,
"linkFromKeyProperty": `+this.quote(this.linkFromKeyProperty)),this.linkToKeyProperty!=="to"&&typeof this.linkToKeyProperty=="string"&&(e+=`,
"linkToKeyProperty": `+this.quote(this.linkToKeyProperty)),this.linkFromPortIdProperty!==""&&typeof this.linkFromPortIdProperty=="string"&&(e+=`,
"linkFromPortIdProperty": `+this.quote(this.linkFromPortIdProperty)),this.linkToPortIdProperty!==""&&typeof this.linkToPortIdProperty=="string"&&(e+=`,
"linkToPortIdProperty": `+this.quote(this.linkToPortIdProperty)),this.linkLabelKeysProperty!==""&&typeof this.linkLabelKeysProperty=="string"&&(e+=`,
"linkLabelKeysProperty": `+this.quote(this.linkLabelKeysProperty)),this.nodeIsGroupProperty!=="isGroup"&&typeof this.nodeIsGroupProperty=="string"&&(e+=`,
"nodeIsGroupProperty": `+this.quote(this.nodeIsGroupProperty)),this.nodeGroupKeyProperty!=="group"&&typeof this.nodeGroupKeyProperty=="string"&&(e+=`,
"nodeGroupKeyProperty": `+this.quote(this.nodeGroupKeyProperty)),t+e},T.gp=function(t){Ve.prototype.gp.call(this,t),t.linkKeyProperty&&(this.linkKeyProperty=t.linkKeyProperty),t.linkFromKeyProperty&&(this.linkFromKeyProperty=t.linkFromKeyProperty),t.linkToKeyProperty&&(this.linkToKeyProperty=t.linkToKeyProperty),t.linkFromPortIdProperty&&(this.linkFromPortIdProperty=t.linkFromPortIdProperty),t.linkToPortIdProperty&&(this.linkToPortIdProperty=t.linkToPortIdProperty),t.linkCategoryProperty&&(this.linkCategoryProperty=t.linkCategoryProperty),t.linkLabelKeysProperty&&(this.linkLabelKeysProperty=t.linkLabelKeysProperty),t.nodeIsGroupProperty&&(this.nodeIsGroupProperty=t.nodeIsGroupProperty),t.nodeGroupKeyProperty&&(this.nodeGroupKeyProperty=t.nodeGroupKeyProperty)},T.Rv=function(){var t=Ve.prototype.Rv.call(this),e=`,
"linkDataArray": `+hs(this,this.linkDataArray,!0);return t+e},T.kv=function(t){Ve.prototype.kv.call(this,t),t=t.linkDataArray,Array.isArray(t)&&(this.dm(t),this.linkDataArray=t)};function _1(t,e){for(var i=new At,n=0;n<t.linkDataArray.length;n++){var s=t.linkDataArray[n];gv(t,e,s,s,i)}return i}T.Pv=function(t,e){this.linkKeyProperty===""&&lt("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var i=Ve.prototype.Pv.call(this,t,e),n=this,s=new At,a=new At,l=new At,c=this.vh;t.changes.each(function(v){v.model===n&&(v.modelChange==="linkDataArray"?v.change===Yr?s.add(v.newValue):v.change===Jr&&l.add(v.oldValue):n.Jc(v.object)?a.add(v.object):v.object!==null&&(v.object!==null&&c&&c.contains(v.object)?c.get(v.object).each(function(w){n.Jc(w)&&a.add(w)}):v.object instanceof Ve||n.lb(v.object)||_1(n,v.object).each(function(w){a.add(w)})))});var f=this.il;f.clear(),s.each(function(v){f.add(n.Ac(v)),e||a.add(v)});var m=this.kl;return m.clear(),l.each(function(v){m.add(n.Ac(v)),e&&a.add(v)}),t=i,0<f.count&&(t+=(e?this.Xv:this.Vv)+hs(this,f.Fa(),!0)),0<a.count&&(t+=this.iy+hs(this,a.Fa(),!0)),0<m.count&&(t+=(e?this.Vv:this.Xv)+hs(this,m.Fa(),!0)),m.clear(),f.clear(),t},T.fp=function(t){(t.linkCategoryProperty!==void 0&&t.linkCategoryProperty!==this.linkCategoryProperty||t.linkKeyProperty!==void 0&&t.linkKeyProperty!==this.linkKeyProperty||t.linkFromKeyProperty!==void 0&&t.linkFromKeyProperty!==this.linkFromKeyProperty||t.linkToKeyProperty!==void 0&&t.linkToKeyProperty!==this.linkToKeyProperty||t.linkFromPortIdProperty!==void 0&&t.linkFromPortIdProperty!==this.linkFromPortIdProperty||t.linkToPortIdProperty!==void 0&&t.linkToPortIdProperty!==this.linkToPortIdProperty||t.linkLabelKeysProperty!==void 0&&t.linkLabelKeysProperty!==this.linkLabelKeysProperty||t.nodeIsGroupProperty!==void 0&&t.nodeIsGroupProperty!==this.nodeIsGroupProperty||t.nodeGroupKeyProperty!==void 0&&t.nodeGroupKeyProperty!==this.nodeGroupKeyProperty)&&lt("applyIncrementalJson cannot change Model properties"),Ve.prototype.fp.call(this,t);var e=t.insertedLinkKeys;if(Array.isArray(e))for(var i=e.length,n=0;n<i;n++){var s=e[n],a=this.jh(s);a===null&&(a=this.Jo({}),this.Ks(a,s),this.fi(a))}if(e=t.modifiedLinkData,Array.isArray(e)){for(i=e.length,n=0;n<i;n++)if(s=e[n],a=this.Ac(s),a=this.jh(a),a!==null){for(var l in s)l!=="__gohashid"&&l!==this.linkKeyProperty&&this.setDataProperty(a,l,s[l]);P1(this,s,a)}}if(t=t.removedLinkKeys,Array.isArray(t))for(l=t.length,e=0;e<l;e++)i=this.jh(t[e]),i!==null&&this.bm(i)},xn.prototype.changeState=function(t,e){if(t!==null&&t.model===this){if(t.change===Sr){var i=t.object,n=t.propertyName;if(n===this.linkKeyProperty&&this.Jc(i)){var s=t.I(e);e=t.I(!e),e!==void 0&&this.wb.remove(e),s!==void 0&&this.wb.add(s,i),mr(i,n,s);return}}else if(t.change===Yr){if(i=t.newParam,t.modelChange==="linkDataArray"){t=t.newValue,Tt(t)&&typeof i=="number"&&(n=this.Ac(t),e?(this.$f.remove(t),this.md[i]===t&&this.md.splice(i,1),n!==void 0&&this.wb.remove(n)):(this.$f.add(t),this.md[i]!==t&&this.md.splice(i,0,t),n!==void 0&&this.wb.add(n,t)));return}if(t.modelChange==="linkLabelKeys"){n=this.Ef(t.object),Array.isArray(n)&&typeof i=="number"&&(e?(i=n.indexOf(t.newValue),0<=i&&n.splice(i,1)):0>n.indexOf(t.newValue)&&n.splice(i,0,t.newValue));return}}else if(t.change===Jr){if(i=t.oldParam,t.modelChange==="linkDataArray"){t=t.oldValue,Tt(t)&&typeof i=="number"&&(n=this.Ac(t),e?(this.$f.add(t),this.md[i]!==t&&this.md.splice(i,0,t),n!==void 0&&this.wb.add(n,t)):(this.$f.remove(t),this.md[i]===t&&this.md.splice(i,1),n!==void 0&&this.wb.remove(n)));return}if(t.modelChange==="linkLabelKeys"){n=this.Ef(t.object),Array.isArray(n)&&typeof i=="number"&&(e?0>n.indexOf(t.newValue)&&n.splice(i,0,t.newValue):(i=n.indexOf(t.newValue),0<=i&&n.splice(i,1)));return}}Ve.prototype.changeState.call(this,t,e)}},T=xn.prototype,T.Vl=function(t){if(t!==void 0){var e=this.Ri;if(e!==null){var i=this.hc(t);i===null&&(i=this.copyNodeData(e),mr(i,this.nodeKeyProperty,t),this.xf(i))}return t}},T.yx=function(t){return tl(this,t,!0)},T.wv=function(t,e){_0(this,t,e,!0)},T.Bx=function(t){return tl(this,t,!1)},T.Bv=function(t,e){_0(this,t,e,!1)};function tl(t,e,i){if(e!==null&&(t=i?t.lf:t.mf,t!==""&&(t=eo(e,t),t!==void 0))){if(cf(t))return t;lt((i?"FromKey":"ToKey")+" value for link data "+e+" is not a number or a string: "+t)}}function _0(t,e,i,n){if(i===null&&(i=void 0),e!==null){var s=n?t.lf:t.mf;if(s!=="")if(i=t.Vl(i),t.Jc(e)){var a=eo(e,s);a!==i&&(Al(t,a,e),mr(e,s,i),t.hc(i)===null&&du(t,i,e),Co(t,n?"linkFromKey":"linkToKey",Sr,s,e,a,i),typeof s=="string"&&t.La(e,s))}else mr(e,s,i)}}T.zx=function(t){return xv(this,t,!0)},T.xv=function(t,e){T0(this,t,e,!0)},T.Cx=function(t){return xv(this,t,!1)},T.Cv=function(t,e){T0(this,t,e,!1)};function xv(t,e,i){return e===null||(t=i?t.ej:t.fj,t==="")?"":(e=eo(e,t),e===void 0?"":e)}function T0(t,e,i,n){if(e!==null){var s=n?t.ej:t.fj;if(s!=="")if(t.Jc(e)){var a=eo(e,s);a===void 0&&(a=""),a!==i&&(mr(e,s,i),Co(t,n?"linkFromPortId":"linkToPortId",Sr,s,e,a,i),typeof s=="string"&&t.La(e,s))}else mr(e,s,i)}}T.Ef=function(t){if(t===null)return ff;var e=this.je;return e===""?ff:(t=eo(t,e),t===void 0?ff:t)},T.Ls=function(t,e){if(t!==null){var i=this.je;if(i!=="")if(this.Jc(t)){var n=eo(t,i);if(n===void 0&&(n=ff),n!==e){if(Array.isArray(n))for(var s=n.length,a=0;a<s;a++)Al(this,n[a],t);for(mr(t,i,e),s=e.length,a=0;a<s;a++){var l=e[a];this.hc(l)===null&&du(this,l,t)}Co(this,"linkLabelKeys",Sr,i,t,n,e),typeof i=="string"&&this.La(t,i)}}else mr(t,i,e)}},T.Bu=function(t,e){if(e!=null&&t!==null){var i=this.je;if(i!==""){var n=eo(t,i);if(n===void 0)i=[],i.push(e),this.Ls(t,i);else if(Array.isArray(n)){var s=n.indexOf(e);0<=s||(s=n.length,n.push(e),this.Jc(t)&&(this.hc(e)===null&&du(this,e,t),Co(this,"linkLabelKeys",Yr,i,t,null,e,null,s)))}else lt(i+" property is not an Array; cannot addLabelKeyForLinkData: "+t)}}},T.Qx=function(t,e){if(e!=null&&t!==null){var i=this.je;if(i!==""){var n=eo(t,i);if(Array.isArray(n)){var s=n.indexOf(e);0>s||(n.splice(s,1),this.Jc(t)&&(Al(this,e,t),Co(this,"linkLabelKeys",Jr,i,t,e,null,s,null)))}else n!==void 0&&lt(i+" property is not an Array; cannot removeLabelKeyforLinkData: "+t)}}},T.Ac=function(t){if(t!==null){var e=this.Jh;if(e!==""&&(e=eo(t,e),e!==void 0)){if(cf(e))return e;lt("Key value for link data "+t+" is not a number or a string: "+e)}}},T.Ks=function(t,e){if(t!==null){var i=this.Jh;if(i!=="")if(this.Jc(t)){var n=eo(t,i);n!==e&&this.jh(e)===null&&(mr(t,i,e),n!==void 0&&this.wb.remove(n),this.wb.add(e,t),Co(this,"linkKey",Sr,i,t,n,e),typeof i=="string"&&this.La(t,i))}else mr(t,i,e)}},T.jh=function(t){return t===null&&lt("GraphLinksModel.findLinkDataForKey:key must not be null"),t!==void 0&&cf(t)?this.wb.I(t):null},T.Bs=function(t){if(t!==null){var e=this.Jh;if(e!==""){var i=this.Ac(t);if(i===void 0||this.wb.contains(i)){var n=this.cl;if(n!==null&&(i=n(this,t),i!=null&&!this.wb.contains(i))){mr(t,e,i);return}if(typeof i=="string"){for(n=2;this.wb.contains(i+n);)n++;mr(t,e,i+n)}else if(i===void 0||typeof i=="number"){for(i=-this.wb.count-1;this.wb.contains(i);)i--;mr(t,e,i)}}}}},T.Jc=function(t){return t===null?!1:this.$f.contains(t)},T.fi=function(t){t!==null&&(Qi(t),this.Jc(t)||T1(this,t,!0))};function T1(t,e,i){if(t.linkKeyProperty!==""){var n=t.Ac(e);if(n!==void 0&&t.wb.I(n)===e)return;t.Bs(e),n=t.Ac(e),n===void 0&&lt("GraphLinksModel.makeLinkDataKeyUnique failed on "+e+". Data not added to model."),t.wb.add(n,e)}t.$f.add(e),n=null,i&&(n=t.md.length,t.md.splice(n,0,e)),Co(t,"linkDataArray",Yr,"linkDataArray",t,null,e,null,n),Py(t,e)}T.Ey=function(t){if(Array.isArray(t))for(var e=t.length,i=0;i<e;i++)this.fi(t[i]);else for(t=t.iterator;t.next();)this.fi(t.value)},T.bm=function(t){t!==null&&df(this,t,!0)};function df(t,e,i){t.$f.remove(e);var n=t.Ac(e);if(n!==void 0&&t.wb.remove(n),n=null,i){if(n=t.md.indexOf(e),0>n)return;t.md.splice(n,1)}if(Co(t,"linkDataArray",Jr,"linkDataArray",t,e,null,n,null),i=tl(t,e,!0),Al(t,i,e),i=tl(t,e,!1),Al(t,i,e),n=t.Ef(e),Array.isArray(n))for(var s=n.length,a=0;a<s;a++)i=n[a],Al(t,i,e)}T.lA=function(t){if(Array.isArray(t))for(var e=t.length,i=0;i<e;i++)this.bm(t[i]);else for(t=t.iterator;t.next();)this.bm(t.value)},T.Zz=function(t){if(this.linkKeyProperty===""&&lt("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed."),t!==this.linkDataArray&&ce(t)){var e=this.kl;e.clear(),e.addAll(this.wb.iteratorKeys);var i=this.il;i.clear();for(var n=t.length,s=0;s<n;s++){var a=t[s],l=this.Ac(a);if(l!==void 0){i.add(l);var c=this.jh(l);c!==a&&(c!==null?(this.Do(c,a),P1(this,a,c)):(a=this.cloneDeep(a),this.Ks(a,l),this.fi(a)))}else l=this.cloneDeep(a),this.fi(l),i.add(this.Ac(l))}for(t=e.iterator;t.next();)n=t.value,i.contains(n)||(n=this.jh(n))&&this.bm(n);e.clear(),i.clear()}};function Py(t,e){var i=tl(t,e,!0);i=t.Vl(i),t.hc(i)===null&&du(t,i,e),i=tl(t,e,!1),i=t.Vl(i),t.hc(i)===null&&du(t,i,e);var n=t.Ef(e);if(Array.isArray(n))for(var s=n.length,a=0;a<s;a++)i=n[a],t.hc(i)===null&&du(t,i,e)}T.Jo=function(t){if(t===null)return null;var e=this.Ak;return t=e!==null?e(t,this):E0(this,t,!0),Tt(t)&&(vi(t),this.lf!==""&&mr(t,this.lf,void 0),this.mf!==""&&mr(t,this.mf,void 0),this.je!==""&&mr(t,this.je,[])),t},T.Yu=function(t){if(t===null)return!1;var e=this.jl;return e===""?!1:!!eo(t,e)},T.lh=function(t){if(t!==null){var e=this.Je;if(e!==""&&(e=eo(t,e),e!==void 0)){if(cf(e))return e;lt("GroupKey value for node data "+t+" is not a number or a string: "+e)}}},T.mp=function(t,e){if(e===null&&(e=void 0),t!==null){var i=this.Je;if(i!=="")if(this.lb(t)){var n=eo(t,i);n!==e&&(Al(this,n,t),mr(t,i,e),this.hc(e)===null&&du(this,e,t),Co(this,"nodeGroupKey",Sr,i,t,n,e),typeof i=="string"&&this.La(t,i))}else mr(t,i,e)}},xn.prototype.copyNodeData=function(t){return t===null?null:(t=Ve.prototype.copyNodeData.call(this,t),this.Ij||this.Je===""||eo(t,this.Je)===void 0||mr(t,this.Je,void 0),t)},xn.prototype.setDataProperty=function(t,e,i){if(this.lb(t)){if(e===this.nodeKeyProperty){this.km(t,i);return}if(e===this.nodeCategoryProperty){this.jm(t,i);return}if(e===this.nodeGroupKeyProperty){this.mp(t,i);return}}else if(this.Jc(t)){if(e===this.linkFromKeyProperty){_0(this,t,i,!0);return}if(e===this.linkToKeyProperty){_0(this,t,i,!1);return}if(e===this.linkFromPortIdProperty){T0(this,t,i,!0);return}if(e===this.linkToPortIdProperty){T0(this,t,i,!1);return}if(e===this.linkKeyProperty){this.Ks(t,i);return}if(e===this.linkCategoryProperty){this.lp(t,i);return}if(e===this.linkLabelKeysProperty){this.Ls(t,i);return}}var n=eo(t,e);n!==i&&(mr(t,e,i),this.Fs(t,e,n,i))},T=xn.prototype,T.Do=function(t,e){if(e){var i=this.lb(t),n=this.Jc(t),s;for(s in e)s==="__gohashid"||i&&s===this.nodeKeyProperty||i&&s===this.nodeIsGroupProperty&&eo(t,s)===e[s]||n&&s===this.linkKeyProperty||this.setDataProperty(t,s,e[s])}},T.jp=function(t,e){Ve.prototype.jp.call(this,t,e);for(var i=this.kb.iterator;i.next();)this.qv(i.value,t,e);for(i=this.$f.iterator;i.next();){var n=i.value,s=t,a=e;if(tl(this,n,!0)===s){var l=this.lf;mr(n,l,a),Co(this,"linkFromKey",Sr,l,n,s,a),typeof l=="string"&&this.La(n,l)}if(tl(this,n,!1)===s&&(l=this.mf,mr(n,l,a),Co(this,"linkToKey",Sr,l,n,s,a),typeof l=="string"&&this.La(n,l)),l=this.Ef(n),Array.isArray(l))for(var c=l.length,f=this.je,m=0;m<c;m++)l[m]===s&&(l[m]=a,Co(this,"linkLabelKeys",Yr,f,n,s,a,m,m))}},T.qv=function(t,e,i){if(this.lh(t)===e){var n=this.Je;mr(t,n,i),Co(this,"nodeGroupKey",Sr,n,t,e,i),typeof n=="string"&&this.La(t,n)}},T.Lv=function(){Ve.prototype.Lv.call(this);for(var t=this.linkDataArray,e=t.length,i=0;i<e;i++)Py(this,t[i])},T.fm=function(t){Ve.prototype.fm.call(this,t),t=this.wa(t);var e=Vm(this,t);if(e!==null){var i=Pe();for(e=e.iterator;e.next();){var n=e.value;if(this.lb(n)){if(this.lh(n)===t){var s=this.Je;Co(this,"nodeGroupKey",Sr,s,n,t,t),typeof s=="string"&&this.La(n,s),i.push(n)}}else if(tl(this,n,!0)===t&&(s=this.lf,Co(this,"linkFromKey",Sr,s,n,t,t),typeof s=="string"&&this.La(n,s),i.push(n)),tl(this,n,!1)===t&&(s=this.mf,Co(this,"linkToKey",Sr,s,n,t,t),typeof s=="string"&&this.La(n,s),i.push(n)),s=this.Ef(n),Array.isArray(s))for(var a=s.length,l=this.je,c=0;c<a;c++)s[c]===t&&(Co(this,"linkLabelKeys",Yr,l,n,t,t,c,c),i.push(n))}for(e=0;e<i.length;e++)Al(this,t,i[e]);qe(i)}},T.em=function(t){Ve.prototype.em.call(this,t);var e=this.lh(t);this.hc(e)===null&&du(this,e,t)},T.qp=function(t){Ve.prototype.qp.call(this,t);var e=this.lh(t);Al(this,e,t)},T.ps=function(t){if(t===null)return"";var e=this.dj;if(e===""||(e=eo(t,e),e===void 0))return"";if(typeof e=="string")return e;lt("getCategoryForLinkData found a non-string category for "+t+": "+e)},xn.prototype.getLinkCategoryForData=function(t){return this.ps(t)},xn.prototype.lp=function(t,e){if(t!==null){var i=this.dj;if(i!=="")if(this.Jc(t)){var n=eo(t,i);n===void 0&&(n=""),n!==e&&(mr(t,i,e),Co(this,"linkCategory",Sr,i,t,n,e),typeof i=="string"&&this.La(t,i))}else mr(t,i,e)}},xn.prototype.setLinkCategoryForData=function(t,e){this.lp(t,e)},T=xn.prototype,T.lm=function(t,e){Ve.prototype.lm.call(this,t,e),this.mp(e,this.lh(t))};function P1(t,e,i){t.lp(i,t.ps(e)),t.wv(i,t.yx(e)),t.Bv(i,t.Bx(e)),t.Ls(i,t.Ef(e)),t.xv(i,t.zx(e)),t.Cv(i,t.Cx(e))}T.Wj=function(){return!0},T.ri=function(){return!0},T.xs=function(){return!0},T.Xj=function(){return!0},ct.Object.defineProperties(xn.prototype,{archetypeNodeData:{get:function(){return this.Ri},set:function(t){var e=this.Ri;e!==t&&(this.Ri=t,this.g("archetypeNodeData",e,t))}},linkFromKeyProperty:{get:function(){return this.lf},set:function(t){var e=this.lf;e!==t&&(this.lf=t,this.g("linkFromKeyProperty",e,t))}},linkToKeyProperty:{get:function(){return this.mf},set:function(t){var e=this.mf;e!==t&&(this.mf=t,this.g("linkToKeyProperty",e,t))}},linkFromPortIdProperty:{get:function(){return this.ej},set:function(t){var e=this.ej;e!==t&&(this.ej=t,this.g("linkFromPortIdProperty",e,t))}},linkToPortIdProperty:{get:function(){return this.fj},set:function(t){var e=this.fj;e!==t&&(this.fj=t,this.g("linkToPortIdProperty",e,t))}},linkLabelKeysProperty:{get:function(){return this.je},set:function(t){var e=this.je;e!==t&&(this.je=t,this.g("linkLabelKeysProperty",e,t))}},linkDataArray:{get:function(){return this.md},set:function(t){var e=this.md;if(e!==t){this.wb.clear();for(var i=t.length,n=0;n<i;n++){var s=t[n];Tt(s)||lt("GraphLinksModel.linkDataArray must only contain Objects, not: "+s),Qi(s)}if(this.md=t,this.linkKeyProperty!==""){for(n=new Kt,s=0;s<i;s++){var a=t[s],l=this.Ac(a);l===void 0||this.wb.I(l)!==null?n.add(a):this.wb.add(l,a)}for(n=n.iterator;n.next();)s=n.value,this.Bs(s),a=this.Ac(s),a!==void 0&&this.wb.add(a,s)}for(n=new At,s=0;s<i;s++)n.add(t[s]);for(this.$f=n,Co(this,"linkDataArray",Sr,"linkDataArray",this,e,t),e=0;e<i;e++)Py(this,t[e])}}},linkKeyProperty:{get:function(){return this.Jh},set:function(t){var e=this.Jh;if(e!==t){this.Jh=t,this.wb.clear();for(var i=this.linkDataArray.length,n=0;n<i;n++){var s=this.linkDataArray[n],a=this.Ac(s);a===void 0&&(this.Bs(s),a=this.Ac(s)),a!==void 0&&this.wb.add(a,s)}this.g("linkKeyProperty",e,t)}}},makeUniqueLinkKeyFunction:{get:function(){return this.cl},set:function(t){var e=this.cl;e!==t&&(this.cl=t,this.g("makeUniqueLinkKeyFunction",e,t))}},copyLinkDataFunction:{get:function(){return this.Ak},set:function(t){var e=this.Ak;e!==t&&(this.Ak=t,this.g("copyLinkDataFunction",e,t))}},nodeIsGroupProperty:{get:function(){return this.jl},set:function(t){var e=this.jl;e!==t&&(this.jl=t,this.g("nodeIsGroupProperty",e,t))}},nodeGroupKeyProperty:{get:function(){return this.Je},set:function(t){var e=this.Je;e!==t&&(this.Je=t,this.g("nodeGroupKeyProperty",e,t))}},Ij:{get:function(){return this.Lm},set:function(t){this.Lm!==t&&(this.Lm=t)}},linkCategoryProperty:{get:function(){return this.dj},set:function(t){var e=this.dj;e!==t&&(this.dj=t,this.g("linkCategoryProperty",e,t))}},type:{get:function(){return"GraphLinksModel"}}}),xn.prototype.setCategoryForLinkData=xn.prototype.lp,xn.prototype.getCategoryForLinkData=xn.prototype.ps,xn.prototype.assignAllDataProperties=xn.prototype.Do,xn.prototype.setGroupKeyForNodeData=xn.prototype.mp,xn.prototype.getGroupKeyForNodeData=xn.prototype.lh,xn.prototype.isGroupForNodeData=xn.prototype.Yu,xn.prototype.copyLinkData=xn.prototype.Jo,xn.prototype.mergeLinkDataArray=xn.prototype.Zz,xn.prototype.removeLinkDataCollection=xn.prototype.lA,xn.prototype.removeLinkData=xn.prototype.bm,xn.prototype.addLinkDataCollection=xn.prototype.Ey,xn.prototype.addLinkData=xn.prototype.fi,xn.prototype.containsLinkData=xn.prototype.Jc,xn.prototype.makeLinkDataKeyUnique=xn.prototype.Bs,xn.prototype.findLinkDataForKey=xn.prototype.jh,xn.prototype.setKeyForLinkData=xn.prototype.Ks,xn.prototype.getKeyForLinkData=xn.prototype.Ac,xn.prototype.removeLabelKeyForLinkData=xn.prototype.Qx,xn.prototype.addLabelKeyForLinkData=xn.prototype.Bu,xn.prototype.setLabelKeysForLinkData=xn.prototype.Ls,xn.prototype.getLabelKeysForLinkData=xn.prototype.Ef,xn.prototype.setToPortIdForLinkData=xn.prototype.Cv,xn.prototype.getToPortIdForLinkData=xn.prototype.Cx,xn.prototype.setFromPortIdForLinkData=xn.prototype.xv,xn.prototype.getFromPortIdForLinkData=xn.prototype.zx,xn.prototype.setToKeyForLinkData=xn.prototype.Bv,xn.prototype.getToKeyForLinkData=xn.prototype.Bx,xn.prototype.setFromKeyForLinkData=xn.prototype.wv,xn.prototype.getFromKeyForLinkData=xn.prototype.yx,xn.prototype.clear=xn.prototype.clear;var ff=Object.freeze([]);xn.className="GraphLinksModel",Xl.GraphLinksModel=xn,Ve.constructGraphLinksModel=Ve.constructGraphLinksModel=function(){return new xn},Ve.initDiagramModel=Wm=function(){return new xn};function na(t,e){Ve.call(this),this.Ke="parent",this.Nm=!1,this.nj="parentLinkCategory",t!==void 0&&(ce(t)?this.nodeDataArray=t:e=t),e&&(Object.assign(this,e),t=e.Changed)&&(delete this.Changed,this.Pe(t))}gi(na,Ve),na.constructGraphLinksModel=Ve.constructGraphLinksModel,na.prototype.cloneProtected=function(t){Ve.prototype.cloneProtected.call(this,t),t.Ke=this.Ke,t.Nm=this.Nm,t.nj=this.nj},T=na.prototype,T.toString=function(t){if(t===void 0&&(t=0),2<=t)return this.np();var e=(this.name!==""?this.name:"")+" TreeModel";if(0<t){e+=`
node data:`,t=this.nodeDataArray;for(var i=t.length,n=0;n<i;n++){var s=t[n];e+=" "+this.wa(s)+":"+ni(s)}}return e},T.rm=function(){var t=Ve.prototype.rm.call(this),e="";return this.nodeParentKeyProperty!=="parent"&&typeof this.nodeParentKeyProperty=="string"&&(e+=`,
"nodeParentKeyProperty": `+this.quote(this.nodeParentKeyProperty)),t+e},T.gp=function(t){Ve.prototype.gp.call(this,t),t.nodeParentKeyProperty&&(this.nodeParentKeyProperty=t.nodeParentKeyProperty)},T.fp=function(t){t.nodeParentKeyProperty!==void 0&&t.nodeParentKeyProperty!==this.nodeParentKeyProperty&&lt("applyIncrementalJson cannot change Model properties"),Ve.prototype.fp.call(this,t)},T.Vl=function(t){return t},T.mh=function(t){if(t!==null){var e=this.Ke;if(e!==""&&(e=eo(t,e),e!==void 0)){if(cf(e))return e;lt("ParentKey value for node data "+t+" is not a number or a string: "+e)}}},T.qe=function(t,e){if(e===null&&(e=void 0),t!==null){var i=this.Ke;if(i!=="")if(e=this.Vl(e),this.lb(t)){var n=eo(t,i);n!==e&&(Al(this,n,t),mr(t,i,e),this.hc(e)===null&&du(this,e,t),Co(this,"nodeParentKey",Sr,i,t,n,e),typeof i=="string"&&this.La(t,i))}else mr(t,i,e)}},T.ss=function(t){if(t===null)return"";var e=this.nj;return e===""||(e=eo(t,e),e===void 0)?"":typeof e=="string"?e:(lt("getParentLinkCategoryForNodeData found a non-string category for "+t+": "+e),"")},na.prototype.getLinkCategoryForData=function(t){return this.ss(t)},na.prototype.Ms=function(t,e){if(t!==null){var i=this.nj;if(i!=="")if(this.lb(t)){var n=eo(t,i);n===void 0&&(n=""),n!==e&&(mr(t,i,e),Co(this,"parentLinkCategory",Sr,i,t,n,e),typeof i=="string"&&this.La(t,i))}else mr(t,i,e)}},na.prototype.setLinkCategoryForData=function(t,e){this.Ms(t,e)},na.prototype.copyNodeData=function(t){return t===null?null:(t=Ve.prototype.copyNodeData.call(this,t),this.Jj||this.Ke===""||eo(t,this.Ke)===void 0||mr(t,this.Ke,void 0),t)},na.prototype.setDataProperty=function(t,e,i){if(this.lb(t)){if(e===this.nodeKeyProperty){this.km(t,i);return}if(e===this.nodeCategoryProperty){this.jm(t,i);return}if(e===this.nodeParentKeyProperty){this.qe(t,i);return}}var n=eo(t,e);n!==i&&(mr(t,e,i),this.Fs(t,e,n,i))},T=na.prototype,T.jp=function(t,e){Ve.prototype.jp.call(this,t,e);for(var i=this.kb.iterator;i.next();)this.qv(i.value,t,e)},T.qv=function(t,e,i){if(this.mh(t)===e){var n=this.Ke;mr(t,n,i),Co(this,"nodeParentKey",Sr,n,t,e,i),typeof n=="string"&&this.La(t,n)}},T.fm=function(t){Ve.prototype.fm.call(this,t),t=this.wa(t);var e=Vm(this,t);if(e!==null){var i=Pe();for(e=e.iterator;e.next();){var n=e.value;if(this.lb(n)&&this.mh(n)===t){var s=this.Ke;Co(this,"nodeParentKey",Sr,s,n,t,t),typeof s=="string"&&this.La(n,s),i.push(n)}}for(e=0;e<i.length;e++)Al(this,t,i[e]);qe(i)}},T.em=function(t){Ve.prototype.em.call(this,t);var e=this.mh(t);e=this.Vl(e),this.hc(e)===null&&du(this,e,t)},T.qp=function(t){Ve.prototype.qp.call(this,t);var e=this.mh(t);Al(this,e,t)},T.lm=function(t,e){Ve.prototype.lm.call(this,t,e),this.Ms(e,this.ss(t)),this.qe(e,this.mh(t))},T.Tl=function(){return!0},T.xs=function(){return!0},ct.Object.defineProperties(na.prototype,{nodeParentKeyProperty:{get:function(){return this.Ke},set:function(t){var e=this.Ke;e!==t&&(this.Ke=t,this.g("nodeParentKeyProperty",e,t))}},Jj:{get:function(){return this.Nm},set:function(t){this.Nm!==t&&(this.Nm=t)}},parentLinkCategoryProperty:{get:function(){return this.nj},set:function(t){var e=this.nj;e!==t&&(this.nj=t,this.g("parentLinkCategoryProperty",e,t))}},linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(t){this.parentLinkCategoryProperty=t}},type:{get:function(){return"TreeModel"}}}),na.prototype.setParentLinkCategoryForNodeData=na.prototype.Ms,na.prototype.getParentLinkCategoryForNodeData=na.prototype.ss,na.prototype.setParentKeyForNodeData=na.prototype.qe,na.prototype.getParentKeyForNodeData=na.prototype.mh,na.className="TreeModel",Xl.TreeModel=na;function Lr(t){pr.call(this),this.lw=this.Zm=this.lc=0,this.Wp=360,this.kw=Yl,this.Ti=0,this.Zv=new z,this.Jp=this.me=0,this.Xr=new vd,this.gt=this.mj=0,this.ty=600,this.eo=NaN,this.Cm=1,this.ro=0,this.ul=360,this.Rb=Yl,this.K=ra,this.nd=Fs,this.hd=My,this.tf=6,this.Nn=mf,t&&Object.assign(this,t)}gi(Lr,pr),Lr.prototype.cloneProtected=function(t){pr.prototype.cloneProtected.call(this,t),t.eo=this.eo,t.Cm=this.Cm,t.ro=this.ro,t.ul=this.ul,t.Rb=this.Rb,t.K=this.K,t.nd=this.nd,t.hd=this.hd,t.tf=this.tf,t.Nn=this.Nn},Lr.prototype.qb=function(t){t.classType===Lr?t===bv||t===Zh||t===wv||t===zr||t===Fs?this.sorting=t:t===gd||t===pf||t===ra||t===md?this.direction=t:t===Ha||t===pd||t===Yl||t===Jl?this.arrangement=t:(t===ql||t===mf)&&(this.nodeDiameterFormula=t):pr.prototype.qb.call(this,t)},Lr.prototype.createNetwork=function(){return new Gh(this)},Lr.prototype.doLayout=function(t){if(this.network===null&&(this.network=this.makeNetwork(t)),this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin),t=this.network.vertexes,1>=t.count)t.count===1&&(t=t.first(),t.centerX=0,t.centerY=0);else{var e=new Kt;e.addAll(t.iterator),t=new Kt;var i=new Kt,n=this.sort(e),s,a,l=this.Jp,c=this.arrangement,f=this.nodeDiameterFormula,m=this.radius;(!isFinite(m)||0>=m)&&(m=NaN);var v=this.aspectRatio;(!isFinite(v)||0>=v)&&(v=1);var w=this.startAngle;isFinite(w)||(w=0);var C=this.sweepAngle;if((!isFinite(C)||360<C||1>C)&&(C=360),e=this.spacing,isFinite(e)||(e=NaN),c===Jl&&f===ql?c=Yl:c===Jl&&f!==ql&&(c=this.arrangement),(this.direction===gd||this.direction===pf)&&this.sorting!==Fs){for(f=0;!(f>=n.length)&&(t.add(n.M(f)),!(f+1>=n.length));f+=2)i.add(n.M(f+1));this.direction===gd?(this.arrangement===Jl&&t.reverse(),n=new Kt,n.addAll(t),n.addAll(i)):(this.arrangement===Jl&&i.reverse(),n=new Kt,n.addAll(i),n.addAll(t))}f=n.length;for(var k=a=s=0;k<n.length;k++){var L=w+C*a*(this.direction===ra?1:-1)/f,A=n.M(k).diameter;isNaN(A)&&(A=Tc(n.M(k),L)),360>C&&(k===0||k===n.length-1)&&(A/=2),s+=A,a++}if(isNaN(m)||c===Jl){if(isNaN(e)&&(e=6),c!==Yl&&c!==Jl){for(a=-1/0,l=0;l<f;l++)k=n.M(l),s=n.M(l===f-1?0:l+1),isNaN(k.diameter)&&Tc(k,0),isNaN(s.diameter)&&Tc(s,0),a=Math.max(a,(k.diameter+s.diameter)/2);l=a+e,c===Ha?m=(a+e)/(2*Math.PI/f):m=Gm(this,l*(360<=C?f:f-1),v,w*Math.PI/180,C*Math.PI/180)}else m=Gm(this,s+(360<=C?f:f-1)*(c!==Jl?e:1.6*e),v,w*Math.PI/180,C*Math.PI/180);a=m*v}else if(a=m*v,k=Ay(this,m,a,w*Math.PI/180,C*Math.PI/180),isNaN(e))(c===Yl||c===Jl)&&(e=(k-s)/(360<=C?f:f-1));else if(c===Yl||c===Jl)k=(k-s)/(360<=C?f:f-1),k<e?(m=Gm(this,s+e*(360<=C?f:f-1),v,w*Math.PI/180,C*Math.PI/180),a=m*v):e=k;else{for(l=-1/0,s=0;s<f;s++)L=n.M(s),A=n.M(s===f-1?0:s+1),isNaN(L.diameter)&&Tc(L,0),isNaN(A.diameter)&&Tc(A,0),l=Math.max(l,(L.diameter+A.diameter)/2);l+=e,s=Gm(this,l*(360<=C?f:f-1),v,w*Math.PI/180,C*Math.PI/180),s>m?(m=s,a=m*v):l=k/(360<=C?f:f-1)}if(this.kw=c,this.lc=m,this.Zm=v,this.lw=w,this.Wp=C,this.Ti=e,this.me=a,this.Jp=l,e=n,n=this.kw,c=this.lc,m=this.lw,v=this.Wp,w=this.Ti,C=this.me,f=this.Jp,this.direction!==gd&&this.direction!==pf||n!==Jl)if(this.direction===gd||this.direction===pf){switch(l=0,n){case pd:l=180*P0(this,c,C,m,f)/Math.PI;break;case Yl:f=e=0,l=t.first(),l!==null&&(e=Tc(l,Math.PI/2)),l=i.first(),l!==null&&(f=Tc(l,Math.PI/2)),l=180*P0(this,c,C,m,w+(e+f)/2)/Math.PI;break;case Ha:l=v/e.length}if(this.direction===gd){switch(n){case pd:Zm(this,t,m,md);break;case Yl:_c(this,t,m,md);break;case Ha:xp(this,t,v/2,m,md)}switch(n){case pd:Zm(this,i,m+l,ra);break;case Yl:_c(this,i,m+l,ra);break;case Ha:xp(this,i,v/2,m+l,ra)}}else{switch(n){case pd:Zm(this,i,m,md);break;case Yl:_c(this,i,m,md);break;case Ha:xp(this,i,v/2,m,md)}switch(n){case pd:Zm(this,t,m+l,ra);break;case Yl:_c(this,t,m+l,ra);break;case Ha:xp(this,t,v/2,m+l,ra)}}}else switch(n){case pd:Zm(this,e,m,this.direction);break;case Yl:_c(this,e,m,this.direction);break;case Ha:xp(this,e,v,m,this.direction);break;case Jl:N1(this,e,v,m,this.direction)}else N1(this,e,v,m-v/2,ra)}this.updateParts(),this.network=null,this.isValidLayout=!0};function xp(t,e,i,n,s){var a=t.Wp,l=t.lc;t=t.me,n=n*Math.PI/180,i=i*Math.PI/180;for(var c=e.length,f=0;f<c;f++){var m=n+(s===ra?f*i/(360<=a?c:c-1):-(f*i)/c),v=e.M(f),w=l*Math.tan(m)/t;w=Math.sqrt((l*l+t*t*w*w)/(1+w*w)),v.centerX=w*Math.cos(m),v.centerY=w*Math.sin(m),v.actualAngle=180*m/Math.PI}}function _c(t,e,i,n){var s=t.lc,a=t.me,l=t.Ti;i=i*Math.PI/180;for(var c=e.length,f=0;f<c;f++){var m=e.M(f),v=e.M(f===c-1?0:f+1),w=a*Math.sin(i);m.centerX=s*Math.cos(i),m.centerY=w,m.actualAngle=180*i/Math.PI,isNaN(m.diameter)&&Tc(m,0),isNaN(v.diameter)&&Tc(v,0),m=P0(t,s,a,n===ra?i:-i,(m.diameter+v.diameter)/2+l),i+=n===ra?m:-m}}function Zm(t,e,i,n){var s=t.lc,a=t.me,l=t.Jp;i=i*Math.PI/180;for(var c=e.length,f=0;f<c;f++){var m=e.M(f);m.centerX=s*Math.cos(i),m.centerY=a*Math.sin(i),m.actualAngle=180*i/Math.PI,m=P0(t,s,a,n===ra?i:-i,l),i+=n===ra?m:-m}}function N1(t,e,i,n,s){var a=t.Wp;if(t.mj=0,t.Xr=new vd,360>i){for(a=n+(s===ra?a:-a);0>a;)a+=360;a%=360,180<a&&(a-=360),a*=Math.PI/180,t.gt=a,A1(t,e,i,n,s)}else Ny(t,e,i,n,s);t.Xr.commit(e)}function Ny(t,e,i,n,s){var a=t.lc,l=t.Ti,c=t.Zm,f=a*Math.cos(n*Math.PI/180),m=t.me*Math.sin(n*Math.PI/180),v=e.Fa();if(v.length===3)v[0].centerX=a,v[0].centerY=0,v[1].centerX=v[0].centerX-v[0].width/2-v[1].width/2-l,v[1].y=v[0].y,v[2].centerX=(v[0].centerX+v[1].centerX)/2,v[2].y=v[0].y-v[2].height-l;else if(v.length===4)v[0].centerX=a,v[0].centerY=0,v[2].centerX=-v[0].centerX,v[2].centerY=v[0].centerY,v[1].centerX=0,v[1].y=Math.min(v[0].y,v[2].y)-v[1].height-l,v[3].centerX=0,v[3].y=Math.max(v[0].y+v[0].height+l,v[2].y+v[2].height+l);else{a=z.alloc();for(var w=0;w<v.length&&(v[w].centerX=f,v[w].centerY=m,!(w>=v.length-1));w++)D1(t,f,m,v,w,s,a)||I1(t,f,m,v,w,s,a),f=a.x,m=a.y;if(z.free(a),t.mj++,!(23<t.mj)){f=v[0].centerX,m=v[0].centerY,a=v[v.length-1].centerX,w=v[v.length-1].centerY;var C=Math.abs(f-a)-((v[0].width+v[v.length-1].width)/2+l),k=Math.abs(m-w)-((v[0].height+v[v.length-1].height)/2+l);l=0,1>Math.abs(k)?Math.abs(f-a)<(v[0].width+v[v.length-1].width)/2&&(l=0):l=0<k?k:1>Math.abs(C)?0:C,f=Math.abs(a)>Math.abs(w)?0<a!=m>w:0<w!=f<a,(f=s===ra?f:!f)&&(l=-Math.abs(l),l=Math.min(l,-v[v.length-1].width),l=Math.min(l,-v[v.length-1].height)),t.Xr.compare(l,v),1<Math.abs(l)&&(t.lc=8>t.mj?t.lc-l/(2*Math.PI):5>v.length&&10<l?t.lc/2:t.lc-(0<l?1.7:-2.3),t.me=t.lc*c,Ny(t,e,i,n,s))}}}function A1(t,e,i,n,s){for(var a=t.lc,l=t.me,c=t.Zm,f=a*Math.cos(n*Math.PI/180),m=l*Math.sin(n*Math.PI/180),v=z.alloc(),w=e.Fa(),C=0;C<w.length&&(w[C].centerX=f,w[C].centerY=m,!(C>=w.length-1));C++)D1(t,f,m,w,C,s,v)||I1(t,f,m,w,C,s,v),f=v.x,m=v.y;if(z.free(v),t.mj++,!(23<t.mj)){if(f=Math.atan2(m,f),f=s===ra?t.gt-f:f-t.gt,f=Math.abs(f)<Math.abs(f-2*Math.PI)?f:f-2*Math.PI,a=f*(a+l)/2,l=t.Xr,Math.abs(a)<Math.abs(l.Pl))for(l.Pl=a,l.mk=[],l.tm=[],f=0;f<w.length;f++)l.mk[f]=w[f].bounds.x,l.tm[f]=w[f].bounds.y;1<Math.abs(a)&&(t.lc=8>t.mj?t.lc-a/(2*Math.PI):t.lc-(0<a?1.7:-2.3),t.me=t.lc*c,A1(t,e,i,n,s))}}function D1(t,e,i,n,s,a,l){var c=t.lc,f=t.me,m=0;t=(n[s].width+n[s+1].width)/2+t.Ti;var v=!1;if(0<=i!=(a===ra)){if(a=e+t,a>c){if(a=e-t,a<-c)return l.x=a,l.y=m,!1;v=!0}}else if(a=e-t,a<-c){if(a=e+t,a>c)return l.x=a,l.y=m,!1;v=!0}return m=Math.sqrt(1-Math.min(1,a*a/(c*c)))*f,0>i!==v&&(m=-m),Math.abs(i-m)>(n[s].height+n[s+1].height)/2?(l.x=a,l.y=m,!1):(l.x=a,l.y=m,!0)}function I1(t,e,i,n,s,a,l){var c=t.lc,f=t.me,m=0;if(t=(n[s].height+n[s+1].height)/2+t.Ti,n=!1,0<=e!=(a===ra)){if(a=i-t,a<-f){if(a=i+t,a>f){l.x=m,l.y=a;return}n=!0}}else if(a=i+t,a>f){if(a=i-t,a<-f){l.x=m,l.y=a;return}n=!0}m=Math.sqrt(1-Math.min(1,a*a/(f*f)))*c,0>e!==n&&(m=-m),l.x=m,l.y=a}Lr.prototype.commitLayout=function(){this.commitNodes(),this.isRouting&&this.commitLinks()},Lr.prototype.commitNodes=function(){var t=this.group!==null&&this.group.placeholder!==null&&this.group.isSubGraphExpanded,e=t?this.group.location.copy():null,i=this.actualCenter;t?i=new z(0,0):(i.x=this.arrangementOrigin.x+this.lc,i.y=this.arrangementOrigin.y+this.me);for(var n=this.network.vertexes.iterator;n.next();){var s=n.value;s.x+=i.x,s.y+=i.y,s.commit()}t&&(this.group.Va(),t=this.group.position.copy(),i=this.group.location.copy(),e=e.re(i.re(t)),this.group.move(e),this.Zv=e.re(t))},Lr.prototype.commitLinks=function(){for(var t=this.network.edges.iterator;t.next();)t.value.commit()};function Ay(t,e,i,n,s){var a=t.ty;if(.001>Math.abs(t.Zm-1))return n!==void 0&&s!==void 0?s*e:2*Math.PI*e;t=e>i?Math.sqrt(e*e-i*i)/e:Math.sqrt(i*i-e*e)/i;for(var l=0,c=n!==void 0&&s!==void 0?s/(a+1):Math.PI/(2*(a+1)),f=0,m=0;m<=a;m++){n!==void 0&&s!==void 0?f=n+m*s/a:f=m*Math.PI/(2*a);var v=Math.sin(f);l+=Math.sqrt(1-t*t*v*v)*c}return n!==void 0&&s!==void 0?(e>i?e:i)*l:4*(e>i?e:i)*l}function Gm(t,e,i,n,s){return e/(n!==void 0&&s!==void 0?Ay(t,1,i,n,s):Ay(t,1,i))}function P0(t,e,i,n,s){if(.001>Math.abs(t.Zm-1))return s/e;var a=e>i?Math.sqrt(e*e-i*i)/e:Math.sqrt(i*i-e*e)/i,l=0;t=2*Math.PI/(700*t.network.vertexes.count),e>i&&(n+=Math.PI/2);for(var c=0;;c++){var f=Math.sin(n+c*t);if(l+=(e>i?e:i)*Math.sqrt(1-a*a*f*f)*t,l>=s)return c*t}}Lr.prototype.sort=function(t){switch(this.sorting){case wv:break;case zr:t.reverse();break;case bv:t.sort(this.comparer);break;case Zh:t.sort(this.comparer),t.reverse();break;case Fs:return this.ak(Xm(t));default:lt("Invalid sorting type.")}return t};function Xm(t){for(var e=[],i=0;i<t.length;i++)e.push(0);i=new Kt;for(var n=0;n<t.length;n++){var s=-1,a=-1;if(n===0)for(var l=0;l<t.length;l++){var c=t.M(l).edgesCount;c>s&&(s=c,a=l)}else for(l=0;l<t.length;l++)c=e[l],c>s&&(s=c,a=l);for(i.add(t.M(a)),e[a]=-1,a=t.M(a),l=a.sourceEdges;l.next();)s=t.indexOf(l.value.fromVertex),0>s||0<=e[s]&&e[s]++;for(a=a.destinationEdges;a.next();)s=t.indexOf(a.value.toVertex),0>s||0<=e[s]&&e[s]++}return i}Lr.prototype.ak=function(t){for(var e=[],i=0;i<t.length;i++){var n=t.M(i);e[i]=[];for(var s,a=n.destinationEdges;a.next();)s=t.indexOf(a.value.toVertex),s!==i&&0>e[i].indexOf(s)&&e[i].push(s);for(n=n.sourceEdges;n.next();)s=t.indexOf(n.value.fromVertex),s!==i&&0>e[i].indexOf(s)&&e[i].push(s)}for(a=[],i=0;i<e.length;i++)a[i]=0;i=[];var l=[],c=[];n=[],s=new Kt;for(var f=0,m=0;m<e.length;m++){var v=e[m].length;if(v===1)n.push(m);else if(v===0)s.add(t.M(m));else{if(f===0)i.push(m);else{for(var w=v=1/0,C=-1,k=[],L=0;L<i.length;L++)0>e[i[L]].indexOf(i[L===i.length-1?0:L+1])&&k.push(L===i.length-1?0:L+1);if(k.length===0)for(L=0;L<i.length;L++)k.push(L);for(L=0;L<k.length;L++){for(var A=k[L],H=e[m],R=0,X=0;X<l.length;X++){var Y=a[l[X]],tt=a[c[X]];if(Y<tt){var st=Y;Y=tt}else st=tt;if(st<A&&A<=Y)for(tt=0;tt<H.length;tt++){var bt=H[tt];0>i.indexOf(bt)||st<a[bt]&&a[bt]<Y||st===a[bt]||Y===a[bt]||R++}else for(tt=0;tt<H.length;tt++)bt=H[tt],0>i.indexOf(bt)||st<a[bt]&&a[bt]<Y&&st!==a[bt]&&Y!==a[bt]&&R++}for(H=R,X=R=0;X<e[m].length;X++)st=i.indexOf(e[m][X]),0<=st&&(st=Math.abs(A-(st>=A?st+1:st)),R+=st<i.length+1-st?st:i.length+1-st);for(X=0;X<l.length;X++)st=a[l[X]],Y=a[c[X]],st>=A&&st++,Y>=A&&Y++,st>Y&&(tt=Y,Y=st,st=tt),Y-st<(i.length+2)/2==(st<A&&A<=Y)&&R++;(H<v||H===v&&R<w)&&(v=H,w=R,C=A)}for(i.splice(C,0,m),v=0;v<i.length;v++)a[i[v]]=v;for(v=0;v<e[m].length;v++)w=e[m][v],0<=i.indexOf(w)&&(l.push(m),c.push(w))}f++}}for(l=i.length;;){for(a=!0,c=0;c<n.length;c++)if(f=n[c],m=e[f][0],v=i.indexOf(m),0<=v){for(C=w=0;C<e[m].length;C++)k=i.indexOf(e[m][C]),0>k||k===v||(L=k>v?k-v:v-k,w+=k<v!=L>l-L?1:-1);i.splice(0>w?v:v+1,0,f),n.splice(c,1),c--}else a=!1;if(a)break;i.push(n[0]),n.splice(0,1)}for(e=0;e<i.length;e++)s.add(t.M(i[e]));return s},ct.Object.defineProperties(Lr.prototype,{radius:{get:function(){return this.eo},set:function(t){this.eo!==t&&(0<t||isNaN(t))&&(this.eo=t,this.C())}},aspectRatio:{get:function(){return this.Cm},set:function(t){this.Cm!==t&&0<t&&(this.Cm=t,this.C())}},startAngle:{get:function(){return this.ro},set:function(t){this.ro!==t&&(this.ro=t,this.C())}},sweepAngle:{get:function(){return this.ul},set:function(t){this.ul!==t&&(0<t&&360>=t?this.ul=t:this.ul=360,this.C())}},arrangement:{get:function(){return this.Rb},set:function(t){this.Rb===t||t!==Jl&&t!==Yl&&t!==pd&&t!==Ha||(this.Rb=t,this.C())}},direction:{get:function(){return this.K},set:function(t){this.K===t||t!==ra&&t!==md&&t!==gd&&t!==pf||(this.K=t,this.C())}},sorting:{get:function(){return this.nd},set:function(t){this.nd===t||t!==wv&&t!==zr&&t!==bv&&!Zh&&t!==Fs||(this.nd=t,this.C())}},comparer:{get:function(){return this.hd},set:function(t){this.hd!==t&&(this.hd=t,this.C())}},spacing:{get:function(){return this.tf},set:function(t){this.tf!==t&&(this.tf=t,this.C())}},nodeDiameterFormula:{get:function(){return this.Nn},set:function(t){this.Nn===t||t!==mf&&t!==ql||(this.Nn=t,this.C())}},actualXRadius:{get:function(){return this.lc}},actualYRadius:{get:function(){return this.me}},actualSpacing:{get:function(){return this.Ti}},actualCenter:{get:function(){return this.Zv}}});var Yl=new mt(Lr,"ConstantSpacing",0),pd=new mt(Lr,"ConstantDistance",1),Ha=new mt(Lr,"ConstantAngle",2),Jl=new mt(Lr,"Packed",3),ra=new mt(Lr,"Clockwise",4),md=new mt(Lr,"Counterclockwise",5),gd=new mt(Lr,"BidirectionalLeft",6),pf=new mt(Lr,"BidirectionalRight",7),wv=new mt(Lr,"Forwards",8),zr=new mt(Lr,"Reverse",9),bv=new mt(Lr,"Ascending",10),Zh=new mt(Lr,"Descending",11),Fs=new mt(Lr,"Optimized",12),mf=new mt(Lr,"Pythagorean",13),ql=new mt(Lr,"Circular",14);Lr.className="CircularLayout",Lr.ConstantSpacing=Yl,Lr.ConstantDistance=pd,Lr.ConstantAngle=Ha,Lr.Packed=Jl,Lr.Clockwise=ra,Lr.Counterclockwise=md,Lr.BidirectionalLeft=gd,Lr.BidirectionalRight=pf,Lr.Forwards=wv,Lr.Reverse=zr,Lr.Ascending=bv,Lr.Descending=Zh,Lr.Optimized=Fs,Lr.Pythagorean=mf,Lr.Circular=ql;function vd(){this.Pl=-1/0,this.tm=this.mk=null}vd.prototype.compare=function(t,e){if(0<t&&0>this.Pl||Math.abs(t)<Math.abs(this.Pl)&&!(0>t&&0<this.Pl))for(this.Pl=t,this.mk=[],this.tm=[],t=0;t<e.length;t++)this.mk[t]=e[t].bounds.x,this.tm[t]=e[t].bounds.y},vd.prototype.commit=function(t){if(this.mk!==null&&this.tm!==null)for(var e=0;e<this.mk.length;e++){var i=t.M(e);i.x=this.mk[e],i.y=this.tm[e]}},vd.className="VertexArrangement";function Gh(t){nr.call(this,t)}gi(Gh,nr),Gh.prototype.createVertex=function(){return new N0(this)},Gh.prototype.createEdge=function(){return new Ym(this)},Gh.className="CircularNetwork";function N0(t){lo.call(this,t),this.u=this.Si=NaN}gi(N0,lo);function Tc(t,e){var i=t.network;if(i===null)return NaN;if(i=i.layout,i===null)return NaN;if(i.arrangement===Jl)if(i.nodeDiameterFormula===ql)t.Si=Math.max(t.width,t.height);else{if(i=Math.abs(Math.sin(e)),e=Math.abs(Math.cos(e)),i===0)return t.width;if(e===0)return t.height;t.Si=Math.min(t.height/i,t.width/e)}else t.Si=i.nodeDiameterFormula===ql?Math.max(t.width,t.height):Math.sqrt(t.width*t.width+t.height*t.height);return t.Si}ct.Object.defineProperties(N0.prototype,{diameter:{get:function(){return this.Si},set:function(t){this.Si!==t&&(this.Si=t)}},actualAngle:{get:function(){return this.u},set:function(t){this.u!==t&&(this.u=t)}}}),N0.className="CircularVertex";function Ym(t){Na.call(this,t)}gi(Ym,Na),Ym.className="CircularEdge";function ys(t){pr.call(this),this.ah=null,this.An=0,this.$d=new ii(100,100).freeze(),this.Bm=!1,this.sf=!0,this.td=!1,this.dl=100,this.$m=1,this.Zf=1e3,this.In=10,this.fo=Math,this.Hk=.05,this.Gk=50,this.Ek=150,this.Fk=0,this.Vm=10,this.Um=5,t&&Object.assign(this,t)}gi(ys,pr),ys.prototype.cloneProtected=function(t){pr.prototype.cloneProtected.call(this,t),t.$d.assign(this.$d),t.Bm=this.Bm,t.sf=this.sf,t.td=this.td,t.dl=this.dl,t.$m=this.$m,t.Zf=this.Zf,t.In=this.In,t.fo=this.fo,t.Hk=this.Hk,t.Gk=this.Gk,t.Ek=this.Ek,t.Fk=this.Fk,t.Vm=this.Vm,t.Um=this.Um},ys.prototype.createNetwork=function(){return new bp(this)},ys.prototype.doLayout=function(t){if(this.network===null&&(this.network=this.makeNetwork(t)),t=this.maxIterations,0<this.network.vertexes.count){this.network.Ko();for(var e=this.network.vertexes.iterator;e.next();){var i=e.value;i.charge=this.electricalCharge(i),i.mass=this.gravitationalMass(i)}for(e=this.network.edges.iterator;e.next();)i=e.value,i.stiffness=this.springStiffness(i),i.length=this.springLength(i);if(this.Cu(),this.An=0,this.needsClusterLayout()){e=this.network,i=e.Zx();for(var n=i.iterator;n.next();){this.network=n.value;for(var s=this.network.vertexes.iterator;s.next();){var a=s.value;a.Vd=a.vertexes.count,a.sh=1,a.Hj=null,a.We=null}Dy(this,0,t)}this.network=e;var l=n=i.iterator;n=this.arrangementSpacing;var c=l.count,f=!0;a=s=0;for(var m=Pe(),v=0;v<c+e.vertexes.count+2;v++)m[v]=null;c=0,l.reset();for(var w=It.alloc();l.next();)if(v=l.value,this.computeBounds(v,w),f)f=!1,s=w.x+w.width/2,a=w.y+w.height/2,m[0]=new z(w.x+w.width+n.width,w.y),m[1]=new z(w.x,w.y+w.height+n.height),c=2;else{var C=B1(m,c,s,a,w.width,w.height,n),k=m[C],L=new z(k.x+w.width+n.width,k.y),A=new z(k.x,k.y+w.height+n.height);for(C+1<c&&m.splice(C+1,0,null),m[C]=L,m[C+1]=A,c++,C=k.x-w.x,k=k.y-w.y,v=v.vertexes.iterator;v.next();)L=v.value,L.centerX+=C,L.centerY+=k}for(It.free(w),v=e.vertexes.iterator;v.next();)l=v.value,C=l.bounds,2>c?(s=C.x+C.width/2,a=C.y+C.height/2,m[0]=new z(C.x+C.width+n.width,C.y),m[1]=new z(C.x,C.y+C.height+n.height),c=2):(f=B1(m,c,s,a,C.width,C.height,n),w=m[f],k=new z(w.x+C.width+n.width,w.y),C=new z(w.x,w.y+C.height+n.height),f+1<c&&m.splice(f+1,0,null),m[f]=k,m[f+1]=C,c++,l.centerX=w.x+l.width/2,l.centerY=w.y+l.height/2);for(qe(m),n=i.iterator;n.next();){for(i=n.value,s=i.vertexes.iterator;s.next();)e.dh(s.value);for(i=i.edges.iterator;i.next();)e.Bo(i.value)}}F1(this,t),this.updateParts()}this.dl=t,this.network=null,this.isValidLayout=!0},ys.prototype.needsClusterLayout=function(){if(3>this.network.vertexes.count)return!1;for(var t=0,e=0,i=this.network.vertexes.first().bounds,n=this.network.vertexes.iterator;n.next();){if(n.value.bounds.Yc(i)&&(t++,2<t))return!0;if(10<e)break;e++}return!1},ys.prototype.computeBounds=function(t,e){var i=!0;for(t=t.vertexes.iterator;t.next();){var n=t.value;i?(i=!1,e.set(n.bounds)):e.ed(n.bounds)}return e};function Dy(t,e,i){if(wx(t,e)){var n=t.Zf;t.Zf*=1+1/(e+1);var s=Sv(t,e),a=Math.max(0,Math.max(Math.min(t.network.vertexes.count,i*(e+1)/11),10));for(t.maxIterations+=a,Dy(t,e+1,i),F1(t,a),O1(t,s),e=s.vertexes.Fa(),e.sort(function(l,c){return l===null||c===null||l===c?0:c.Vd-l.Vd}),i=0;i<e.length;i++)bx(t,e[i]);t.Zf=n}}function wx(t,e){if(10<e||3>t.network.vertexes.count)return!1;for(t.ah=t.network.vertexes.Fa(),t=t.ah,t.sort(function(i,n){return i===null||n===null||i===n?0:n.Vd-i.Vd}),e=t.length-1;0<=e&&1>=t[e].Vd;)e--;return 1<t.length-e}function Sv(t,e){for(var i=t.network,n=new bp(t),s=0;s<t.ah.length;s++){var a=t.ah[s];if(1<a.Vd){n.dh(a);var l=new z1;l.Rs=a.Vd,l.Ss=a.width,l.Qs=a.height,l.Sv=a.focus.x,l.Tv=a.focus.y,a.We===null&&(a.We=new Kt),a.We.add(l),a.sv=a.We.count-1}else break}for(a=i.edges.iterator;a.next();){var c=a.value;s=c.fromVertex,l=c.toVertex,s.network===n&&l.network===n?n.Bo(c):s.network===n?(c=s.Hj,c===null&&(c=new Kt,s.Hj=c),c.add(l),s.Vd--,s.sh+=l.sh):l.network===n&&(c=l.Hj,c===null&&(c=new Kt,l.Hj=c),c.add(s),l.Vd--,l.sh+=s.sh)}for(s=n.edges.iterator;s.next();)a=s.value,a.length*=Math.max(1,ht.sqrt((a.fromVertex.sh+a.toVertex.sh)/(4*e+1)));for(e=n.vertexes.iterator;e.next();){s=e.value;var f=s.Hj;if(f!==null&&0<f.count&&(l=s.We.M(s.We.count-1).Rs-s.Vd,!(0>=l))){for(var m=c=0,v=f.count-l;v<f.count;v++){var w=f.M(v),C=null;for(a=w.edges.iterator;a.next();){var k=a.value;if(k.Ax(w)===s){C=k;break}}C!==null&&(m+=C.length,c+=w.width*w.height)}a=s.centerX,f=s.centerY,v=s.width,w=s.height,C=s.focus,k=v*w,1>k&&(k=1),c=ht.sqrt((c+k+m*m*4/(l*l))/k),l=(c-1)*v/2,c=(c-1)*w/2,s.bounds=new It(a-C.x-l,f-C.y-c,v+2*l,w+2*c),s.focus=new z(C.x+l,C.y+c)}}return t.network=n,i}function O1(t,e){for(var i=t.network.vertexes.iterator;i.next();){var n=i.value;if(n.network=e,n.We!==null){var s=n.We.M(n.sv);n.Vd=s.Rs;var a=s.Sv,l=s.Tv;n.bounds=new It(n.centerX-a,n.centerY-l,s.Ss,s.Qs),n.focus=new z(a,l),n.sv--}}for(i=t.network.edges.iterator;i.next();)i.value.network=e;t.network=e}function bx(t,e){var i=e.Hj;if(i!==null&&i.count!==0){var n=e.centerX,s=e.centerY,a=e.width,l=e.height;e.We!==null&&0<e.We.count&&(l=e.We.M(0),a=l.Ss,l=l.Qs),a=ht.sqrt(a*a+l*l)/2;for(var c=!1,f=l=0,m=0,v=e.vertexes.iterator;v.next();){var w=v.value;1>=w.Vd?f++:(c=!0,m++,l+=Math.atan2(e.centerY-w.centerY,e.centerX-w.centerX))}if(f!==0){for(0<m&&(l/=m),m=e=0,e=c?2*Math.PI/(f+1):2*Math.PI/f,f%2===0&&(m=e/2),1<i.count&&i.sort(function(k,L){return k===null||L===null||k===L?0:L.width*L.height-k.width*k.height}),c=f%2===0?0:1,i=i.iterator;i.next();)if(f=i.value,!(1<f.Vd||t.isFixed(f))){for(v=null,w=f.edges.iterator;w.next();){v=w.value;break}w=f.width;var C=f.height;w=ht.sqrt(w*w+C*C)/2,v=a+v.length+w,w=l+(e*(c/2>>1)+m)*(c%2===0?1:-1),f.centerX=n+v*Math.cos(w),f.centerY=s+v*Math.sin(w),c++}}}}function B1(t,e,i,n,s,a,l){var c=9e19,f=-1,m=0;t:for(;m<e;m++){var v=t[m],w=v.x-i,C=v.y-n;if(w=w*w+C*C,w<c){for(C=m-1;0<=C;C--)if(t[C].y>v.y&&t[C].x-v.x<s+l.width)continue t;for(C=m+1;C<e;C++)if(t[C].x>v.x&&t[C].y-v.y<a+l.height)continue t;f=m,c=w}}return f}ys.prototype.Cu=function(){if(this.comments)for(var t=this.network.vertexes.iterator;t.next();)this.addComments(t.value)},ys.prototype.addComments=function(t){var e=t.node;if(e!==null)for(e=e.Mu();e.next();){var i=e.value;if(i.category==="Comment"&&i.isVisible()){var n=this.network.ki(i);n===null&&(n=this.network.Bl(i)),n.charge=this.defaultCommentElectricalCharge,i=null;for(var s=n.destinationEdges;s.next();){var a=s.value;if(a.toVertex===t){i=a;break}}if(i===null){for(s=n.sourceEdges;s.next();)if(a=s.value,a.fromVertex===t){i=a;break}}i===null&&(i=this.network.Zj(t,n,null)),i.length=this.defaultCommentSpringLength}}};function wp(t,e){var i=t.bounds,n=i.x;t=i.y;var s=i.width;i=i.height;var a=e.bounds,l=a.x;e=a.y;var c=a.width;return a=a.height,n+s<l?t>e+a?(i=n+s-l,t=t-e-a,ht.sqrt(i*i+t*t)):t+i<e?(n=n+s-l,t=t+i-e,ht.sqrt(n*n+t*t)):l-(n+s):n>l+c?t>e+a?(i=n-l-c,t=t-e-a,ht.sqrt(i*i+t*t)):t+i<e?(n=n-l-c,t=t+i-e,ht.sqrt(n*n+t*t)):n-(l+c):t>e+a?t-(e+a):t+i<e?e-(t+i):.1}function F1(t,e){for(t.ah=null,e=t.An+e;t.An<e&&(t.An++,R1(t)););t.ah=null}function R1(t){t.ah===null&&(t.ah=t.network.vertexes.Fa());var e=t.ah;if(0>=e.length)return!1;var i=e[0];i.forceX=0,i.forceY=0;for(var n=i.centerX,s=n,a=i=i.centerY,l=1;l<e.length;l++){var c=e[l];c.forceX=0,c.forceY=0;var f=c.centerX;c=c.centerY,n=Math.min(n,f),s=Math.max(s,f),i=Math.min(i,c),a=Math.max(a,c)}(s=s-n>a-i)?e.sort(function(A,H){return A===null||H===null||A===H?0:A.centerX-H.centerX}):e.sort(function(A,H){return A===null||H===null||A===H?0:A.centerY-H.centerY}),i=t.Zf;var m=n=c=0;for(a=0;a<e.length;a++){l=e[a],n=l.bounds,c=l.focus,f=n.x+c.x;var v=n.y+c.y;n=l.charge*t.electricalFieldX(f,v),m=l.charge*t.electricalFieldY(f,v),n+=l.mass*t.gravitationalFieldX(f,v),m+=l.mass*t.gravitationalFieldY(f,v),l.forceX+=n,l.forceY+=m;for(var w=a+1;w<e.length;w++){var C=e[w];if(C!==l){n=C.bounds,c=C.focus,m=n.x+c.x;var k=n.y+c.y;if(f-m>i||m-f>i){if(s)break}else if(v-k>i||k-v>i){if(!s)break}else{var L=wp(l,C);1>L?(n=t.randomNumberGenerator,n===null&&(t.randomNumberGenerator=n=new Xh),L=n.random(),c=n.random(),f>m?(n=Math.abs(C.bounds.right-l.bounds.x),n=(1+n)*L):f<m?(n=Math.abs(C.bounds.x-l.bounds.right),n=-(1+n)*L):(n=Math.max(C.width,l.width),n=(1+n)*L-n/2),v>k?(m=Math.abs(C.bounds.bottom-l.bounds.y),m=(1+m)*c):f<m?(m=Math.abs(C.bounds.y-l.bounds.bottom),m=-(1+m)*c):(m=Math.max(C.height,l.height),m=(1+m)*c-m/2)):(c=-(l.charge*C.charge)/(L*L),n=(m-f)/L*c,m=(k-v)/L*c),l.forceX+=n,l.forceY+=m,C.forceX-=n,C.forceY-=m}}}}for(s=t.network.edges.iterator;s.next();)c=s.value,i=c.fromVertex,a=c.toVertex,l=i.bounds,f=i.focus,n=l.x+f.x,l=l.y+f.y,v=a.bounds,w=a.focus,f=v.x+w.x,v=v.y+w.y,w=wp(i,a),1>w?(w=t.randomNumberGenerator,w===null&&(t.randomNumberGenerator=w=new Xh),c=w.random(),w=w.random(),n=(n>f?1:-1)*(1+(a.width>i.width?a.width:i.width))*c,m=(l>v?1:-1)*(1+(a.height>i.height?a.height:i.height))*w):(c=c.stiffness*(w-c.length),n=(f-n)/w*c,m=(v-l)/w*c),i.forceX+=n,i.forceY+=m,a.forceX-=n,a.forceY-=m;for(s=n=0;s<e.length;s++)i=e[s],t.isFixed(i)?t.moveFixedVertex(i):n=Math.max(n,t.moveVertex(i)||0);return n>t.epsilonDistance*t.epsilonDistance}ys.prototype.moveVertex=function(t){var e=t.forceX,i=t.forceY,n=this.moveLimit;return e<-n?e=-n:e>n&&(e=n),i<-n?i=-n:i>n&&(i=n),t.centerX+=e,t.centerY+=i,e*e+i*i},ys.prototype.moveFixedVertex=function(){},ys.prototype.commitLayout=function(){this.yv(),this.commitNodes(),this.isRouting&&this.commitLinks()},ys.prototype.yv=function(){if(this.setsPortSpots)for(var t=this.network.edges.iterator;t.next();){var e=t.value.link;e!==null&&(e.fromSpot=zn,e.toSpot=zn)}},ys.prototype.commitNodes=function(){var t=0,e=0;if(this.arrangesToOrigin){var i=It.alloc();this.computeBounds(this.network,i),e=this.arrangementOrigin,t=e.x-i.x,e=e.y-i.y,It.free(i)}i=It.alloc();for(var n=this.network.vertexes.iterator;n.next();){var s=n.value;(t!==0||e!==0)&&(i.assign(s.bounds),i.x+=t,i.y+=e,s.bounds=i),s.commit()}It.free(i)},ys.prototype.commitLinks=function(){for(var t=this.network.edges.iterator;t.next();)t.value.commit()},ys.prototype.springStiffness=function(t){return t=t.stiffness,isNaN(t)?this.Hk:t},ys.prototype.springLength=function(t){return t=t.length,isNaN(t)?this.Gk:t},ys.prototype.electricalCharge=function(t){return t=t.charge,isNaN(t)?this.Ek:t},ys.prototype.electricalFieldX=function(){return 0},ys.prototype.electricalFieldY=function(){return 0},ys.prototype.gravitationalMass=function(t){return t=t.mass,isNaN(t)?this.Fk:t},ys.prototype.gravitationalFieldX=function(){return 0},ys.prototype.gravitationalFieldY=function(){return 0},ys.prototype.isFixed=function(t){return t.isFixed},ct.Object.defineProperties(ys.prototype,{currentIteration:{get:function(){return this.An}},arrangementSpacing:{get:function(){return this.$d},set:function(t){this.$d.D(t)||(this.$d.assign(t),this.C())}},arrangesToOrigin:{get:function(){return this.Bm},set:function(t){this.Bm!==t&&(this.Bm=t,this.C())}},setsPortSpots:{get:function(){return this.sf},set:function(t){this.sf!==t&&(this.sf=t,this.C())}},comments:{get:function(){return this.td},set:function(t){this.td!==t&&(this.td=t,this.C())}},maxIterations:{get:function(){return this.dl},set:function(t){this.dl!==t&&0<=t&&(this.dl=t,this.C())}},epsilonDistance:{get:function(){return this.$m},set:function(t){this.$m!==t&&0<t&&(this.$m=t,this.C())}},infinityDistance:{get:function(){return this.Zf},set:function(t){this.Zf!==t&&1<t&&(this.Zf=t,this.C())}},moveLimit:{get:function(){return this.In},set:function(t){this.In!==t&&1<t&&(this.In=t,this.C())}},randomNumberGenerator:{get:function(){return this.fo},set:function(t){this.fo!==t&&(t!==null&&typeof t.random!="function"&&lt('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+t),this.fo=t)}},defaultSpringStiffness:{get:function(){return this.Hk},set:function(t){this.Hk!==t&&(this.Hk=t,this.C())}},defaultSpringLength:{get:function(){return this.Gk},set:function(t){this.Gk!==t&&(this.Gk=t,this.C())}},defaultElectricalCharge:{get:function(){return this.Ek},set:function(t){this.Ek!==t&&(this.Ek=t,this.C())}},defaultGravitationalMass:{get:function(){return this.Fk},set:function(t){this.Fk!==t&&(this.Fk=t,this.C())}},defaultCommentSpringLength:{get:function(){return this.Vm},set:function(t){this.Vm!==t&&(this.Vm=t,this.C())}},defaultCommentElectricalCharge:{get:function(){return this.Um},set:function(t){this.Um!==t&&(this.Um=t,this.C())}}}),ys.className="ForceDirectedLayout";function z1(){this.Tv=this.Sv=this.Qs=this.Ss=this.Rs=0}z1.className="ForceDirectedSubnet";function bp(t){nr.call(this,t)}gi(bp,nr),bp.prototype.createVertex=function(){return new Jm(this)},bp.prototype.createEdge=function(){return new qm(this)},bp.className="ForceDirectedNetwork";function Jm(t){lo.call(this,t),this.ia=!1,this.Ha=this.u=NaN,this.sh=this.Vd=this.V=this.F=0,this.We=this.Hj=null,this.sv=0}gi(Jm,lo),ct.Object.defineProperties(Jm.prototype,{isFixed:{get:function(){return this.ia},set:function(t){this.ia!==t&&(this.ia=t)}},charge:{get:function(){return this.u},set:function(t){this.u!==t&&(this.u=t)}},mass:{get:function(){return this.Ha},set:function(t){this.Ha!==t&&(this.Ha=t)}},forceX:{get:function(){return this.F},set:function(t){this.F!==t&&(this.F=t)}},forceY:{get:function(){return this.V},set:function(t){this.V!==t&&(this.V=t)}}}),Jm.className="ForceDirectedVertex";function qm(t){Na.call(this,t),this.j=this.o=NaN}gi(qm,Na),ct.Object.defineProperties(qm.prototype,{stiffness:{get:function(){return this.o},set:function(t){this.o!==t&&(this.o=t)}},length:{get:function(){return this.j},set:function(t){this.j!==t&&(this.j=t)}}}),qm.className="ForceDirectedEdge";function Xh(){var t=0;t===void 0&&(t=42),this.seed=t,this.ay=48271,this.ey=2147483647,this.Q=44488.07041494893,this.gy=3399,this.by=1/2147483647,this.random()}Xh.prototype.random=function(){var t=this.seed%this.Q*this.ay-this.seed/this.Q*this.gy;return 0<t?this.seed=t:this.seed=t+this.ey,this.seed*this.by},Xh.className="RandomNumberGenerator";function Zn(t){pr.call(this),this.kc=this.ie=25,this.K=0,this.Dk=Gs,this.Zk=Ou,this.Qk=A0,this.bj=4,this.rk=$1,this.bg=15,this.sf=!0,this.Cn=4,this.Ra=this.Iq=this.Ia=-1,this.Md=this.Hn=0,this.Ta=this.Kd=this.Ld=this.he=this.tc=null,this.Kn=0,this.Jn=this.kj=null,this.le=0,this.fl=null,this.Rf=new z,this.He=[],this.He.length=100,this.xw=this.ve=0,t&&Object.assign(this,t)}gi(Zn,pr),Zn.prototype.cloneProtected=function(t){pr.prototype.cloneProtected.call(this,t),t.ie=this.ie,t.kc=this.kc,t.K=this.K,t.Dk=this.Dk,t.Zk=this.Zk,t.Qk=this.Qk,t.bj=this.bj,t.rk=this.rk,t.bg=this.bg,t.sf=this.sf,t.Cn=this.Cn,t.ve=this.ve},Zn.prototype.qb=function(t){t.classType===Zn?t.name.indexOf("Aggressive")===0?this.aggressiveOption=t:t.name.indexOf("Cycle")===0?this.cycleRemoveOption=t:t.name.indexOf("Init")===0?this.initializeOption=t:t.name.indexOf("Layer")===0?this.layeringOption=t:lt("Unknown enum value: "+t):pr.prototype.qb.call(this,t)},Zn.prototype.createNetwork=function(){return new Mv(this)},Zn.prototype.doLayout=function(t){for(this.network===null&&(this.network=this.makeNetwork(t)),this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin),this.Iq=-1,this.Md=this.Hn=0,this.fl=this.Jn=this.kj=null,t=0;t<this.He.length;t++)this.He[t]=null;if(0<this.network.vertexes.count){for(this.network.Ko(),this.cycleRemoveOption!==fu&&this.removeCycles(),t=this.network.vertexes.iterator;t.next();)t.value.layer=-1;for(this.Ia=-1,this.assignLayers(),t.reset();t.next();)this.Ia=Math.max(this.Ia,t.value.layer);this.cycleRemoveOption===fu&&this.removeCycles(),t=this.network;for(var e=[],i=t.edges.iterator;i.next();){var n=i.value;n.valid=!1,e.push(n)}for(i=0;i<e.length;i++){n=e[i];var s=n.fromVertex,a=n.toVertex;if(!(n.valid||(s.node===null&&s.data===null||a.node===null&&a.data===null)&&s.layer===a.layer)){var l=0,c=0,f=0,m=0;if(n.link!==null){if(c=n.link,c===null)continue;var v=s.node;if(l=a.node,v===null||l===null)continue;var w=c.fromNode;f=c.toNode;for(var C=c.fromPort;C!==null&&!C.Ed();)C=C.panel;for(c=c.toPort;c!==null&&!c.Ed();)c=c.panel;if(n.rev){m=w;var k=C;w=f,C=c,f=m,c=k}var L=s.focus;m=a.focus;var A=n.rev?a.bounds:s.bounds;k=z.alloc(),v!==w?A.w()&&w.isVisible()?w.actualBounds.w()?(ch(w,C,on,k),k.x+=w.actualBounds.x-A.x,k.y+=w.actualBounds.y-A.y):(ch(w,C,on,k),k.w()||k.assign(L)):k.assign(L):A.w()?(ch(w,C,on,k),k.w()||k.assign(L)):k.assign(L),w=n.rev?s.bounds:a.bounds,v=z.alloc(),l!==f?w.w()&&f.isVisible()?f.actualBounds.w()?(ch(f,c,on,v),v.x+=f.actualBounds.x-w.x,v.y+=f.actualBounds.y-w.y):(ch(f,c,on,v),v.w()||v.assign(m)):v.assign(m):w.w()?(ch(f,c,on,v),v.w()||v.assign(m)):v.assign(m),this.K===90||this.K===270?(l=Math.round((k.x-L.x)/this.kc),f=k.x,c=Math.round((v.x-m.x)/this.kc),m=v.x):(l=Math.round((k.y-L.y)/this.kc),f=k.y,c=Math.round((v.y-m.y)/this.kc),m=v.y),z.free(k),z.free(v),n.portFromColOffset=l,n.portFromPos=f,n.portToColOffset=c,n.portToPos=m}else n.portFromColOffset=0,n.portFromPos=0,n.portToColOffset=0,n.portToPos=0;if(k=s.layer,v=a.layer,w=0,A=n.link,A!==null){var H=A.fromPort,R=A.toPort;if(H!==null&&R!==null){var X=A.fromNode;if(C=A.toNode,X!==null&&C!==null){var Y=el(this,!0),tt=el(this,!1),st=this.setsPortSpots?Y:A.computeSpot(!0,H);L=this.setsPortSpots?tt:A.computeSpot(!1,R);var bt=A.isOrthogonal;st.$c()&&st.Hf(tt)&&L.$c()&&L.Hf(Y)?w=0:(Y=A.getLinkPoint(X,H,st,!0,bt,C,R,z.alloc()),tt=A.getLinkDirection(X,H,Y,st,!0,bt,C,R),z.free(Y),st.ys()||tt!==_t(this,n,!0)?this.setsPortSpots&&X!==null&&X.ports.count===1&&n.rev&&(w+=1):w+=1,st=A.getLinkPoint(C,R,L,!1,bt,X,H,z.alloc()),A=A.getLinkDirection(C,R,st,L,!1,bt,X,H),z.free(st),L.ys()||A!==_t(this,n,!1)?this.setsPortSpots&&C!==null&&C.ports.count===1&&n.rev&&(w+=2):w+=2)}}}if(C=w,w=C===1||C===3,(C=C===2||C===3)&&(L=t.createVertex(),L.node=null,L.Dj=1,L.layer=k,L.near=s,t.dh(L),s=t.Zj(s,L,n.link),s.valid=!1,s.rev=n.rev,s.portFromColOffset=l,s.portToColOffset=0,s.portFromPos=f,s.portToPos=0,s=L),A=1,w&&A--,k-v>A&&0<k){for(n.valid=!1,L=t.createVertex(),L.node=null,L.Dj=2,L.layer=k-1,t.dh(L),s=t.Zj(s,L,n.link),s.valid=!0,s.rev=n.rev,s.portFromColOffset=C?0:l,s.portToColOffset=0,s.portFromPos=C?0:f,s.portToPos=0,s=L,k--;k-v>A&&0<k;)L=t.createVertex(),L.node=null,L.Dj=3,L.layer=k-1,t.dh(L),s=t.Zj(s,L,n.link),s.valid=!0,s.rev=n.rev,s.portFromColOffset=0,s.portToColOffset=0,s.portFromPos=0,s.portToPos=0,s=L,k--;s=t.Zj(L,a,n.link),s.valid=!w,w&&(L.near=a),s.rev=n.rev,s.portFromColOffset=0,s.portToColOffset=c,s.portFromPos=0,s.portToPos=m}else n.valid=!0}}for(t=this.tc=[],e=0;e<=this.Ia;e++)t[e]=0;for(e=this.network.vertexes.iterator;e.next();)e.value.index=-1;for(this.initializeIndices(),this.Iq=-1,i=this.Md=this.Hn=0;i<=this.Ia;i++)t[i]>t[this.Md]&&(this.Iq=t[i]-1,this.Md=i),t[i]<t[this.Hn]&&(this.Hn=i);for(this.fl=[],i=0;i<t.length;i++)this.fl[i]=[];for(e.reset();e.next();)t=e.value,this.fl[t.layer][t.index]=t;for(this.Ra=-1,t=0;t<=this.Ia;t++){for(e=Vr(this,t),i=0,n=this.tc[t],a=0;a<n;a++)s=e[a],i+=this.nodeMinColumnSpace(s,!0),s.column=i,i+=1,i+=this.nodeMinColumnSpace(s,!1);this.Ra=Math.max(this.Ra,i-1),No(this,t,e)}this.reduceCrossings(),this.straightenAndPack(),this.updateParts()}this.network=null,this.isValidLayout=!0},Zn.prototype.linkMinLength=function(){return 1};function j1(t){var e=t.fromVertex.node||t.fromVertex.data;return t=t.toVertex.node||t.toVertex.data,e===null&&t===null?8:e===null||t===null?4:1}Zn.prototype.nodeMinLayerSpace=function(t,e){return t.node===null&&t.data===null?0:this.K===90||this.K===270?e?t.focus.y+10:t.bounds.height-t.focus.y+10:e?t.focus.x+10:t.bounds.width-t.focus.x+10},Zn.prototype.nodeMinColumnSpace=function(t,e){if(t.node===null&&t.data===null)return 0;var i=e?t.ev:t.dv;return i!==null?i:(i=this.K,i===90||i===270?e?t.ev=t.focus.x/this.kc+1|0:t.dv=(t.bounds.width-t.focus.x)/this.kc+1|0:e?t.ev=t.focus.y/this.kc+1|0:t.dv=(t.bounds.height-t.focus.y)/this.kc+1|0)};function fa(t){t.kj===null&&(t.kj=[]);for(var e=0,i=t.network.vertexes.iterator;i.next();){var n=i.value;t.kj[e]=n.layer,e++,t.kj[e]=n.column,e++,t.kj[e]=n.index,e++}return t.kj}function yl(t,e){var i=0;for(t=t.network.vertexes.iterator;t.next();){var n=t.value;n.layer=e[i],i++,n.column=e[i],i++,n.index=e[i],i++}}function Sx(t,e,i){var n=Vr(t,e),s=t.tc[e];(t.Jn===null||t.Jn.length<s*s)&&(t.Jn=[]);for(var a=t.Jn,l=0;l<s;l++){var c=0,f=n[l],m=f.near;if(m!==null&&m.layer===f.layer)if(f=m.index,f>l)for(var v=l+1;v<f;v++){var w=n[v];w.near===m&&w.Dj===m.Dj||c++}else for(v=l-1;v>f;v--)w=n[v],w.near===m&&w.Dj===m.Dj||c++;var C;if(0<=i)for(f=n[l].sourceEdgesArrayAccess,m=0;m<f.length;m++){var k=f[m];if(k.valid&&k.fromVertex.layer!==e)for(w=k.fromVertex.index,v=k.portToPos,k=k.portFromPos,C=m+1;C<f.length;C++){var L=f[C];if(L.valid&&L.fromVertex.layer!==e){var A=L.fromVertex.index,H=L.portToPos;L=L.portFromPos,v<H&&(w>A||w===A&&k>L)&&c++,H<v&&(A>w||A===w&&L>k)&&c++}}}if(0>=i){for(f=n[l].destinationEdgesArrayAccess,m=0;m<f.length;m++)if(k=f[m],k.valid&&k.toVertex.layer!==e)for(w=k.toVertex.index,v=k.portToPos,k=k.portFromPos,C=m+1;C<f.length;C++)L=f[C],L.valid&&L.toVertex.layer!==e&&(A=L.toVertex.index,H=L.portToPos,L=L.portFromPos,k<L&&(w>A||w===A&&v>H)&&c++,L<k&&(A>w||A===w&&H>v)&&c++)}for(a[l*s+l]=c,f=l+1;f<s;f++){var R=0,X=0;if(0<=i){c=n[l].sourceEdgesArrayAccess;var Y=n[f].sourceEdgesArrayAccess;for(m=0;m<c.length;m++)if(k=c[m],k.valid&&k.fromVertex.layer!==e)for(w=k.fromVertex.index,k=k.portFromPos,C=0;C<Y.length;C++)L=Y[C],L.valid&&L.fromVertex.layer!==e&&(A=L.fromVertex.index,L=L.portFromPos,(w<A||w===A&&k<L)&&X++,(A<w||A===w&&L<k)&&R++)}if(0>=i){for(c=n[l].destinationEdgesArrayAccess,Y=n[f].destinationEdgesArrayAccess,m=0;m<c.length;m++)if(k=c[m],k.valid&&k.toVertex.layer!==e)for(w=k.toVertex.index,v=k.portToPos,C=0;C<Y.length;C++)L=Y[C],L.valid&&L.toVertex.layer!==e&&(A=L.toVertex.index,H=L.portToPos,(w<A||w===A&&v<H)&&X++,(A<w||A===w&&H<v)&&R++)}a[l*s+f]=R,a[f*s+l]=X}}return No(t,e,n),a}Zn.prototype.countCrossings=function(){for(var t=0,e=0;e<=this.Ia;e++)for(var i=Sx(this,e,1),n=this.tc[e],s=0;s<n;s++)for(var a=s;a<n;a++)t+=i[s*n+a];return t};function r(t){for(var e=0,i=0;i<=t.Ia;i++){for(var n=t,s=i,a=Vr(n,s),l=n.tc[s],c=0,f=0;f<l;f++){var m=a[f].destinationEdgesArrayAccess;if(m!==null)for(var v=0;v<m.length;v++){var w=m[v];if(w.valid&&w.toVertex.layer!==s){var C=w.fromVertex.column+w.portFromColOffset,k=w.toVertex.column+w.portToColOffset;c+=(Math.abs(C-k)+1)*j1(w)}}}No(n,s,a),e+=c}return e}Zn.prototype.normalize=function(){var t=1/0;this.Ra=-1;for(var e=this.network.vertexes.iterator;e.next();){var i=e.value;t=Math.min(t,i.column-this.nodeMinColumnSpace(i,!0)),this.Ra=Math.max(this.Ra,i.column+this.nodeMinColumnSpace(i,!1))}for(e.reset();e.next();)e.value.column-=t;this.Ra-=t};function o(t,e,i){for(var n=Vr(t,e),s=t.tc[e],a=[],l=0;l<s;l++){var c=n[l],f=null;0>=i&&(f=c.sourceEdgesArrayAccess);var m=null;0<=i&&(m=c.destinationEdgesArrayAccess);var v=0,w=0,C=c.near;if(C!==null&&C.layer===c.layer&&(v+=C.column-1,w++),f!==null)for(C=0;C<f.length;C++){c=f[C];var k=c.fromVertex;c.valid&&!c.rev&&k.layer!==e&&(v+=k.column,w++)}if(m!==null)for(f=0;f<m.length;f++)c=m[f],C=c.toVertex,c.valid&&!c.rev&&C.layer!==e&&(v+=C.column,w++);a[l]=w===0?-1:v/w}return No(t,e,n),a}function u(t,e,i){for(var n=Vr(t,e),s=t.tc[e],a=[],l=0;l<s;l++){var c=n[l],f=null;0>=i&&(f=c.sourceEdgesArrayAccess);var m=null;0<=i&&(m=c.destinationEdgesArrayAccess);var v=0,w=[],C=c.near;if(C!==null&&C.layer===c.layer&&(w[v]=C.column-1,v++),c=void 0,f!==null)for(C=0;C<f.length;C++){c=f[C];var k=c.fromVertex;c.valid&&!c.rev&&k.layer!==e&&(w[v]=k.column+c.portFromColOffset,v++)}if(m!==null)for(f=0;f<m.length;f++)c=m[f],C=c.toVertex,c.valid&&!c.rev&&C.layer!==e&&(w[v]=C.column+c.portToColOffset,v++);v===0?a[l]=-1:(w.sort(function(L,A){return L-A}),m=v>>1,a[l]=v&1?w[m]:w[m-1]+w[m]>>1)}return No(t,e,n),a}function d(t,e,i,n,s,a){if(e.component===n){if(e.component=i,s)for(var l=e.destinationEdges;l.next();){var c=l.value,f=c.toVertex,m=e.layer-f.layer;c=t.linkMinLength(c),m===c&&d(t,f,i,n,s,a)}if(a)for(l=e.sourceEdges;l.next();)c=l.value,f=c.fromVertex,m=f.layer-e.layer,c=t.linkMinLength(c),m===c&&d(t,f,i,n,s,a)}}function g(t,e,i,n,s,a){if(e.component===n){if(e.component=i,s)for(var l=e.destinationEdges;l.next();)g(t,l.value.toVertex,i,n,s,a);if(a)for(e=e.sourceEdges;e.next();)g(t,e.value.fromVertex,i,n,s,a)}}Zn.prototype.removeCycles=function(){for(var t=this.network.edges.iterator;t.next();)t.value.rev=!1;switch(this.Dk){default:case ph:t=this.network;var e=0,i=t.vertexes.count-1,n=[];n.length=i+1;for(var s=t.vertexes.iterator;s.next();)s.value.valid=!0;for(;b(t)!==null;){for(s=M(t);s!==null;)n[i]=s,i--,s.valid=!1,s=M(t);for(s=N(t);s!==null;)n[e]=s,e++,s.valid=!1,s=N(t);s=null;for(var a=0,l=this.network.vertexes.iterator;l.next();){var c=l.value;if(c.valid){for(var f=0,m=c.destinationEdges;m.next();)m.value.toVertex.valid&&f++;m=0;for(var v=c.sourceEdges;v.next();)v.value.fromVertex.valid&&m++;(s===null||a<f-m)&&(s=c,a=f-m)}}s!==null&&(n[e]=s,e++,s.valid=!1)}for(e=0;e<t.vertexes.count;e++)n[e].index=e;for(n=t.edges.iterator;n.next();)e=n.value,e.fromVertex.index>e.toVertex.index&&(t.gm(e),e.rev=!0);break;case Gs:for(n=this.network.vertexes.iterator;n.next();)t=n.value,t.Ll=-1,t.finish=-1;for(t=this.network.edges.iterator;t.next();)t.value.forest=!1;for(this.Kn=0,n.reset();n.next();)e=n.value,e.sourceEdges.count===0&&I(this,e);for(n.reset();n.next();)e=n.value,e.Ll===-1&&I(this,e);for(t.reset();t.next();)n=t.value,n.forest||(e=n.fromVertex,i=e.finish,s=n.toVertex,a=s.finish,s.Ll<e.Ll&&i<a&&(this.network.gm(n),n.rev=!0));break;case fu:for(t=this.network,e=t.vertexes.iterator,n=1/0;e.next();)n=Math.min(n,e.value.layer);if(1/0>n){if(0>n)for(e.reset();e.next();)e.value.layer-=n;for(n=[],e.reset();e.next();)i=e.value,s=n[i.layer],s===void 0?n[i.layer]=[i]:s.push(i);for(i=e=0;i<n.length;i++)if(s=n[i],!s||s.length===0)e++;else if(0<i)for(a=0;a<s.length;a++)s[a].layer-=e;for(n=t.edges.iterator;n.next();)e=n.value,e.fromVertex.layer<e.toVertex.layer&&(t.gm(e),e.rev=!0)}}};function b(t){for(t=t.vertexes.iterator;t.next();){var e=t.value;if(e.valid)return e}return null}function M(t){for(t=t.vertexes.iterator;t.next();){var e=t.value;if(e.valid){for(var i=!0,n=e.destinationEdges;n.next();)if(n.value.toVertex.valid){i=!1;break}if(i)return e}}return null}function N(t){for(t=t.vertexes.iterator;t.next();){var e=t.value;if(e.valid){for(var i=!0,n=e.sourceEdges;n.next();)if(n.value.fromVertex.valid){i=!1;break}if(i)return e}}return null}function I(t,e){e.Ll=t.Kn,t.Kn++;for(var i=e.destinationEdges;i.next();){var n=i.value,s=n.toVertex;s.Ll===-1&&(n.forest=!0,I(t,s))}e.finish=t.Kn,t.Kn++}Zn.prototype.assignLayers=function(){switch(this.Zk){case mh:F(this);break;case Bu:for(var t,e=this.network.vertexes.iterator;e.next();)t=it(this,e.value),this.Ia=Math.max(t,this.Ia);for(e.reset();e.next();)t=e.value,t.layer=this.Ia-t.layer;break;default:case Ou:for(F(this),e=this.network.vertexes.iterator;e.next();)e.value.valid=!1;for(e.reset();e.next();)t=e.value,t.sourceEdges.count===0&&gt(this,t);for(t=1/0,e.reset();e.next();)t=Math.min(t,e.value.layer);for(this.Ia=-1,e.reset();e.next();){var i=e.value;i.layer-=t,this.Ia=Math.max(this.Ia,i.layer)}}};function F(t){for(var e=t.network.vertexes.iterator;e.next();){var i=$(t,e.value);t.Ia=Math.max(i,t.Ia)}}function $(t,e){var i=0;if(e.layer===-1){for(var n=e.destinationEdges;n.next();){var s=n.value,a=s.toVertex;s=t.linkMinLength(s),i=Math.max(i,$(t,a)+s)}e.layer=i}else i=e.layer;return i}function it(t,e){var i=0;if(e.layer===-1){for(var n=e.sourceEdges;n.next();){var s=n.value,a=s.fromVertex;s=t.linkMinLength(s),i=Math.max(i,it(t,a)+s)}e.layer=i}else i=e.layer;return i}function gt(t,e){if(!e.valid){e.valid=!0;for(var i=e.destinationEdges;i.next();)gt(t,i.value.toVertex);for(i=t.network.vertexes.iterator;i.next();)i.value.component=-1;for(var n=e.sourceEdgesArrayAccess,s=n.length,a=0;a<s;a++){var l=n[a],c=l.fromVertex,f=l.toVertex;l=t.linkMinLength(l),c.layer-f.layer>l&&d(t,c,0,-1,!0,!1)}for(d(t,e,1,-1,!0,!0);e.component!==0;){for(a=0,n=1/0,c=0,f=null,l=t.network.vertexes.iterator;l.next();){var m=l.value;if(m.component===1){var v=0,w=!1,C=m.sourceEdgesArrayAccess;s=C.length;for(var k=0;k<s;k++){var L=C[k],A=L.fromVertex;v+=1,A.component!==1&&(a+=1,A=A.layer-m.layer,L=t.linkMinLength(L),n=Math.min(n,A-L))}for(C=m.destinationEdgesArrayAccess,s=C.length,k=0;k<s;k++)L=C[k].toVertex,--v,L.component!==1?--a:w=!0;(f===null||v<c)&&!w&&(f=m,c=v)}}if(0<a){for(i.reset();i.next();)s=i.value,s.component===1&&(s.layer+=n);e.component=0}else f.component=0}for(i=t.network.vertexes.iterator;i.next();)i.value.component=-1;for(d(t,e,1,-1,!0,!1);e.component!==0;){for(n=0,s=1/0,a=0,c=null,f=t.network.vertexes.iterator;f.next();)if(l=f.value,l.component===1){for(m=0,v=!1,C=l.sourceEdgesArrayAccess,w=C.length,k=0;k<w;k++)L=C[k].fromVertex,m+=1,L.component!==1?n+=1:v=!0;for(C=l.destinationEdgesArrayAccess,w=C.length,k=0;k<w;k++)L=C[k],A=L.toVertex,--m,A.component!==1&&(--n,A=l.layer-A.layer,L=t.linkMinLength(L),s=Math.min(s,A-L));(c===null||m>a)&&!v&&(c=l,a=m)}if(0>n){for(i.reset();i.next();)n=i.value,n.component===1&&(n.layer-=s);e.component=0}else c.component=0}}}function _t(t,e,i){return t.K===90?i&&!e.rev||!i&&e.rev?270:90:t.K===180?i&&!e.rev||!i&&e.rev?0:180:t.K===270?i&&!e.rev||!i&&e.rev?90:270:i&&!e.rev||!i&&e.rev?180:0}Zn.prototype.initializeIndices=function(){switch(this.Qk){default:case Cx:for(var t=this.network.vertexes.iterator;t.next();){var e=t.value,i=e.layer;e.index=this.tc[i],this.tc[i]++}break;case A0:for(t=this.network.vertexes.iterator,e=this.Ia;0<=e;e--)for(t.reset();t.next();)i=t.value,i.layer===e&&i.index===-1&&zt(this,i);break;case Mx:for(t=this.network.vertexes.iterator,e=0;e<=this.Ia;e++)for(t.reset();t.next();)i=t.value,i.layer===e&&i.index===-1&&Ne(this,i)}};function zt(t,e){var i=e.layer;for(e.index=t.tc[i],t.tc[i]++,e=e.destinationEdgesArrayAccess,i=!0;i;){i=!1;for(var n=0;n<e.length-1;n++){var s=e[n],a=e[n+1];s.portFromColOffset>a.portFromColOffset&&(i=!0,e[n]=a,e[n+1]=s)}}for(i=0;i<e.length;i++)n=e[i],n.valid&&(n=n.toVertex,n.index===-1&&zt(t,n))}function Ne(t,e){var i=e.layer;e.index=t.tc[i],t.tc[i]++,e=e.sourceEdgesArrayAccess;for(var n=!0;n;)for(n=!1,i=0;i<e.length-1;i++){var s=e[i],a=e[i+1];s.portToColOffset>a.portToColOffset&&(n=!0,e[i]=a,e[i+1]=s)}for(i=0;i<e.length;i++)n=e[i],n.valid&&(n=n.fromVertex,n.index===-1&&Ne(t,n))}Zn.prototype.reduceCrossings=function(){var t=this.countCrossings(),e=fa(this),i,n;for(i=0;i<this.bj;i++){for(n=0;n<=this.Ia;n++)Bi(this,n,1),Ee(this,n,1);var s=this.countCrossings();for(s<t&&(t=s,e=fa(this)),n=this.Ia;0<=n;n--)Bi(this,n,-1),Ee(this,n,-1);s=this.countCrossings(),s<t&&(t=s,e=fa(this))}for(yl(this,e),i=0;i<this.bj;i++){for(n=0;n<=this.Ia;n++)Bi(this,n,0),Ee(this,n,0);for(s=this.countCrossings(),s<t&&(t=s,e=fa(this)),n=this.Ia;0<=n;n--)Bi(this,n,0),Ee(this,n,0);s=this.countCrossings(),s<t&&(t=s,e=fa(this))}yl(this,e);var a,l,c;switch(this.rk){case kx:break;case Lx:for(c=t+1;(n=this.countCrossings())<c;)for(c=n,i=this.Ia;0<=i;i--)for(l=0;l<=i;l++){for(a=!0;a;)for(a=!1,n=i;n>=l;n--)a=Ee(this,n,-1)||a;for(s=this.countCrossings(),s>=t?yl(this,e):(t=s,e=fa(this)),a=!0;a;)for(a=!1,n=i;n>=l;n--)a=Ee(this,n,1)||a;for(s=this.countCrossings(),s>=t?yl(this,e):(t=s,e=fa(this)),a=!0;a;)for(a=!1,n=l;n<=i;n++)a=Ee(this,n,1)||a;for(s>=t?yl(this,e):(t=s,e=fa(this)),a=!0;a;)for(a=!1,n=l;n<=i;n++)a=Ee(this,n,-1)||a;for(s>=t?yl(this,e):(t=s,e=fa(this)),a=!0;a;)for(a=!1,n=i;n>=l;n--)a=Ee(this,n,0)||a;for(s>=t?yl(this,e):(t=s,e=fa(this)),a=!0;a;)for(a=!1,n=l;n<=i;n++)a=Ee(this,n,0)||a;s>=t?yl(this,e):(t=s,e=fa(this))}break;default:case $1:for(i=this.Ia,l=0,c=t+1;(n=this.countCrossings())<c;){for(c=n,a=!0;a;)for(a=!1,n=i;n>=l;n--)a=Ee(this,n,-1)||a;for(s=this.countCrossings(),s>=t?yl(this,e):(t=s,e=fa(this)),a=!0;a;)for(a=!1,n=i;n>=l;n--)a=Ee(this,n,1)||a;for(s=this.countCrossings(),s>=t?yl(this,e):(t=s,e=fa(this)),a=!0;a;)for(a=!1,n=l;n<=i;n++)a=Ee(this,n,1)||a;for(s>=t?yl(this,e):(t=s,e=fa(this)),a=!0;a;)for(a=!1,n=l;n<=i;n++)a=Ee(this,n,-1)||a;for(s>=t?yl(this,e):(t=s,e=fa(this)),a=!0;a;)for(a=!1,n=i;n>=l;n--)a=Ee(this,n,0)||a;for(s>=t?yl(this,e):(t=s,e=fa(this)),a=!0;a;)for(a=!1,n=l;n<=i;n++)a=Ee(this,n,0)||a;s>=t?yl(this,e):(t=s,e=fa(this))}}yl(this,e)};function Bi(t,e,i){var n=Vr(t,e),s=t.tc[e],a=u(t,e,i),l=o(t,e,i);for(i=0;i<s;i++)l[i]===-1&&(l[i]=n[i].column),a[i]===-1&&(a[i]=n[i].column);for(var c=!0,f;c;)for(c=!1,i=0;i<s-1;i++)(a[i+1]<a[i]||a[i+1]===a[i]&&l[i+1]<l[i])&&(c=!0,f=a[i],a[i]=a[i+1],a[i+1]=f,f=l[i],l[i]=l[i+1],l[i+1]=f,f=n[i],n[i]=n[i+1],n[i+1]=f);for(i=a=0;i<s;i++)f=n[i],f.index=i,a+=t.nodeMinColumnSpace(f,!0),f.column=a,a+=1,a+=t.nodeMinColumnSpace(f,!1);No(t,e,n)}function Ee(t,e,i){var n=Vr(t,e),s=t.tc[e];i=Sx(t,e,i);var a,l=[];for(a=0;a<s;a++)l[a]=-1;var c=[];for(a=0;a<s;a++)c[a]=-1;for(var f=!1,m=!0;m;)for(m=!1,a=0;a<s-1;a++){var v=i[n[a].index*s+n[a+1].index],w=i[n[a+1].index*s+n[a].index],C=0,k=0,L=n[a].column,A=n[a+1].column,H=t.nodeMinColumnSpace(n[a],!0),R=t.nodeMinColumnSpace(n[a],!1),X=t.nodeMinColumnSpace(n[a+1],!0),Y=t.nodeMinColumnSpace(n[a+1],!1);H=L-H+X,R=A-R+Y;var tt=n[a].sourceEdges.iterator;for(tt.reset();tt.next();)if(X=tt.value,Y=X.fromVertex,X.valid&&Y.layer===e){for(X=0;n[X]!==Y;)X++;X<a&&(C+=2*(a-X),k+=2*(a+1-X)),X===a+1&&(C+=1),X>a+1&&(C+=4*(X-a),k+=4*(X-(a+1)))}for(tt=n[a].destinationEdges.iterator,tt.reset();tt.next();)if(X=tt.value,Y=X.toVertex,X.valid&&Y.layer===e){for(X=0;n[X]!==Y;)X++;X===a+1&&(k+=1)}for(tt=n[a+1].sourceEdges.iterator,tt.reset();tt.next();)if(X=tt.value,Y=X.fromVertex,X.valid&&Y.layer===e){for(X=0;n[X]!==Y;)X++;X<a&&(C+=2*(a+1-X),k+=2*(a-X)),X===a&&(k+=1),X>a+1&&(C+=4*(X-(a+1)),k+=4*(X-a))}for(tt=n[a+1].destinationEdges.iterator,tt.reset();tt.next();)if(X=tt.value,Y=X.toVertex,X.valid&&Y.layer===e){for(X=0;n[X]!==Y;)X++;X===a&&(C+=1)}X=Y=0,tt=l[n[a].index];var st=c[n[a].index],bt=l[n[a+1].index],Te=c[n[a+1].index];tt!==-1&&(Y+=Math.abs(tt-L),X+=Math.abs(tt-R)),st!==-1&&(Y+=Math.abs(st-L),X+=Math.abs(st-R)),bt!==-1&&(Y+=Math.abs(bt-A),X+=Math.abs(bt-H)),Te!==-1&&(Y+=Math.abs(Te-A),X+=Math.abs(Te-H)),(k<C-.5||k===C&&w<v-.5||k===C&&w===v&&X<Y-.5)&&(m=f=!0,n[a].column=R,n[a+1].column=H,v=n[a],n[a]=n[a+1],n[a+1]=v)}for(a=0;a<s;a++)n[a].index=a;return No(t,e,n),f}Zn.prototype.straightenAndPack=function(){if(this.ve===0){var t=(this.bg&1)!==0,e=(this.bg&j2)!==0;if(1e3<this.network.edges.count&&e&&(t=!1),t){var i=[];for(e=0;e<=this.Ia;e++)i[e]=0;for(var n,s=this.network.vertexes.iterator;s.next();){var a=s.value;e=a.layer,n=a.column,a=this.nodeMinColumnSpace(a,!1),i[e]=Math.max(i[e],n+a)}for(s.reset();s.next();)a=s.value,e=a.layer,n=a.column,a.column=(8*(this.Ra-i[e])>>1)+8*n;this.Ra*=8}if(this.bg&2)for(i=!0;i;){for(i=!1,e=this.Md+1;e<=this.Ia;e++)i=hi(this,e,1)||i;for(e=this.Md-1;0<=e;e--)i=hi(this,e,-1)||i;i=hi(this,this.Md,0)||i}if(this.bg&4){for(e=this.Md+1;e<=this.Ia;e++)xi(this,e,1);for(e=this.Md-1;0<=e;e--)xi(this,e,-1);xi(this,this.Md,0)}if(t&&(En(this,-1),En(this,1)),this.bg&2)for(i=!0;i;){for(i=!1,i=hi(this,this.Md,0)||i,e=this.Md+1;e<=this.Ia;e++)i=hi(this,e,0)||i;for(e=this.Md-1;0<=e;e--)i=hi(this,e,0)||i}}else Po(this)};function hi(t,e,i){for(var n=!1;$i(t,e,i);)n=!0;return n}function $i(t,e,i){var n,s=Vr(t,e),a=t.tc[e],l=o(t,e,-1);if(0<i)for(n=0;n<a;n++)l[n]=-1;var c=o(t,e,1);if(0>i)for(n=0;n<a;n++)c[n]=-1;for(var f=!1,m=!0;m;)for(m=!1,n=0;n<a;n++){var v=s[n].column,w=t.nodeMinColumnSpace(s[n],!0),C=t.nodeMinColumnSpace(s[n],!1),k=0;0>n-1||v-s[n-1].column-1>w+t.nodeMinColumnSpace(s[n-1],!1)?k=v-1:k=v,w=n+1>=a||s[n+1].column-v-1>C+t.nodeMinColumnSpace(s[n+1],!0)?v+1:v;var L=C=0,A=0;if(0>=i)for(var H=s[n].sourceEdges.iterator;H.next();){var R=H.value,X=R.fromVertex;if(R.valid&&X.layer!==e){var Y=j1(R),tt=R.portFromColOffset;R=R.portToColOffset,X=X.column,C+=(Math.abs(v+R-(X+tt))+1)*Y,L+=(Math.abs(k+R-(X+tt))+1)*Y,A+=(Math.abs(w+R-(X+tt))+1)*Y}}if(0<=i)for(H=s[n].destinationEdges.iterator;H.next();)R=H.value,X=R.toVertex,R.valid&&X.layer!==e&&(Y=j1(R),tt=R.portFromColOffset,R=R.portToColOffset,X=X.column,C+=(Math.abs(v+tt-(X+R))+1)*Y,L+=(Math.abs(k+tt-(X+R))+1)*Y,A+=(Math.abs(w+tt-(X+R))+1)*Y);R=tt=Y=0,H=l[s[n].index],X=c[s[n].index],H!==-1&&(Y+=Math.abs(H-v),tt+=Math.abs(H-k),R+=Math.abs(H-w)),X!==-1&&(Y+=Math.abs(X-v),tt+=Math.abs(X-k),R+=Math.abs(X-w)),L<C||L===C&&tt<Y?(m=f=!0,s[n].column=k):(A<C||A===C&&R<Y)&&(m=f=!0,s[n].column=w)}return No(t,e,s),t.normalize(),f}function xi(t,e,i){var n=Vr(t,e),s=t.tc[e],a=u(t,e,i),l=[];for(i=0;i<s;i++)l[i]=a[i];for(a=!0;a;)for(a=!1,i=0;i<s;i++){var c=n[i].column,f=t.nodeMinColumnSpace(n[i],!0),m=t.nodeMinColumnSpace(n[i],!1),v=0;if(l[i]===-1)if(i===0&&i===s-1)v=c;else if(i===0){var w=n[i+1].column;w-c===m+t.nodeMinColumnSpace(n[i+1],!0)?v=c-1:v=c}else i===s-1?(w=n[i-1].column,v=c-w===f+t.nodeMinColumnSpace(n[i-1],!1)?c+1:c):(w=n[i-1].column,f=w+t.nodeMinColumnSpace(n[i-1],!1)+f+1,w=n[i+1].column,m=w-t.nodeMinColumnSpace(n[i+1],!0)-m-1,v=(f+m)/2|0);else i===0&&i===s-1?v=l[i]:i===0?(w=n[i+1].column,m=w-t.nodeMinColumnSpace(n[i+1],!0)-m-1,v=Math.min(l[i],m)):i===s-1?(w=n[i-1].column,f=w+t.nodeMinColumnSpace(n[i-1],!1)+f+1,v=Math.max(l[i],f)):(w=n[i-1].column,f=w+t.nodeMinColumnSpace(n[i-1],!1)+f+1,w=n[i+1].column,m=w-t.nodeMinColumnSpace(n[i+1],!0)-m-1,f<l[i]&&l[i]<m?v=l[i]:f>=l[i]?v=f:m<=l[i]&&(v=m));v!==c&&(a=!0,n[i].column=v)}No(t,e,n),t.normalize()}function bn(t,e){for(var i=!0,n=t.network.vertexes.iterator;n.next();){var s=n.value,a=t.nodeMinColumnSpace(s,!0),l=t.nodeMinColumnSpace(s,!1);if(s.column-a<=e&&s.column+l>=e){i=!1;break}}if(t=!1,i)for(n.reset();n.next();)i=n.value,i.column>e&&(--i.column,t=!0);return t}function Rn(t,e){var i=e+1,n,s=[],a=[];for(n=0;n<=t.Ia;n++)s[n]=!1,a[n]=!1;for(var l=t.network.vertexes.iterator;l.next();){n=l.value;var c=n.column-t.nodeMinColumnSpace(n,!0),f=n.column+t.nodeMinColumnSpace(n,!1);c<=e&&f>=e&&(s[n.layer]=!0),c<=i&&f>=i&&(a[n.layer]=!0)}for(c=!0,i=!1,n=0;n<=t.Ia;n++)c=c&&!(s[n]&&a[n]);if(c)for(l.reset();l.next();)t=l.value,t.column>e&&(--t.column,i=!0);return i}function En(t,e){for(var i=0;i<=t.Ra;i++)for(;bn(t,i););for(t.normalize(),i=0;i<t.Ra;i++)for(;Rn(t,i););t.normalize();var n;if(0<e)for(i=0;i<=t.Ra;i++){var s=fa(t),a=r(t);for(n=a+1;a<n;){n=a,Fr(t,i,1);var l=r(t);l>a?yl(t,s):l<a&&(a=l,s=fa(t))}}if(0>e)for(i=t.Ra;0<=i;i--)for(s=fa(t),a=r(t),n=a+1;a<n;)n=a,Fr(t,i,-1),l=r(t),l>a?yl(t,s):l<a&&(a=l,s=fa(t));t.normalize()}function Fr(t,e,i){t.le=0;for(var n=t.network.vertexes.iterator;n.next();)n.value.component=-1;if(0<i)for(n.reset();n.next();){var s=n.value;s.column-t.nodeMinColumnSpace(s,!0)<=e&&(s.component=t.le)}if(0>i)for(n.reset();n.next();)s=n.value,s.column+t.nodeMinColumnSpace(s,!1)>=e&&(s.component=t.le);for(t.le++,n.reset();n.next();)e=n.value,e.component===-1&&(g(t,e,t.le,-1,!0,!0),t.le++);var a;for(e=[],a=0;a<t.le*t.le;a++)e[a]=!1;for(s=[],a=0;a<(t.Ia+1)*(t.Ra+1);a++)s[a]=-1;for(n.reset();n.next();){a=n.value;for(var l=a.layer,c=Math.max(0,a.column-t.nodeMinColumnSpace(a,!0)),f=Math.min(t.Ra,a.column+t.nodeMinColumnSpace(a,!1));c<=f;c++)s[l*(t.Ra+1)+c]=a.component}for(a=0;a<=t.Ia;a++){if(0<i)for(l=0;l<t.Ra;l++)s[a*(t.Ra+1)+l]!==-1&&s[a*(t.Ra+1)+l+1]!==-1&&s[a*(t.Ra+1)+l]!==s[a*(t.Ra+1)+l+1]&&(e[s[a*(t.Ra+1)+l]*t.le+s[a*(t.Ra+1)+l+1]]=!0);if(0>i)for(l=t.Ra;0<l;l--)s[a*(t.Ra+1)+l]!==-1&&s[a*(t.Ra+1)+l-1]!==-1&&s[a*(t.Ra+1)+l]!==s[a*(t.Ra+1)+l-1]&&(e[s[a*(t.Ra+1)+l]*t.le+s[a*(t.Ra+1)+l-1]]=!0)}for(s=[],a=0;a<t.le;a++)s[a]=!0;for(l=[],l.push(0);l.length!==0;)if(f=l[l.length-1],l.pop(),s[f])for(s[f]=!1,a=0;a<t.le;a++)e[f*t.le+a]&&l.splice(0,0,a);if(0<i)for(n.reset();n.next();)t=n.value,s[t.component]&&--t.column;if(0>i)for(n.reset();n.next();)i=n.value,s[i.component]&&(i.column+=1)}function Po(t){for(var e=Pe(),i=t.fl.length,n=0;n<=i;n++)e[n]=[];for(n=t.network.vertexes.iterator;n.next();){var s=n.value;e[i-s.layer][s.index]=s}i=new At,Yi(e,i);var a=null,l=null,c=null,f=null,m=(t.ve&1)!==0,v=(t.ve&2)!==0,w=(t.ve&4)!==0,C=(t.ve&8)!==0;for(m&&(t.verticalAlignment(e,i,!0),a=Au(t,e,!0,!1)),e.reverse(),w&&(t.verticalAlignment(e,i,!1),c=Au(t,e,!1,!1)),n=$n(e),s=n.next();!s.done;s=n.next())s.value.reverse();C&&(t.verticalAlignment(e,i,!1),f=Au(t,e,!1,!0)),e.reverse(),v&&(t.verticalAlignment(e,i,!0),l=Au(t,e,!0,!0)),qe(e),t.u(a,l,c,f),t.network.vertexes.each(function(k){var L=Pe();m&&L.push(a.get(k)),v&&L.push(l.get(k)),w&&L.push(c.get(k)),C&&L.push(f.get(k)),L.sort(function(H,R){return H-R});var A=L.length;A=(L[Math.floor((A-1)/2)]+L[Math.ceil((A-1)/2)])/2,qe(L),k.zc=A})}function Yi(t,e){for(var i=t.length,n=1;n<i-1;n++)for(var s=0,a=0,l=t[n],c=t[n+1],f=0;a<c.length;f++){var m=c[f];t:{if(m.node===null){var v=Ex(m);if(0<v.length){v=v[0].node===null;break t}}v=!1}var w=v;if(f===c.length-1||w){for(v=l.length-1,w&&(v=Ex(m)[0].index);a<=f;){if(m=c[a],!m.bo){w=[];for(var C=$n(m.sourceEdgesArrayAccess),k=C.next();!k.done;k=C.next())k=k.value,k.valid&&w.push(k);m.bo=w}for(m=$n(m.bo),w=m.next();!w.done;w=m.next())w=w.value,C=w.fromVertex.index,(C<s||C>v)&&e.add(w);a++}s=v}}}Zn.prototype.verticalAlignment=function(t,e,i){Nu(t),t=$n(t);for(var n=t.next();!n.done;n=t.next()){var s=-1;n=$n(n.value);for(var a=n.next();!a.done;a=n.next()){a=a.value;var l=i?Ex(a):$2(a),c=l.length;if(0<c){l.sort(function(w,C){return w.vi-C.vi});var f=(c-1)/2;for(c=Math.floor(f),f=Math.ceil(f);c<=f;c++)if(a.align===a){var m=l[c],v=void 0;v=i?K1(m,a):K1(a,m),!e.contains(v)&&s<m.vi&&(m.align=a,a.root=m.root,a.align=m.root,s=m.vi)}}}}};function Nu(t){for(var e=0;e<t.length;e++)for(var i=t[e],n=0;n<i.length;n++){var s=i[n];s.root=s,s.align=s,s.Tz=e,s.vi=n}}function Au(t,e,i,n){for(var s=t.K===90||t.K===270,a=$n(e),l=a.next();!l.done;l=a.next()){var c=$n(l.value);for(l=c.next();!l.done;l=c.next())l=l.value,l.sd=l,l.shift=1/0,l.zc=NaN,l.qg=0}for(l=t.K===90||t.K===270,a=$n(e),c=a.next();!c.done;c=a.next()){c=$n(c.value);for(var f=c.next();!f.done;f=c.next())if(f=f.value,f.root===f){for(var m=0,v=f;v.align!==f;){var w=v.align,C=l?v.width:v.height,k=l?w.width:w.height;if(i){var L=K1(v,w),A=L.portFromPos,H=L.portToPos;L.link!==null&&(v.node&&v.node!==L.link.fromNode&&(A=l?v.focusX:v.focusY),w.node&&w.node!==L.link.toNode&&(H=l?w.focusX:w.focusY))}else L=K1(w,v),A=L.portToPos,H=L.portFromPos,L.link!==null&&(v.node&&v.node!==L.link.toNode&&(A=l?v.focusX:v.focusY),w.node&&w.node!==L.link.fromNode&&(H=l?w.focusX:w.focusY));C=n?v.qg+(C-A)-(k-H):v.qg+A-H,w.qg=C,m=Math.min(m,C),v=v.align}v=f;do v.qg=v.qg-m,v=v.align;while(v!==f)}}for(i=$n(e),l=i.next();!l.done;l=i.next())for(a=$n(l.value),l=a.next();!l.done;l=a.next())l=l.value,l.root===l&&Du(t,l,e);for(i=0;i<e.length;i++)if(!(0>=e[i].length)&&(l=e[i][0],l.sd===l)){l.sd.shift===1/0&&(l.sd.shift=0),l=i,c=0;do{for(a=e[l][c];a.align!==a.root;)a=a.align,l++,0<a.vi&&(c=pa(a,e),c.sd.shift=Math.min(c.sd.shift,a.sd.shift+a.zc+a.qg-(c.zc+c.qg+(s?c.width:c.height)+t.columnSpacing)));c=a.vi+1}while(l<e.length&&c<e[l].length&&a.sd===e[l][c].sd)}for(t=new pe,e=$n(e),l=e.next();!l.done;l=e.next())for(i=$n(l.value),l=i.next();!l.done;l=i.next())l=l.value,l.zc=l.zc+l.sd.shift+l.qg,a=s?l.width:l.height,t.add(l,n?-l.zc-a:l.zc);return t}function Du(t,e,i){if(isNaN(e.zc)){e.zc=0;var n=e;do{if(0<n.vi){var s=pa(n,i),a=s.root;Du(t,a,i),e.sd===e&&(e.sd=a.sd);var l=t.K===90||t.K===270?s.width:s.height;e.sd===a.sd&&(e.zc=Math.max(e.zc,a.zc+s.qg+l-n.qg+t.columnSpacing))}n=n.align}while(n!==e);for(;n.align!==e;)n=n.align,n.zc=e.zc,n.sd=e.sd}}function pa(t,e){var i=t.Tz;return t=t.vi,1>t&&lt("Could not determine previous vertex in layer"),e[i][t-1]}Zn.prototype.u=function(t){for(var e=[],i=0;i<arguments.length;++i)e[i]=arguments[i];i=-1;for(var n=Pe(),s=Pe(),a=1/0,l=0;4>l;l++)if(e[l]){var c=Iu(this,e[l],n,s,l);c<a&&(i=l,a=c)}for(a={},l=0;4>l;a={delta:a.delta},l++)e[l]&&(a.delta=l===0||l===2?n[i]-n[l]:s[i]-s[l],a.delta!==0&&e[l].each(function(f){return function(m){m.value+=f.delta}}(a)));qe(n),qe(s)};function Iu(t,e,i,n,s){if(!e||e.count===0)return i[s]=0,n[s]=0,1/0;var a=1/0,l=-1/0;return e.each(function(c){var f=c.key;c=c.value,f=t.K===90||t.K===270?f.width:f.height,c<a&&(a=c),c+f>l&&(l=c+f)}),i[s]=a,n[s]=l,l-a}Zn.prototype.commitLayout=function(){if(this.setsPortSpots)for(var t=el(this,!0),e=el(this,!1),i=this.network.edges.iterator;i.next();){var n=i.value.link;n!==null&&(n.fromSpot=t,n.toSpot=e)}this.commitNodes(),this.Gu(),this.isRouting&&this.commitLinks()};function el(t,e){return t.K===270?e?oo:ao:t.K===90?e?ao:oo:t.K===180?e?co:so:e?so:co}Zn.prototype.commitNodes=function(){this.he=[],this.Ld=[],this.Kd=[],this.Ta=[];for(var t=0;t<=this.Ia;t++)this.he[t]=0,this.Ld[t]=0,this.Kd[t]=0,this.Ta[t]=0;for(t=this.network.vertexes.iterator;t.next();){var e=t.value,i=e.layer;this.he[i]=Math.max(this.he[i],this.nodeMinLayerSpace(e,!0)),this.Ld[i]=Math.max(this.Ld[i],this.nodeMinLayerSpace(e,!1))}e=0,i=this.ie;for(var n=0;n<=this.Ia;n++){var s=i;0>=this.he[n]+this.Ld[n]&&(s=0),0<n&&(e+=s/2),this.K===90||this.K===0?(e+=this.Ld[n],this.Kd[n]=e,e+=this.he[n]):(e+=this.he[n],this.Kd[n]=e,e+=this.Ld[n]),n<this.Ia&&(e+=s/2),this.Ta[n]=e}for(i=e,e=this.arrangementOrigin,n=0;n<=this.Ia;n++)this.K===270?this.Kd[n]=e.y+this.Kd[n]:this.K===90?(this.Kd[n]=e.y+i-this.Kd[n],this.Ta[n]=i-this.Ta[n]):this.K===180?this.Kd[n]=e.x+this.Kd[n]:(this.Kd[n]=e.x+i-this.Kd[n],this.Ta[n]=i-this.Ta[n]);i=this.ve!==0,t.reset(),n=this.K===270||this.K===90;for(var a=1/0,l=s=1/0,c=-1/0;t.next();){var f=t.value,m=f.layer,v=f.column|0;n?(l=e.x+this.kc*v,m=this.Kd[m]):(l=this.Kd[m],m=e.y+this.kc*v),f.centerX=l,f.centerY=m,i&&isFinite(f.zc)&&(n?f.node?f.x=e.x+f.zc:f.centerX=e.x+f.zc:f.node?f.y=e.y+f.zc:f.centerY=e.y+f.zc),a=Math.min(f.x,a),s=Math.min(f.y,s),n?(l=a,c=Math.max(c,f.bounds.right)):(l=s,c=Math.max(c,f.bounds.bottom))}for(this.xw=c-l,a=e.x-a,e=e.y-s,this.Rf=new z(i&&n?0:a,i&&!n?0:e),t.reset();t.next();)i=t.value,i.x+=a,i.y+=e,i.commit()},Zn.prototype.Gu=function(){for(var t=0,e=this.ie,i=0;i<=this.Ia;i++)t+=this.he[i],t+=this.Ld[i];t+=this.Ia*e,e=[],i=this.ve!==0?this.xw:this.kc*this.Ra;for(var n=this.maxLayer;0<=n;n--)this.K===270?n===0?e.push(new It(0,0,i,Math.abs(this.Ta[0]))):e.push(new It(0,this.Ta[n-1],i,Math.abs(this.Ta[n-1]-this.Ta[n]))):this.K===90?n===0?e.push(new It(0,this.Ta[0],i,Math.abs(this.Ta[0]-t))):e.push(new It(0,this.Ta[n],i,Math.abs(this.Ta[n-1]-this.Ta[n]))):this.K===180?n===0?e.push(new It(0,0,Math.abs(this.Ta[0]),i)):e.push(new It(this.Ta[n-1],0,Math.abs(this.Ta[n-1]-this.Ta[n]),i)):n===0?e.push(new It(this.Ta[0],0,Math.abs(this.Ta[0]-t),i)):e.push(new It(this.Ta[n],0,Math.abs(this.Ta[n-1]-this.Ta[n]),i));this.commitLayers(e,this.Rf)},Zn.prototype.commitLayers=function(){},Zn.prototype.commitLinks=function(){for(var t=this.network.edges.iterator,e;t.next();)e=t.value.link,e!==null&&(e.uh(),e.Fj(),e.zf());for(t.reset();t.next();)e=t.value.link,e!==null&&e.vg();for(t.reset();t.next();){var i=t.value;if(e=i.link,e!==null){e.uh();var n=e,s=n.fromNode,a=n.toNode,l=n.fromPort,c=n.toPort;if(s!==null){var f=s.findVisibleNode();f!==null&&f!==s&&(s=f,l=f.port)}a!==null&&(f=a.findVisibleNode(),f!==null&&f!==a&&(a=f,c=f.port));var m=e.computeSpot(!0,l);f=e.computeSpot(!1,c);var v=i.fromVertex,w=i.toVertex;if(i.valid)e.curve===Qa&&e.pointsCount===4&&(v.column===w.column&&this.alignOption===0?(i=e.getLinkPoint(s,l,m,!0,!1,a,c),c=e.getLinkPoint(a,c,f,!1,!1,s,l),i.w()||i.set(s.actualBounds.center),c.w()||c.set(a.actualBounds.center),e.Fj(),e.yf(i.x,i.y),e.yf((2*i.x+c.x)/3,(2*i.y+c.y)/3),e.yf((i.x+2*c.x)/3,(i.y+2*c.y)/3),e.yf(c.x,c.y)):(i=n=!1,l!==null&&m===Nn&&(n=!0),c!==null&&f===Nn&&(i=!0),(n||i)&&(f=null,n&&(f=e.getLinkPointFromPoint(s,l,l.ga(on),e.i(3),!0),f.w()||f.set(s.actualBounds.center),e.L(0,f.x,f.y)),s=null,i&&(s=e.getLinkPointFromPoint(a,c,c.ga(on),e.i(0),!1),s.w()||s.set(a.actualBounds.center),e.L(3,s.x,s.y)),f&&(a=e.i(2),e.L(1,(2*f.x+a.x)/3,(2*f.y+a.y)/3)),s&&(a=e.i(1),e.L(2,(2*s.x+a.x)/3,(2*s.y+a.y)/3))))),e.zf();else if(v.layer===w.layer)e.zf();else{var C=!1,k=!1,L=this.ie,A=e.firstPickIndex+1;if(e.isOrthogonal){k=!0;var H=e.pointsCount;4<H&&e.points.removeRange(2,H-3)}else if(e.curve===Qa)C=!0,H=e.pointsCount,4<H&&e.points.removeRange(2,H-3),H===4&&(A=2);else{H=e.pointsCount;var R=m===Nn,X=f===Nn;2<H&&R&&X?e.points.removeRange(1,H-2):3<H&&R&&!X?e.points.removeRange(1,H-3):3<H&&!R&&X?e.points.removeRange(2,H-2):4<H&&!R&&!X&&e.points.removeRange(2,H-3)}if(i.rev){for(;w!==null&&v!==w;){var Y=H=null;for(R=w.sourceEdges.iterator;R.next()&&(X=R.value,X.link!==i.link||(H=X.fromVertex,Y=X.toVertex,H.node!==null)););if(H===null)break;if(H!==v){R=e.i(A-1).x,X=e.i(A-1).y;var tt=H.centerX,st=H.centerY;if(k)this.K===180||this.K===0?A===e.firstPickIndex+1?(e.m(A++,R,X),e.m(A++,R,st)):(Y!==null?Y.centerY:X)!==st&&(Y=this.Ta[H.layer-1]+this.Rf.x,e.m(A++,Y,X),e.m(A++,Y,st)):A===e.firstPickIndex+1?(e.m(A++,R,X),e.m(A++,tt,X)):(Y!==null?Y.centerX:R)!==tt&&(Y=this.Ta[H.layer-1]+this.Rf.y,e.m(A++,R,Y),e.m(A++,tt,Y));else if(A===e.firstPickIndex+1){Y=Math.max(10,this.he[w.layer]);var bt=Math.max(10,this.Ld[w.layer]);if(C)this.K===180?tt<=w.bounds.x?(w=w.bounds.x,e.m(A++,w-Y,st),e.m(A++,w,st),e.m(A++,w+bt,st)):(e.m(A++,tt-Y,st),e.m(A++,tt,st),e.m(A++,tt+bt,st)):this.K===90?st>=w.bounds.bottom?(w=w.bounds.y+w.bounds.height,e.m(A++,tt,w+bt),e.m(A++,tt,w),e.m(A++,tt,w-Y)):(e.m(A++,tt,st+bt),e.m(A++,tt,st),e.m(A++,tt,st-Y)):this.K===270?st<=w.bounds.y?(w=w.bounds.y,e.m(A++,tt,w-Y),e.m(A++,tt,w),e.m(A++,tt,w+bt)):(e.m(A++,tt,st-Y),e.m(A++,tt,st),e.m(A++,tt,st+bt)):this.K===0&&(tt>=w.bounds.right?(w=w.bounds.x+w.bounds.width,e.m(A++,w+bt,st),e.m(A++,w,st),e.m(A++,w-Y,st)):(e.m(A++,tt+bt,st),e.m(A++,tt,st),e.m(A++,tt-Y,st)));else{e.m(A++,R,X);var Te=0;this.K===180||this.K===0?((this.K===180?tt>=w.bounds.right:tt<=w.bounds.x)&&(Te=(this.K===0?-Y:bt)/2),e.m(A++,R+Te,st)):((this.K===270?st>=w.bounds.bottom:st<=w.bounds.y)&&(Te=(this.K===90?-Y:bt)/2),e.m(A++,tt,X+Te)),e.m(A++,tt,st)}}else Y=Math.max(10,this.he[H.layer]),bt=Math.max(10,this.Ld[H.layer]),C?this.K===180?(e.m(A++,tt-Y-L,st),e.m(A++,Math.min(tt-Y+L/2,tt),st),e.m(A++,tt,st),e.m(A++,tt,st),e.m(A++,Math.max(tt+bt-L/2,tt),st),e.m(A++,tt+bt+L,st)):this.K===90?(e.m(A++,tt,st+bt+L),e.m(A++,tt,Math.max(st+bt-L/2,st)),e.m(A++,tt,st),e.m(A++,tt,st),e.m(A++,tt,Math.min(st-Y+L/2,st)),e.m(A++,tt,st-Y-L)):this.K===270?(e.m(A++,tt,st-Y-L),e.m(A++,tt,Math.min(st-Y+L/2,st)),e.m(A++,tt,st),e.m(A++,tt,st),e.m(A++,tt,Math.max(st+bt-L/2,st)),e.m(A++,tt,st+bt+L)):(e.m(A++,tt+bt+L,st),e.m(A++,Math.max(tt+bt-L/2,tt),st),e.m(A++,tt,st),e.m(A++,tt,st),e.m(A++,Math.min(tt-Y+L/2,tt),st),e.m(A++,tt-Y-L,st)):e.m(A++,tt,st)}w=H}(c===null||m!==Nn||k)&&(R=e.i(A-1).x,X=e.i(A-1).y,tt=e.i(A).x,st=e.i(A).y,k?(L=this.Ld[v.layer],this.K===180||this.K===0?(k=X,k>=v.bounds.y&&k<=v.bounds.bottom&&(this.K===180?tt>=v.bounds.x:tt<=v.bounds.right)&&(w=v.centerX+(this.K===180?-L:L),k<v.bounds.y+v.bounds.height/2?k=v.bounds.y-this.kc/2:k=v.bounds.bottom+this.kc/2,e.m(A++,w,X),e.m(A++,w,k)),e.m(A++,tt,k)):(k=R,k>=v.bounds.x&&k<=v.bounds.right&&(this.K===270?st>=v.bounds.y:st<=v.bounds.bottom)&&(w=v.centerY+(this.K===270?-L:L),k<v.bounds.x+v.bounds.width/2?k=v.bounds.x-this.kc/2:k=v.bounds.right+this.kc/2,e.m(A++,R,w),e.m(A++,k,w)),e.m(A++,k,st)),e.m(A++,tt,st)):C?(Y=Math.max(10,this.he[v.layer]),bt=Math.max(10,this.Ld[v.layer]),this.K===180&&tt>=v.bounds.x?(w=v.bounds.x+v.bounds.width,e.L(A-2,w,X),e.L(A-1,w+bt,X)):this.K===90&&st<=v.bounds.bottom?(w=v.bounds.y,e.L(A-2,R,w),e.L(A-1,R,w-Y)):this.K===270&&st>=v.bounds.y?(w=v.bounds.y+v.bounds.height,e.L(A-2,R,w),e.L(A-1,R,w+bt)):this.K===0&&tt<=v.bounds.right&&(w=v.bounds.x,e.L(A-2,w,X),e.L(A-1,w-Y,X))):(Y=Math.max(10,this.he[v.layer]),bt=Math.max(10,this.Ld[v.layer]),k=0,this.K===180||this.K===0?((this.K===180?tt<=v.bounds.x:tt>=v.bounds.right)&&(k=(this.K===0?bt:-Y)/2),e.m(A++,tt+k,X)):((this.K===270?st<=v.bounds.y:st>=v.bounds.bottom)&&(k=(this.K===90?bt:-Y)/2),e.m(A++,R,st+k)),e.m(A++,tt,st)))}else{for(;v!==null&&v!==w;){for(Y=H=null,v=v.destinationEdges.iterator;v.next()&&(R=v.value,R.link!==i.link||(H=R.toVertex,Y=R.fromVertex,Y.node!==null&&(Y=null),H.node!==null)););if(H===null)break;H!==w&&(R=e.i(A-1).x,X=e.i(A-1).y,tt=H.centerX,st=H.centerY,k?this.K===180||this.K===0?(Y!==null?Y.centerY:X)!==st&&(Y=this.Ta[H.layer]+this.Rf.x,A===e.firstPickIndex+1&&(Y=this.K===0?Math.max(Y,R):Math.min(Y,R)),e.m(A++,Y,X),e.m(A++,Y,st)):(Y!==null?Y.centerX:R)!==tt&&(Y=this.Ta[H.layer]+this.Rf.y,A===e.firstPickIndex+1&&(Y=this.K===90?Math.max(Y,X):Math.min(Y,X)),e.m(A++,R,Y),e.m(A++,tt,Y)):(Y=Math.max(10,this.he[H.layer]),bt=Math.max(10,this.Ld[H.layer]),C?this.K===180?(e.m(A++,tt+bt+L,st),e.m(A++,Math.max(tt+bt-L/2,tt),st),e.m(A++,tt,st),e.m(A++,tt,st),e.m(A++,Math.min(tt-Y+L/2,tt),st),e.m(A++,tt-Y-L,st)):this.K===90?(e.m(A++,tt,st-Y-L),e.m(A++,tt,Math.min(st-Y+L/2,st)),e.m(A++,tt,st),e.m(A++,tt,st),e.m(A++,tt,Math.max(st+bt-L/2,st)),e.m(A++,tt,st+bt+L)):this.K===270?(e.m(A++,tt,st+bt+L),e.m(A++,tt,Math.max(st+bt-L/2,st)),e.m(A++,tt,st),e.m(A++,tt,st),e.m(A++,tt,Math.min(st-Y+L/2,st)),e.m(A++,tt,st-Y-L)):(e.m(A++,tt-Y-L,st),e.m(A++,Math.min(tt-Y+L/2,tt),st),e.m(A++,tt,st),e.m(A++,tt,st),e.m(A++,Math.max(tt+bt-L/2,tt),st),e.m(A++,tt+bt+L,st)):this.K===180?(e.m(A++,tt+bt,st),e.m(A++,tt-Y,st)):this.K===90?(e.m(A++,tt,st-Y),e.m(A++,tt,st+bt)):this.K===270?(e.m(A++,tt,st+bt),e.m(A++,tt,st-Y)):(e.m(A++,tt-Y,st),e.m(A++,tt+bt,st)))),v=H}k&&(R=e.i(A-1).x,X=e.i(A-1).y,tt=e.i(A).x,st=e.i(A).y,this.K===180||this.K===0?X!==st&&(Y=this.K===0?Math.min(Math.max((tt+R)/2,this.Ta[w.layer]+this.Rf.x),tt):Math.max(Math.min((tt+R)/2,this.Ta[w.layer]+this.Rf.x),tt),e.m(A++,Y,X),e.m(A++,Y,st)):R!==tt&&(Y=this.K===90?Math.min(Math.max((st+X)/2,this.Ta[w.layer]+this.Rf.y),st):Math.max(Math.min((st+X)/2,this.Ta[w.layer]+this.Rf.y),st),e.m(A++,R,Y),e.m(A++,tt,Y)))}n!==null&&C&&4<=e.pointsCount&&(l!==null&&(l=m===Nn?e.getLinkPointFromPoint(s,l,l.ga(on),e.i(3),!0):e.i(0),m===Nn&&(m=e.i(2),n=e.i(3),this.direction===90||this.direction===270?(e.L(1,(l.x+m.x)/2,m.y),e.L(2,n.x,(m.y+n.y)/2)):(e.L(1,m.x,(l.y+m.y)/2),e.L(2,(m.x+n.x)/2,n.y))),l.w()||l.set(s.actualBounds.center),e.L(0,l.x,l.y)),c!==null&&(s=f===Nn?e.getLinkPointFromPoint(a,c,c.ga(on),e.i(e.pointsCount-4),!1):e.i(e.pointsCount-1),f===Nn&&(c=e.i(e.pointsCount-3),f=e.i(e.pointsCount-4),this.direction===90||this.direction===270?(e.L(e.pointsCount-2,(s.x+c.x)/2,c.y),e.L(e.pointsCount-2,f.x,(c.y+f.y)/2)):(e.L(e.pointsCount-2,c.x,(s.y+c.y)/2),e.L(e.pointsCount-3,(c.x+f.x)/2,f.y))),s.w()||s.set(a.actualBounds.center),e.L(e.pointsCount-1,s.x,s.y))),e.zf(),i.commit()}}}this.avoidOrthogonalOverlaps()},Zn.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var t=new Kt,e=this.network.edges.iterator;e.next();){var i=e.value.link;i!==null&&i.isOrthogonal&&!t.contains(i)&&t.add(i)}if(0<t.count)if(this.K===90||this.K===270){for(e=0,i=[],t=t.iterator;t.next();){var n=t.value;if(n!==null&&n.isOrthogonal)for(var s=2;s<n.pointsCount-3;s++){var a=n.i(s),l=n.i(s+1);if(this.B(a.y,l.y)&&!this.B(a.x,l.x)){var c=new Sp;c.layer=Math.floor(a.y/2);var f=n.i(0),m=n.i(n.pointsCount-1);if(c.first=f.x*f.x+f.y,c.jc=m.x*m.x+m.y,c.rd=Math.min(a.x,l.x),c.Ic=Math.max(a.x,l.x),c.index=s,c.link=n,s+2<n.pointsCount){f=n.i(s-1),m=n.i(s+2);var v=0;f.y<a.y?v=m.y<a.y?3:a.x<l.x?2:1:f.y>a.y&&(v=m.y>a.y?0:l.x<a.x?2:1),c.j=v}i.push(c)}}}if(1<i.length)for(i.sort(this.Vx),t=0;t<i.length;){for(a=i[t].layer,n=t+1;n<i.length&&i[n].layer===a;)n++;if(1<n-t)for(a=t;a<n;){for(l=i[a].Ic,s=t+1;s<n&&i[s].rd<l;)l=Math.max(l,i[s].Ic),s++;if(l=s-a,1<l){for(this.zi(i,this.Js,a,a+l),v=1,c=i[a].jc,f=a;f<s;f++)m=i[f],m.jc!==c&&(v++,c=m.jc);this.zi(i,this.Ux,a,a+l);var w=1;for(c=i[a].first,f=a;f<s;f++)m=i[f],m.first!==c&&(w++,c=m.first);for(f=!0,m=w,v<w?(f=!1,m=v,c=i[a].jc,this.zi(i,this.Js,a,a+l)):c=i[a].first,v=0,w=a;w<s;w++){var C=i[w];(f?C.first:C.jc)!==c&&(v++,c=f?C.first:C.jc);var k=C.link;a=k.i(C.index),l=k.i(C.index+1);var L=this.linkSpacing*(v-(m-1)/2);e++,k.uh(),k.L(C.index,a.x,a.y+L),k.L(C.index+1,l.x,l.y+L),k.zf()}}a=s}t=n}}else{for(e=0,i=[],t=t.iterator;t.next();)if(n=t.value,n!==null&&n.isOrthogonal)for(s=2;s<n.pointsCount-3;s++)a=n.i(s),l=n.i(s+1),this.B(a.x,l.x)&&!this.B(a.y,l.y)&&(c=new Sp,c.layer=Math.floor(a.x/2),f=n.i(0),m=n.i(n.pointsCount-1),c.first=f.x+f.y*f.y,c.jc=m.x+m.y*m.y,c.rd=Math.min(a.y,l.y),c.Ic=Math.max(a.y,l.y),c.index=s,c.link=n,s+2<n.pointsCount&&(f=n.i(s-1),m=n.i(s+2),v=0,f.x<a.x?v=m.x<a.x?3:a.y<l.y?2:1:f.x>a.x&&(v=m.x>a.x?0:l.y<a.y?2:1),c.j=v),i.push(c));if(1<i.length)for(i.sort(this.Vx),t=0;t<i.length;){for(a=i[t].layer,n=t+1;n<i.length&&i[n].layer===a;)n++;if(1<n-t)for(a=t;a<n;){for(l=i[a].Ic,s=t+1;s<n&&i[s].rd<l;)l=Math.max(l,i[s].Ic),s++;if(l=s-a,1<l){for(this.zi(i,this.Js,a,a+l),v=1,c=i[a].jc,f=a;f<s;f++)m=i[f],m.jc!==c&&(v++,c=m.jc);for(this.zi(i,this.Ux,a,a+l),w=1,c=i[a].first,f=a;f<s;f++)m=i[f],m.first!==c&&(w++,c=m.first);for(f=!0,m=w,v<w?(f=!1,m=v,c=i[a].jc,this.zi(i,this.Js,a,a+l)):c=i[a].first,v=0,w=a;w<s;w++)C=i[w],(f?C.first:C.jc)!==c&&(v++,c=f?C.first:C.jc),k=C.link,a=k.i(C.index),l=k.i(C.index+1),L=this.linkSpacing*(v-(m-1)/2),e++,k.uh(),k.L(C.index,a.x+L,a.y),k.L(C.index+1,l.x+L,l.y),k.zf()}a=s}t=n}}}},T=Zn.prototype,T.Vx=function(t,e){return t instanceof Sp&&e instanceof Sp&&t!==e?t.layer<e.layer?-1:t.layer>e.layer?1:t.rd<e.rd?-1:t.rd>e.rd?1:t.Ic<e.Ic?-1:t.Ic>e.Ic?1:0:0},T.Ux=function(t,e){return t instanceof Sp&&e instanceof Sp&&t!==e?t.first<e.first?-1:t.first>e.first||t.j<e.j?1:t.j>e.j||t.rd<e.rd?-1:t.rd>e.rd?1:t.Ic<e.Ic?-1:t.Ic>e.Ic?1:0:0},T.Js=function(t,e){return t instanceof Sp&&e instanceof Sp&&t!==e?t.jc<e.jc?-1:t.jc>e.jc||t.j<e.j?1:t.j>e.j||t.rd<e.rd?-1:t.rd>e.rd?1:t.Ic<e.Ic?-1:t.Ic>e.Ic?1:0:0},T.B=function(t,e){return t-=e,-1<t&&1>t},T.zi=function(t,e,i,n){var s=t.length,a=n-i;if(!(1>=a))if((0>i||i>=s-1)&&lt("not in range 0 <= from < length: "+i),a===2)n=t[i],s=t[i+1],0<e(n,s)&&(t[i]=s,t[i+1]=n);else if(i===0)if(n>=s)t.sort(e);else for(i=t.slice(0,n),i.sort(e),e=0;e<n;e++)t[e]=i[e];else if(n>=s)for(n=t.slice(i),n.sort(e),e=i;e<s;e++)t[e]=n[e-i];else for(s=t.slice(i,n),s.sort(e),e=i;e<n;e++)t[e]=s[e-i]};function Vr(t,e){var i=t.tc[e];if(i>=t.He.length){for(var n=[],s=0;s<t.He.length;s++)n[s]=t.He[s];t.He=n}for(t.He[i]===void 0||t.He[i]===null?n=[]:(n=t.He[i],t.He[i]=null),t=t.fl[e],e=0;e<t.length;e++)i=t[e],n[i.index]=i;return n}function No(t,e,i){t.He[t.tc[e]]=i}ct.Object.defineProperties(Zn.prototype,{layerSpacing:{get:function(){return this.ie},set:function(t){this.ie!==t&&0<=t&&(this.ie=t,this.C())}},columnSpacing:{get:function(){return this.kc},set:function(t){this.kc!==t&&0<t&&(this.kc=t,this.C())}},direction:{get:function(){return this.K},set:function(t){this.K!==t&&(t===0||t===90||t===180||t===270?(this.K=t,this.C()):lt("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},cycleRemoveOption:{get:function(){return this.Dk},set:function(t){this.Dk===t||t!==ph&&t!==Gs&&t!==fu||(this.Dk=t,this.C())}},layeringOption:{get:function(){return this.Zk},set:function(t){this.Zk===t||t!==Ou&&t!==mh&&t!==Bu||(this.Zk=t,this.C())}},initializeOption:{get:function(){return this.Qk},set:function(t){this.Qk===t||t!==A0&&t!==Mx&&t!==Cx||(this.Qk=t,this.C())}},iterations:{get:function(){return this.bj},set:function(t){this.bj!==t&&0<=t&&(this.bj=t,this.C())}},aggressiveOption:{get:function(){return this.rk},set:function(t){this.rk===t||t!==kx&&t!==$1&&t!==Lx||(this.rk=t,this.C())}},packOption:{get:function(){return this.bg},set:function(t){this.bg!==t&&0<=t&&8>t&&(this.bg=t,this.C())}},alignOption:{get:function(){return this.ve},set:function(t){this.ve!==t&&0<=t&&16>t&&(this.ve=t,this.C())}},setsPortSpots:{get:function(){return this.sf},set:function(t){this.sf!==t&&(this.sf=t,this.C())}},linkSpacing:{get:function(){return this.Cn},set:function(t){this.Cn!==t&&0<=t&&(this.Cn=t,this.C())}},maxLayer:{get:function(){return this.Ia}},maxIndex:{get:function(){return this.Iq}},maxColumn:{get:function(){return this.Ra}},minIndexLayer:{get:function(){return this.Hn}},maxIndexLayer:{get:function(){return this.Md}}});var Gs=new mt(Zn,"CycleDepthFirst",0),ph=new mt(Zn,"CycleGreedy",1),fu=new mt(Zn,"CycleFromLayers",2),Ou=new mt(Zn,"LayerOptimalLinkLength",0),mh=new mt(Zn,"LayerLongestPathSink",1),Bu=new mt(Zn,"LayerLongestPathSource",2),A0=new mt(Zn,"InitDepthFirstOut",0),Mx=new mt(Zn,"InitDepthFirstIn",1),Cx=new mt(Zn,"InitNaive",2),kx=new mt(Zn,"AggressiveNone",0),$1=new mt(Zn,"AggressiveLess",1),Lx=new mt(Zn,"AggressiveMore",2),j2=8;Zn.className="LayeredDigraphLayout",Zn.CycleDepthFirst=Gs,Zn.CycleGreedy=ph,Zn.CycleFromLayers=fu,Zn.LayerOptimalLinkLength=Ou,Zn.LayerLongestPathSink=mh,Zn.LayerLongestPathSource=Bu,Zn.InitDepthFirstOut=A0,Zn.InitDepthFirstIn=Mx,Zn.InitNaive=Cx,Zn.AggressiveNone=kx,Zn.AggressiveLess=$1,Zn.AggressiveMore=Lx,Zn.PackNone=0,Zn.PackExpand=1,Zn.PackStraighten=2,Zn.PackMedian=4,Zn.PackAll=15,Zn.AlignNone=0,Zn.AlignUpperLeft=1,Zn.AlignUpperRight=2,Zn.AlignLowerLeft=4,Zn.AlignLowerRight=8,Zn.AlignAll=15;function Sp(){this.index=this.Ic=this.rd=this.jc=this.first=this.layer=0,this.link=null,this.j=0}Sp.className="SegInfo";function Mv(t){nr.call(this,t)}gi(Mv,nr),Mv.prototype.createVertex=function(){return new Ql(this)},Mv.prototype.createEdge=function(){return new Iy(this)},Mv.className="LayeredDigraphNetwork";function Ql(t){lo.call(this,t),this.$n=this.bo=this.ao=this.co=null,this.Za=this.Ag=this.Ig=-1,this.u=NaN,this.F=null,this.valid=!1,this.finish=this.Ll=NaN,this.Dj=0,this.dv=this.ev=null}gi(Ql,lo);function Gx(t,e){return t.index-e.index}function K1(t,e){if(!t.$n){for(var i=[],n=$n(t.destinationEdgesArrayAccess),s=n.next();!s.done;s=n.next())s=s.value,s.valid&&i.push(s);t.$n=i}for(t=$n(t.$n),i=t.next();!i.done;i=t.next())if(i=i.value,i.toVertex===e)return i;lt("Unable to find destination edge to given vertex")}function Ex(t){if(!t.co){for(var e=[],i=$n(t.sourceEdgesArrayAccess),n=i.next();!n.done;n=i.next())n=n.value,n.valid&&e.push(n.fromVertex);e.sort(Gx),t.co=e}return t.co}function $2(t){if(!t.ao){for(var e=[],i=$n(t.destinationEdgesArrayAccess),n=i.next();!n.done;n=i.next())n=n.value,n.valid&&e.push(n.toVertex);e.sort(Gx),t.ao=e}return t.ao}Ql.prototype.Cl=function(t){lo.prototype.Cl.call(this,t),this.bo=this.co=null},Ql.prototype.Kl=function(t){lo.prototype.Kl.call(this,t),this.bo=this.co=null},Ql.prototype.zl=function(t){lo.prototype.zl.call(this,t),this.$n=this.ao=null},Ql.prototype.Jl=function(t){lo.prototype.Jl.call(this,t),this.$n=this.ao=null},ct.Object.defineProperties(Ql.prototype,{layer:{get:function(){return this.Ig},set:function(t){this.Ig!==t&&(this.Ig=t)}},column:{get:function(){return this.Ag},set:function(t){this.Ag!==t&&(this.Ag=t)}},index:{get:function(){return this.Za},set:function(t){this.Za!==t&&(this.Za=t)}},component:{get:function(){return this.u},set:function(t){this.u!==t&&(this.u=t)}},near:{get:function(){return this.F},set:function(t){this.F!==t&&(this.F=t)}}}),Ql.prototype.deleteDestinationEdge=Ql.prototype.Jl,Ql.prototype.addDestinationEdge=Ql.prototype.zl,Ql.prototype.deleteSourceEdge=Ql.prototype.Kl,Ql.prototype.addSourceEdge=Ql.prototype.Cl,Ql.className="LayeredDigraphVertex";function Iy(t){Na.call(this,t),this.j=this.ia=this.Ha=!1,this.V=this.u=NaN,this.F=this.o=0}gi(Iy,Na),ct.Object.defineProperties(Iy.prototype,{fromVertex:{get:function(){return this.kd},set:function(t){this.kd!==t&&(this.kd=t)}},toVertex:{get:function(){return this.qd},set:function(t){this.qd!==t&&(this.qd=t)}},valid:{get:function(){return this.Ha},set:function(t){this.Ha!==t&&(this.Ha=t)}},rev:{get:function(){return this.ia},set:function(t){this.ia!==t&&(this.ia=t)}},forest:{get:function(){return this.j},set:function(t){this.j!==t&&(this.j=t)}},portFromPos:{get:function(){return this.u},set:function(t){this.u!==t&&(this.u=t)}},portToPos:{get:function(){return this.V},set:function(t){this.V!==t&&(this.V=t)}},portFromColOffset:{get:function(){return this.o},set:function(t){this.o!==t&&(this.o=t)}},portToColOffset:{get:function(){return this.F},set:function(t){this.F!==t&&(this.F=t)}}}),Iy.className="LayeredDigraphEdge";function cn(t){pr.call(this),this.Ub=new At,this.Wn=U1,this.ud=Pc,this.vo=G1,this.Bq=Rx,this.$v=[],this.td=!0,this.Rb=X1,this.$d=new ii(10,10).freeze();var e=new ig(this);this.W=new pu(e),this.Y=new pu(e),this.ru=[],t&&Object.assign(this,t)}gi(cn,pr),cn.prototype.cloneProtected=function(t){pr.prototype.cloneProtected.call(this,t),t.Wn=this.Wn,t.vo=this.vo,t.Bq=this.Bq,t.td=this.td,t.Rb=this.Rb,t.$d.assign(this.$d),t.W.copyInheritedPropertiesFrom(this.W),t.Y.copyInheritedPropertiesFrom(this.Y)},cn.prototype.qb=function(t){t.classType===cn?t.name.indexOf("Alignment")===0?this.alignment=t:t.name.indexOf("Arrangement")===0?this.arrangement=t:t.name.indexOf("Compaction")===0?this.compaction=t:t.name.indexOf("Path")===0?this.path=t:t.name.indexOf("Sorting")===0?this.sorting=t:t.name.indexOf("Style")===0?this.treeStyle=t:lt("Unknown enum value: "+t):pr.prototype.qb.call(this,t)},cn.prototype.createNetwork=function(){return new ig(this)},cn.prototype.makeNetwork=function(t){function e(n){if(n instanceof Le)return!n.isLinkLabel&&n.category!=="Comment";if(n instanceof ue){var s=n.fromNode;return s===null||s.isLinkLabel||s.category==="Comment"?!1:(n=n.toNode,!(n===null||n.isLinkLabel||n.category==="Comment"))}return!1}var i=this.createNetwork();return t instanceof wt?(i.lg(t.nodes,!0,e),i.lg(t.links,!0,e)):t instanceof ji?i.lg(t.memberParts,!1,e):i.lg(t.iterator,!1,e),i},cn.prototype.doLayout=function(t){this.network===null&&(this.network=this.makeNetwork(t)),this.arrangement!==Y1&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var e=this.diagram;if(e===null&&t instanceof wt&&(e=t),this.path===U1&&e!==null?this.ud=e.isTreePathToChildren?Pc:tg:this.ud=this.path===U1?Pc:this.path,0<this.network.vertexes.count){for(this.network.Ko(),t=this.network.vertexes.iterator;t.next();)e=t.value,e.initialized=!1,e.level=0,e.parent=null,e.children=[];if(0<this.Ub.count){for(t=new At,e=this.Ub.iterator;e.next();){var i=e.value;i instanceof Le?(i=this.network.ki(i),i!==null&&t.add(i)):i instanceof pu&&t.add(i)}this.Ub=t}for(this.Ub.count===0&&this.findRoots(),t=this.Ub.copy().iterator;t.next();)e=t.value,e.initialized||(e.initialized=!0,_x(this,e));for(e=this.network.vertexes,t=null;t=K2(e),0<t.count;)e=Xx(this,t),e!==null&&this.Ub.add(e),e.initialized=!0,_x(this,e),e=t;for(t=this.Ub.iterator;t.next();)e=t.value,e instanceof pu&&Jx(this,e);for(t=this.Ub.iterator;t.next();)e=t.value,e instanceof pu&&qx(this,e);for(t=this.Ub.iterator;t.next();)e=t.value,e instanceof pu&&Qx(this,e);if(this.Cu(),this.layerStyle===J1){for(t=[],e=this.network.vertexes.iterator;e.next();){i=e.value;var n=i.parent;n===null&&(n=i),n=n.angle===0||n.angle===180;var s=t[i.level];s===void 0&&(s=0),t[i.level]=Math.max(s,n?i.width:i.height)}for(e=0;e<t.length;e++)t[e]===void 0&&(t[e]=0);for(this.$v=t,e=this.network.vertexes.iterator;e.next();)i=e.value,n=i.parent,n===null&&(n=i),n.angle===0||n.angle===180?(n.angle===180&&(i.focusX+=t[i.level]-i.width),i.width=t[i.level]):(n.angle===270&&(i.focusY+=t[i.level]-i.height),i.height=t[i.level])}else if(this.layerStyle===zx)for(t=this.network.vertexes.iterator;t.next();){for(e=t.value,i=e.angle===0||e.angle===180,n=-1,s=0;s<e.children.length;s++){var a=e.children[s];n=Math.max(n,i?a.width:a.height)}if(0<=n)for(s=0;s<e.children.length;s++)a=e.children[s],i?(e.angle===180&&(a.focusX+=n-a.width),a.width=n):(e.angle===270&&(a.focusY+=n-a.height),a.height=n)}for(t=this.Ub.iterator;t.next();)e=t.value,e instanceof pu&&this.layoutTree(e);this.arrangeTrees(),this.updateParts()}this.network=null,this.Ub=new At,this.isValidLayout=!0};function K2(t){var e=new At;for(t=t.iterator;t.next();){var i=t.value;i.initialized||e.add(i)}return e}cn.prototype.findRoots=function(){for(var t=this.network.vertexes,e=t.iterator;e.next();){var i=e.value;switch(this.ud){case Pc:i.sourceEdges.count===0&&this.Ub.add(i);break;case tg:i.destinationEdges.count===0&&this.Ub.add(i);break;default:lt("Unhandled path value "+this.ud.toString())}}this.Ub.count===0&&(t=Xx(this,t),t!==null&&this.Ub.add(t))};function Xx(t,e){var i=999999,n=null;for(e=e.iterator;e.next();){var s=e.value;switch(t.ud){case Pc:s.sourceEdges.count<i&&(i=s.sourceEdges.count,n=s);break;case tg:s.destinationEdges.count<i&&(i=s.destinationEdges.count,n=s);break;default:lt("Unhandled path value "+t.ud.toString())}}return n}function _x(t,e){if(e!==null){switch(t.ud){case Pc:if(0<e.destinationEdges.count){for(var i=new Kt,n=e.destinationVertexes;n.next();){var s=n.value;Yx(t,e,s)&&i.add(s)}0<i.count&&(e.children=i.Fa())}break;case tg:if(0<e.sourceEdges.count){for(i=new Kt,n=e.sourceVertexes;n.next();)s=n.value,Yx(t,e,s)&&i.add(s);0<i.count&&(e.children=i.Fa())}break;default:lt("Unhandled path value"+t.ud.toString())}for(i=e.children,n=i.length,s=0;s<n;s++){var a=i[s];a.initialized=!0,a.level=e.level+1,a.parent=e,t.Ub.remove(a)}for(e=0;e<n;e++)_x(t,i[e])}}function Yx(t,e,i){if(i.initialized){if(e===null)var n=!1;else{for(n=e.parent;n!==null&&n!==i;)n=n.parent;n=n===i}if(n||i.level>e.level)return!1;t.removeChild(i.parent,i)}return!0}cn.prototype.removeChild=function(t,e){if(t!==null&&e!==null){for(var i=t.children,n=0,s=0;s<i.length;s++)i[s]===e&&n++;if(0<n){n=Array(i.length-n);for(var a=s=0;a<i.length;a++)i[a]!==e&&(n[s++]=i[a]);t.children=n}}};function Jx(t,e){if(e!==null){t.initializeTreeVertexValues(e),e.alignment===Dc&&t.sortTreeVertexChildren(e);for(var i=0,n=e.childrenCount,s=0,a=e.children,l=a.length,c=0;c<l;c++){var f=a[c];Jx(t,f),i+=f.descendantCount+1,n=Math.max(n,f.maxChildrenCount),s=Math.max(s,f.maxGenerationCount)}e.descendantCount=i,e.maxChildrenCount=n,e.maxGenerationCount=0<n?s+1:0}}function H2(t,e){switch(t.vo){default:case G1:return e.parent!==null?e.parent:t.W;case Bx:return e.parent===null?t.W:e.parent.parent===null?t.Y:e.parent;case Ox:return e.parent!==null?e.parent.parent!==null?e.parent.parent:t.Y:t.W;case Ix:var i=!0;if(e.childrenCount===0)i=!1;else for(var n=e.children,s=n.length,a=0;a<s;a++)if(0<n[a].childrenCount){i=!1;break}return i&&e.parent!==null?t.Y:e.parent!==null?e.parent:t.W}}cn.prototype.initializeTreeVertexValues=function(t){if(t.copyInheritedPropertiesFrom(H2(this,t)),t.parent!==null&&t.parent.alignment===Dc){for(var e=t.angle,i=t.parent.children,n=0;n<i.length&&t!==i[n];)n++;n%2===0?n!==i.length-1&&(e=e===90?180:e===180?270:e===270?180:270):e=e===90?0:e===180?90:e===270?0:90,t.angle=e}t.initialized=!0};function qx(t,e){if(e!==null){t.assignTreeVertexValues(e),e=e.children;for(var i=e.length,n=0;n<i;n++)qx(t,e[n])}}cn.prototype.assignTreeVertexValues=function(){};function Qx(t,e){if(e!==null){e.alignment!==Dc&&t.sortTreeVertexChildren(e),e=e.children;for(var i=e.length,n=0;n<i;n++)Qx(t,e[n])}}cn.prototype.sortTreeVertexChildren=function(t){switch(t.sorting){case Cv:break;case By:t.children.reverse();break;case Fy:t.children.sort(t.comparer);break;case Ry:t.children.sort(t.comparer),t.children.reverse();break;default:lt("Unhandled sorting value "+t.sorting.toString())}},cn.prototype.Cu=function(){if(this.comments)for(var t=this.network.vertexes.iterator;t.next();)this.addComments(t.value)},cn.prototype.addComments=function(t){var e=t.angle,i=t.parent,n=0,s=!1;i!==null&&(n=i.angle,s=i.alignment,s=Mp(s)),e=e===90||e===270,n=n===90||n===270,i=t.childrenCount===0;var a=0,l=0,c=0,f=t.commentSpacing;if(t.node!==null)for(var m=t.node.Mu();m.next();){var v=m.value;v.category==="Comment"&&v.canLayout()&&(t.comments===null&&(t.comments=[]),t.comments.push(v),v.Va(),v=v.measuredBounds,e&&!i||!s&&!n&&i||s&&n&&i?(a=Math.max(a,v.width),l+=v.height+Math.abs(c)):(a+=v.width+Math.abs(c),l=Math.max(l,v.height)),c=f)}t.comments!==null&&(e&&!i||!s&&!n&&i||s&&n&&i?(a+=Math.abs(t.commentMargin),l=Math.max(0,l-t.height)):(l+=Math.abs(t.commentMargin),a=Math.max(0,a-t.width)),s=It.allocAt(0,0,t.bounds.width+a,t.bounds.height+l),t.bounds=s,It.free(s))};function Mp(t){return t===gf||t===Dc||t===vf||t===yd}function Oy(t){return t===gf||t===Dc}function Tx(t){var e=t.parent;if(e!==null){var i=e.alignment;if(Mp(i)){if(Oy(i)){for(e=e.children,i=0;i<e.length&&t!==e[i];)i++;return i%2===0}if(i===vf)return!0}}return!1}cn.prototype.layoutComments=function(t){if(t.comments!==null){var e=t.node.measuredBounds,i=t.parent,n=t.angle,s=0,a=!1;i!==null&&(s=i.angle,a=i.alignment,a=Mp(a)),n=n===90||n===270,i=s===90||s===270;for(var l=t.childrenCount===0,c=Tx(t),f=0,m=t.comments,v=m.length,w=z.alloc(),C=0;C<v;C++){var k=m[C],L=k.measuredBounds;if(n&&!l||!a&&!i&&l||a&&i&&l){if(135<s&&!a||i&&c)if(0<=t.commentMargin)for(w.h(t.bounds.x-t.commentMargin-L.width,t.bounds.y+f),k.move(w),k=k.Sd();k.next();){var A=k.value;A.fromSpot=co,A.toSpot=so}else for(w.h(t.bounds.x+2*t.focus.x-t.commentMargin,t.bounds.y+f),k.move(w),k=k.Sd();k.next();)A=k.value,A.fromSpot=so,A.toSpot=co;else if(0<=t.commentMargin)for(w.h(t.bounds.x+2*t.focus.x+t.commentMargin,t.bounds.y+f),k.move(w),k=k.Sd();k.next();)A=k.value,A.fromSpot=so,A.toSpot=co;else for(w.h(t.bounds.x+t.commentMargin-L.width,t.bounds.y+f),k.move(w),k=k.Sd();k.next();)A=k.value,A.fromSpot=co,A.toSpot=so;f=0<=t.commentSpacing?f+(L.height+t.commentSpacing):f+(t.commentSpacing-L.height)}else{if(135<s&&!a||!i&&c)if(0<=t.commentMargin)for(w.h(t.bounds.x+f,t.bounds.y-t.commentMargin-L.height),k.move(w),k=k.Sd();k.next();)A=k.value,A.fromSpot=oo,A.toSpot=ao;else for(w.h(t.bounds.x+f,t.bounds.y+2*t.focus.y-t.commentMargin),k.move(w),k=k.Sd();k.next();)A=k.value,A.fromSpot=ao,A.toSpot=oo;else if(0<=t.commentMargin)for(w.h(t.bounds.x+f,t.bounds.y+2*t.focus.y+t.commentMargin),k.move(w),k=k.Sd();k.next();)A=k.value,A.fromSpot=ao,A.toSpot=oo;else for(w.h(t.bounds.x+f,t.bounds.y+t.commentMargin-L.height),k.move(w),k=k.Sd();k.next();)A=k.value,A.fromSpot=oo,A.toSpot=ao;f=0<=t.commentSpacing?f+(L.width+t.commentSpacing):f+(t.commentSpacing-L.width)}}if(z.free(w),e=f-t.commentSpacing-(n?e.height:e.width),this.ud===Pc)for(t=t.destinationEdges;t.next();)s=t.value.link,s===null||s.isAvoiding||(s.fromEndSegmentLength=0<e?e:NaN);else for(t=t.sourceEdges;t.next();)s=t.value.link,s===null||s.isAvoiding||(s.toEndSegmentLength=0<e?e:NaN)}},cn.prototype.layoutTree=function(t){if(t!==null){for(var e=t.children,i=e.length,n=0;n<i;n++)this.layoutTree(e[n]);switch(t.compaction){case Z1:t2(this,t);break;case zy:if(t.alignment===Dc)t2(this,t);else if(t.childrenCount===0)n=t.parent,i=!1,e=0,n!==null&&(e=n.angle,i=n.alignment,i=Mp(i)),n=Tx(t),t.S.h(0,0),t.Da.h(t.width,t.height),t.parent===null||t.comments===null||(e!==180&&e!==270||i)&&!n?t.la.h(0,0):e===180&&!i||(e===90||e===270)&&n?t.la.h(t.width-2*t.focus.x,0):t.la.h(0,t.height-2*t.focus.y),t.Yo=null,t.kp=null;else{var s=Fu(t);e=s===90||s===270;var a=0,l=t.children,c=l.length;for(i=0;i<c;i++)n=l[i],a=Math.max(a,e?n.Da.width:n.Da.height);var f=t.alignment;n=f===Nc;var m=f===Ac,v=Mp(f),w=Math.max(0,t.breadthLimit);i=this.computeLayerSpacing(t);var C=t.nodeSpacing,k=this.computeNodeIndent(t),L=t.rowSpacing,A=0;(n||m||t.hm||t.im&&t.maxGenerationCount===1)&&(A=Math.max(0,t.rowIndent)),n=t.width;var H=t.height,R=0,X=0,Y=0,tt=null,st=null,bt=0,Te=0,Ke=0,Oe=0,he=0,Gt=0,Wi=0,Di=0;if(v&&!Oy(f)&&135<s&&l.reverse(),Oy(f))if(1<c)for(var In=0;In<c;In++)In%2===0&&In!==c-1&&(Di=Math.max(Di,e?l[In].Da.width:l[In].Da.height));else c===1&&(Di=e?l[0].Da.width:l[0].Da.height);if(v){switch(f){case gf:X=135>s?e2(this,t,l,Di,R,X):i2(this,t,l,Di,R,X),Di=X.x,R=X.width,X=X.height;break;case vf:for(tt=0;tt<c;tt++)st=l[tt],w=st.Da,Y=Gt===0?0:L,e?(st.S.h(a-w.width,Oe+Y),R=Math.max(R,w.width),X=Math.max(X,Oe+Y+w.height),Oe+=Y+w.height):(st.S.h(Ke+Y,a-w.height),R=Math.max(R,Ke+Y+w.width),X=Math.max(X,w.height),Ke+=Y+w.width),Gt++;break;case yd:for(tt=0;tt<c;tt++)st=l[tt],a=st.Da,w=Gt===0?0:L,e?(st.S.h(C/2+t.focus.x,Oe+w),R=Math.max(R,a.width),X=Math.max(X,Oe+w+a.height),Oe+=w+a.height):(st.S.h(Ke+w,C/2+t.focus.y),R=Math.max(R,Ke+w+a.width),X=Math.max(X,a.height),Ke+=w+a.width),Gt++}tt=il(this,2),st=il(this,2),e?(tt[0].h(0,0),tt[1].h(0,X),st[0].h(R,0)):(tt[0].h(0,0),tt[1].h(R,0),st[0].h(0,X)),st[1].h(R,X)}else for(In=0;In<c;In++){var sr=l[In],is=sr.Da;if(e){0<w&&0<Gt&&Ke+C+is.width>w&&(Ke<a&&D0(t,f,a-Ke,0,Wi,In-1),he++,Gt=0,Wi=In,Y=X,Ke=0,Oe=135<s?-X-L:X+L),V1(this,sr,0,Oe);var cs=0;if(Gt===0)tt=sr.Yo,st=sr.kp,bt=is.width,Te=is.height,(tt===null||st===null||s!==Fu(sr))&&(tt=il(this,2),st=il(this,2),tt[0].h(0,0),tt[1].h(0,Te),st[0].h(bt,0),st[1].h(bt,Te));else{var ma=Pe();Te=n2(this,t,sr,tt,st,bt,Te,ma),cs=Te.x,tt=ma[0],st=ma[1],bt=Te.width,Te=Te.height,qe(ma),Ke<is.width&&0>cs&&(Qm(t,-cs,0,Wi,In-1),W1(tt,-cs,0),W1(st,-cs,0),cs=0)}sr.S.h(cs,Oe),R=Math.max(R,bt),X=Math.max(X,Y+(he===0?0:L)+is.height),Ke=bt}else 0<w&&0<Gt&&Oe+C+is.height>w&&(Oe<a&&D0(t,f,0,a-Oe,Wi,In-1),he++,Gt=0,Wi=In,Y=R,Oe=0,Ke=135<s?-R-L:R+L),V1(this,sr,Ke,0),cs=0,Gt===0?(tt=sr.Yo,st=sr.kp,bt=is.width,Te=is.height,(tt===null||st===null||s!==Fu(sr))&&(tt=il(this,2),st=il(this,2),tt[0].h(0,0),tt[1].h(bt,0),st[0].h(0,Te),st[1].h(bt,Te))):(ma=Pe(),Te=n2(this,t,sr,tt,st,bt,Te,ma),cs=Te.x,tt=ma[0],st=ma[1],bt=Te.width,Te=Te.height,qe(ma),Oe<is.height&&0>cs&&(Qm(t,0,-cs,Wi,In-1),W1(tt,0,-cs),W1(st,0,-cs),cs=0)),sr.S.h(Ke,cs),X=Math.max(X,Te),R=Math.max(R,Y+(he===0?0:L)+is.width),Oe=Te;Gt++}switch(0<he&&(e?(X+=Math.max(0,i),Ke<R&&D0(t,f,R-Ke,0,Wi,c-1),0<A&&(m||Qm(t,A,0,0,c-1),R+=A)):(R+=Math.max(0,i),Oe<X&&D0(t,f,0,X-Oe,Wi,c-1),0<A&&(m||Qm(t,0,A,0,c-1),X+=A))),A=m=0,f){case kv:e?m+=R/2-t.focus.x-k/2:A+=X/2-t.focus.y-k/2;break;case eg:0<he?e?m+=R/2-t.focus.x-k/2:A+=X/2-t.focus.y-k/2:e?(Di=l[0].S.x+l[0].la.x,m+=Di+(l[c-1].S.x+l[c-1].la.x+2*l[c-1].focus.x-Di)/2-t.focus.x-k/2):(Di=l[0].S.y+l[0].la.y,A+=Di+(l[c-1].S.y+l[c-1].la.y+2*l[c-1].focus.y-Di)/2-t.focus.y-k/2);break;case Nc:e?(m-=k,R+=k):(A-=k,X+=k);break;case Ac:e?(m+=R-t.width+k,R+=k):(A+=X-t.height+k,X+=k);break;case gf:e?1<c?m+=Di+C/2-t.focus.x:m+=l[0].focus.x-t.focus.x+l[0].la.x:1<c?A+=Di+C/2-t.focus.y:A+=l[0].focus.y-t.focus.y+l[0].la.y;break;case vf:e?m+=R+C/2-t.focus.x:A+=X+C/2-t.focus.y;break;case yd:break;default:X=this.customAlignment(t,m,A,R,X),m=X[0],A=X[1],R=X[2],X=X[3]}for(k=0;k<c;k++)Di=l[k],e?Di.S.h(Di.S.x+Di.la.x-m,Di.S.y+(135<s?(v?-X:-Di.Da.height)+Di.la.y-i:H+i+Di.la.y)):Di.S.h(Di.S.x+(135<s?(v?-R:-Di.Da.width)+Di.la.x-i:n+i+Di.la.x),Di.S.y+Di.la.y-A);if(c=l=0,v?e?(R=Px(t,R,m),0>m&&(m=0),135<s&&(A+=X+i),X+=H+i,f===yd&&(l+=C/2+t.focus.x),c+=H+i):(135<s&&(m+=R+i),R+=n+i,X=Nx(t,X,A),0>A&&(A=0),f===yd&&(c+=C/2+t.focus.y),l+=n+i):e?(t.comments===null?n>R&&(R=Ax(f,n-R,0),l=R.x,c=R.y,R=n,m=0):R=Px(t,R,m),0>m&&(l-=m,m=0),135<s&&(A+=X+i),X=Math.max(Math.max(X,H),X+H+i),c+=H+i):(135<s&&(m+=R+i),R=Math.max(Math.max(R,n),R+n+i),t.comments===null?H>X&&(X=Ax(f,0,H-X),l=X.x,c=X.y,X=H,A=0):X=Nx(t,X,A),0>A&&(c-=A,A=0),l+=n+i),0<he)s=il(this,4),he=il(this,4),e?(s[2].h(0,H+i),s[3].h(s[2].x,X),he[2].h(R,s[2].y),he[3].h(he[2].x,s[3].y)):(s[2].h(n+i,0),s[3].h(R,s[2].y),he[2].h(s[2].x,X),he[3].h(s[3].x,he[2].y));else{for(s=il(this,tt.length+2),he=il(this,st.length+2),f=0;f<tt.length;f++)v=tt[f],s[f+2].h(v.x+l,v.y+c);for(f=0;f<st.length;f++)v=st[f],he[f+2].h(v.x+l,v.y+c)}e?(s[0].h(m,0),s[1].h(s[0].x,H),s[2].y<s[1].y&&(s[2].x>s[0].x?s[2].assign(s[1]):s[1].assign(s[2])),s[3].y<s[2].y&&(s[3].x>s[0].x?s[3].assign(s[2]):s[2].assign(s[3])),he[0].h(m+n,0),he[1].h(he[0].x,H),he[2].y<he[1].y&&(he[2].x<he[0].x?he[2].assign(he[1]):he[1].assign(he[2])),he[3].y<he[2].y&&(he[3].x<he[0].x?he[3].assign(he[2]):he[2].assign(he[3])),s[2].y-=i/2,he[2].y-=i/2):(s[0].h(0,A),s[1].h(n,s[0].y),s[2].x<s[1].x&&(s[2].y>s[0].y?s[2].assign(s[1]):s[1].assign(s[2])),s[3].x<s[2].x&&(s[3].y>s[0].y?s[3].assign(s[2]):s[2].assign(s[3])),he[0].h(0,A+H),he[1].h(n,he[0].y),he[2].x<he[1].x&&(he[2].y<he[0].y?he[2].assign(he[1]):he[1].assign(he[2])),he[3].x<he[2].x&&(he[3].y<he[0].y?he[3].assign(he[2]):he[2].assign(he[3])),s[2].x-=i/2,he[2].x-=i/2),gh(this,tt),gh(this,st),t.Yo=s,t.kp=he,t.la.h(m,A),t.Da.h(R,X)}break;default:lt("Unhandled compaction value "+t.compaction.toString())}}};function t2(t,e){if(e.childrenCount===0){var i=!1,n=0;e.parent!==null&&(n=e.parent.angle,i=e.parent.alignment,i=Mp(i));var s=Tx(e);e.S.h(0,0),e.Da.h(e.width,e.height),e.parent===null||e.comments===null||(n!==180&&n!==270||i)&&!s?e.la.h(0,0):n===180&&!i||(n===90||n===270)&&s?e.la.h(e.width-2*e.focus.x,0):e.la.h(0,e.height-2*e.focus.y)}else{n=Fu(e),i=n===90||n===270;var a=0;s=e.children;for(var l=s.length,c=0;c<l;c++){var f=s[c];a=Math.max(a,i?f.Da.width:f.Da.height)}var m=e.alignment,v=m===Nc,w=m===Ac;c=Mp(m);var C=Math.max(0,e.breadthLimit);f=t.computeLayerSpacing(e);var k=e.nodeSpacing,L=t.computeNodeIndent(e),A=v||w?0:L/2,H=e.rowSpacing,R=0;(v||w||e.hm||e.im&&e.maxGenerationCount===1)&&(R=Math.max(0,e.rowIndent)),v=e.width;var X=e.height,Y=0,tt=0,st=0,bt=0,Te=0,Ke=0,Oe=0,he=0,Gt=0,Wi=0;if(c&&!Oy(m)&&135<n&&s.reverse(),Oy(m))if(1<l)for(var Di=0;Di<l;Di++){var In=s[Di],sr=In.Da;Di%2===0&&Di!==l-1?Gt=Math.max(Gt,(i?sr.width:sr.height)+t.computeBusNodeSpacing(In)-k):Di%2!==0&&(Wi=Math.max(Wi,(i?sr.width:sr.height)+t.computeBusNodeSpacing(In)-k))}else l===1&&(Gt=i?s[0].Da.width:s[0].Da.height);if(c)switch(m){case gf:case Dc:tt=135>n?e2(t,e,s,Gt,Y,tt):i2(t,e,s,Gt,Y,tt),Gt=tt.x,Y=tt.width,tt=tt.height;break;case vf:for(C=0;C<l;C++)A=s[C],st=A.Da,Wi=Oe===0?0:H,i?(A.S.h(a-st.width,Te+Wi),Y=Math.max(Y,st.width),tt=Math.max(tt,Te+Wi+st.height),Te+=Wi+st.height):(A.S.h(bt+Wi,a-st.height),Y=Math.max(Y,bt+Wi+st.width),tt=Math.max(tt,st.height),bt+=Wi+st.width),Oe++;break;case yd:for(a=0;a<l;a++)C=s[a],A=C.Da,st=Oe===0?0:H,i?(C.S.h(k/2+e.focus.x,Te+st),Y=Math.max(Y,A.width),tt=Math.max(tt,Te+st+A.height),Te+=st+A.height):(C.S.h(bt+st,k/2+e.focus.y),Y=Math.max(Y,bt+st+A.width),tt=Math.max(tt,A.height),bt+=st+A.width),Oe++}else for(Wi=0;Wi<l;Wi++)Di=s[Wi],In=Di.Da,i?(0<C&&0<Oe&&bt+k+In.width>C&&(bt<a&&D0(e,m,a-bt,0,he,Wi-1),Ke++,Oe=0,he=Wi,st=tt,bt=0,Te=135<n?-tt-H:tt+H),sr=Oe===0?A:k,V1(t,Di,0,Te),Di.S.h(bt+sr,Te),Y=Math.max(Y,bt+sr+In.width),tt=Math.max(tt,st+(Ke===0?0:H)+In.height),bt+=sr+In.width):(0<C&&0<Oe&&Te+k+In.height>C&&(Te<a&&D0(e,m,0,a-Te,he,Wi-1),Ke++,Oe=0,he=Wi,st=Y,Te=0,bt=135<n?-Y-H:Y+H),sr=Oe===0?A:k,V1(t,Di,bt,0),Di.S.h(bt,Te+sr),tt=Math.max(tt,Te+sr+In.height),Y=Math.max(Y,st+(Ke===0?0:H)+In.width),Te+=sr+In.height),Oe++;switch(0<Ke&&(i?(tt+=Math.max(0,f),bt<Y&&D0(e,m,Y-bt,0,he,l-1),0<R&&(w||Qm(e,R,0,0,l-1),Y+=R)):(Y+=Math.max(0,f),Te<tt&&D0(e,m,0,tt-Te,he,l-1),0<R&&(w||Qm(e,0,R,0,l-1),tt+=R))),R=w=0,m){case kv:i?w+=Y/2-e.focus.x-L/2:R+=tt/2-e.focus.y-L/2;break;case eg:0<Ke?i?w+=Y/2-e.focus.x-L/2:R+=tt/2-e.focus.y-L/2:i?(t=s[0].S.x+s[0].la.x,w+=t+(s[l-1].S.x+s[l-1].la.x+2*s[l-1].focus.x-t)/2-e.focus.x-L/2):(t=s[0].S.y+s[0].la.y,R+=t+(s[l-1].S.y+s[l-1].la.y+2*s[l-1].focus.y-t)/2-e.focus.y-L/2);break;case Nc:i?(w-=L,Y+=L):(R-=L,tt+=L);break;case Ac:i?(w+=Y-e.width+L,Y+=L):(R+=tt-e.height+L,tt+=L);break;case gf:case Dc:i?1<l?w+=Gt+k/2-e.focus.x:w+=s[0].focus.x-e.focus.x+s[0].la.x:1<l?R+=Gt+k/2-e.focus.y:R+=s[0].focus.y-e.focus.y+s[0].la.y;break;case vf:i?w+=Y+k/2-e.focus.x:R+=tt+k/2-e.focus.y;break;case yd:break;default:t=t.customAlignment(e,w,R,Y,tt),w=t[0],R=t[1],Y=t[2],tt=t[3]}for(t=0;t<l;t++)L=s[t],i?L.S.h(L.S.x+L.la.x-w,L.S.y+(135<n?(c?-tt:-L.Da.height)+L.la.y-f:X+f+L.la.y)):L.S.h(L.S.x+(135<n?(c?-Y:-L.Da.width)+L.la.x-f:v+f+L.la.x),L.S.y+L.la.y-R);i?(Y=Px(e,Y,w),0>w&&(w=0),135<n&&(R+=tt+f),tt=Math.max(Math.max(tt,X),tt+X+f)):(135<n&&(w+=Y+f),Y=Math.max(Math.max(Y,v),Y+v+f),tt=Nx(e,tt,R),0>R&&(R=0)),e.la.h(w,R),e.Da.h(Y,tt)}}cn.prototype.customAlignment=function(t,e,i,n,s){return[e,i,n,s]};function e2(t,e,i,n,s,a){var l=i.length;if(l===0)return new It(n,0,s,a);if(l===1)return e=i[0],s=e.Da.width,a=e.Da.height,new It(n,0,s,a);for(var c=e.nodeSpacing,f=e.rowSpacing,m=Fu(e)===90,v=0,w=0,C=0,k=0;k<l;k++)if(!(k%2!==0||1<l&&k===l-1)){var L=i[k],A=L.Da,H=v===0?0:f;if(m){var R=t.computeBusNodeSpacing(L)-c;L.S.h(n-(A.width+R),C+H),s=Math.max(s,A.width+R),a=Math.max(a,C+H+A.height),C+=H+A.height}else R=t.computeBusNodeSpacing(L)-c,L.S.h(w+H,n-(A.height+R)),a=Math.max(a,A.height+R),s=Math.max(s,w+H+A.width),w+=H+A.width;v++}for(v=0,L=w,k=C,m?(w=n+c,C=0):(w=0,C=n+c),A=0;A<l;A++)if(A%2!==0){H=i[A],R=H.Da;var X=v===0?0:f;if(m){var Y=t.computeBusNodeSpacing(H)-c;H.S.h(w+Y,C+X),s=Math.max(s,w+R.width+Y),a=Math.max(a,C+X+R.height),C+=X+R.height}else Y=t.computeBusNodeSpacing(H)-c,H.S.h(w+X,C+Y),s=Math.max(s,w+X+R.width),a=Math.max(a,C+R.height+Y),w+=X+R.width;v++}return 1<l&&l%2===1&&(i=i[l-1],l=i.Da,t=t.computeBusLastRowSpacing(i,m?Math.max(Math.abs(k),Math.abs(C)):Math.max(Math.abs(L),Math.abs(w))),m?(i.S.h(n+c/2-i.focus.x-i.la.x,a+t),m=n+c/2-i.focus.x-i.la.x,s=Math.max(s,m+l.width),0>m&&(s-=m),a=Math.max(a,Math.max(k,C)+t+l.height),0>i.S.x&&(n=H1(e,i.S.x,!1,n,c))):(i.S.h(s+t,n+c/2-i.focus.y-i.la.y),s=Math.max(s,Math.max(L,w)+t+l.width),C=n+c/2-i.focus.y-i.la.y,a=Math.max(a,C+l.height),0>C&&(a-=C),0>i.S.y&&(n=H1(e,i.S.y,!0,n,c)))),new It(n,0,s,a)}function i2(t,e,i,n,s,a){var l=i.length;if(l===0)return new It(n,0,s,a);if(l===1)return i=i[0],s=i.Da.width,a=i.Da.height,new It(n,0,s,a);for(var c=e.nodeSpacing,f=e.rowSpacing,m=Fu(e)===270,v=0,w=0,C=0,k=0;k<l;k++)if(!(k%2!==0||1<l&&k===l-1)){var L=i[k],A=L.Da,H=v===0?0:f;if(m){var R=t.computeBusNodeSpacing(L)-c;C-=H+A.height,L.S.h(n-(A.width+R),C),s=Math.max(s,A.width+R),a=Math.max(a,Math.abs(C))}else R=t.computeBusNodeSpacing(L)-c,w-=H+A.width,L.S.h(w,n-(A.height+R)),a=Math.max(a,A.height+R),s=Math.max(s,Math.abs(w));v++}for(v=0,L=w,k=C,m?(w=n+c,C=0):(w=0,C=n+c),A=0;A<l;A++)if(A%2!==0){H=i[A],R=H.Da;var X=v===0?0:f;if(m){var Y=t.computeBusNodeSpacing(H)-c;C-=X+R.height,H.S.h(w+Y,C),s=Math.max(s,w+R.width+Y),a=Math.max(a,Math.abs(C))}else Y=t.computeBusNodeSpacing(H)-c,w-=X+R.width,H.S.h(w,C+Y),a=Math.max(a,C+R.height+Y),s=Math.max(s,Math.abs(w));v++}for(1<l&&l%2===1&&(f=i[l-1],v=f.Da,t=t.computeBusLastRowSpacing(f,m?Math.max(Math.abs(k),Math.abs(C)):Math.max(Math.abs(L),Math.abs(w))),m?(f.S.h(n+c/2-f.focus.x-f.la.x,-a-v.height-t),w=n+c/2-f.focus.x-f.la.x,s=Math.max(s,w+v.width),0>w&&(s-=w),a=Math.max(a,Math.abs(Math.min(k,C))+t+v.height),0>f.S.x&&(n=H1(e,f.S.x,!1,n,c))):(f.S.h(-s-v.width-t,n+c/2-f.focus.y-f.la.y),s=Math.max(s,Math.abs(Math.min(L,w))+t+v.width),C=n+c/2-f.focus.y-f.la.y,a=Math.max(a,C+v.height),0>C&&(a-=C),0>f.S.y&&(n=H1(e,f.S.y,!0,n,c)))),e=0;e<l;e++)c=i[e],m?c.S.h(c.S.x,c.S.y+a):c.S.h(c.S.x+s,c.S.y);return new It(n,0,s,a)}cn.prototype.computeBusNodeSpacing=function(t){return t.parent===null?0:t.parent.nodeSpacing},cn.prototype.computeBusLastRowSpacing=function(t){return t.parent===null?0:t.parent.rowSpacing};function H1(t,e,i,n,s){t=t.children;for(var a=t.length,l=0;l<a;l++)i?t[l].S.h(t[l].S.x,t[l].S.y-e):t[l].S.h(t[l].S.x-e,t[l].S.y);return e=t[a-1],Math.max(n,i?e.la.y+e.focus.y-s/2:e.la.x+e.focus.x-s/2)}function Px(t,e,i){switch(t.alignment){case eg:case kv:return i+t.width>e&&(e=i+t.width),0>i&&(e-=i),e;case Nc:return t.width>e?t.width:e;case Ac:return 2*t.focus.x>e?t.width:e+t.width-2*t.focus.x;case gf:case Dc:return Math.max(t.width,Math.max(e,i+t.width)-Math.min(0,i));case vf:return t.width-t.focus.x+t.nodeSpacing/2+e;case yd:return Math.max(t.width,t.focus.x+t.nodeSpacing/2+e);default:return e}}function Nx(t,e,i){switch(t.alignment){case eg:case kv:return i+t.height>e&&(e=i+t.height),0>i&&(e-=i),e;case Nc:return t.height>e?t.height:e;case Ac:return 2*t.focus.y>e?t.height:e+t.height-2*t.focus.y;case gf:case Dc:return Math.max(t.height,Math.max(e,i+t.height)-Math.min(0,i));case vf:return t.height-t.focus.y+t.nodeSpacing/2+e;case yd:return Math.max(t.height,t.focus.y+t.nodeSpacing/2+e);default:return e}}function Ax(t,e,i){switch(t){case kv:e/=2,i/=2;break;case eg:e/=2,i/=2;break;case Nc:i=e=0;break;case Ac:break;default:lt("Unhandled alignment value "+t.toString())}return new z(e,i)}function D0(t,e,i,n,s,a){e=Ax(e,i,n),Qm(t,e.x,e.y,s,a)}function Qm(t,e,i,n,s){if(e!==0||i!==0)for(t=t.children;n<=s;n++){var a=t[n].S;a.x+=e,a.y+=i}}function V1(t,e,i,n){var s=e.parent;switch(t.ud){case Pc:for(t=e.sourceEdges;t.next();)e=t.value,e.fromVertex===s&&e.relativePoint.h(i,n);break;case tg:for(t=e.destinationEdges;t.next();)e=t.value,e.toVertex===s&&e.relativePoint.h(i,n);break;default:lt("Unhandled path value "+t.ud.toString())}}function W1(t,e,i){for(var n=0;n<t.length;n++){var s=t[n];s.x+=e,s.y+=i}}function n2(t,e,i,n,s,a,l,c){var f=Fu(e),m=f===90||f===270,v=e.nodeSpacing;e=n;var w=s;n=a;var C=l,k=i.Yo,L=i.kp;l=i.Da;var A=m?Math.max(C,l.height):Math.max(n,l.width);if((k===null||f!==Fu(i))&&(k=il(t,2),L=il(t,2),m?(k[0].h(0,0),k[1].h(0,l.height),L[0].h(l.width,0),L[1].h(L[0].x,k[1].y)):(k[0].h(0,0),k[1].h(l.width,0),L[0].h(0,l.height),L[1].h(k[1].x,L[0].y))),m){if(C=9999999,!(w===null||2>w.length||k===null||2>k.length))for(s=i=0;i<w.length&&s<k.length;){a=w[i];var H=k[s];f=H.x,m=H.y,f+=n;var R=a;i+1<w.length&&(R=w[i+1]);var X=H;H=X.x,X=X.y,s+1<k.length&&(X=k[s+1],H=X.x,X=X.y,H+=n);var Y=C;a.y===m?Y=f-a.x:a.y>m&&a.y<X?Y=f+(a.y-m)/(X-m)*(H-f)-a.x:m>a.y&&m<R.y&&(Y=f-(a.x+(m-a.y)/(R.y-a.y)*(R.x-a.x))),Y<C&&(C=Y),R.y<=a.y?i++:X<=m?s++:(R.y<=X&&i++,X<=R.y&&s++)}if(C=n-C,C+=v,i=k,s=C,e===null||2>e.length||i===null||2>i.length)n=null;else{for(v=il(t,e.length+i.length),n=a=f=0;a<i.length&&i[a].y<e[0].y;)m=i[a++],v[n++].h(m.x+s,m.y);for(;f<e.length;)m=e[f++],v[n++].h(m.x,m.y);for(f=e[e.length-1].y;a<i.length&&i[a].y<=f;)a++;for(;a<i.length&&i[a].y>f;)m=i[a++],v[n++].h(m.x+s,m.y);for(i=il(t,n),f=0;f<n;f++)i[f].assign(v[f]);gh(t,v),n=i}if(a=L,f=C,w===null||2>w.length||a===null||2>a.length)s=null;else{for(v=il(t,w.length+a.length),s=m=i=0;i<w.length&&w[i].y<a[0].y;)R=w[i++],v[s++].h(R.x,R.y);for(;m<a.length;)R=a[m++],v[s++].h(R.x+f,R.y);for(a=a[a.length-1].y;i<w.length&&w[i].y<=a;)i++;for(;i<w.length&&w[i].y>a;)f=w[i++],v[s++].h(f.x,f.y);for(a=il(t,s),i=0;i<s;i++)a[i].assign(v[i]);gh(t,v),s=a}return a=Math.max(0,C)+l.width,l=A,gh(t,e),gh(t,k),gh(t,w),gh(t,L),c[0]=n,c[1]=s,new It(C,0,a,l)}if(n=9999999,!(w===null||2>w.length||k===null||2>k.length))for(s=i=0;i<w.length&&s<k.length;)a=w[i],H=k[s],f=H.x,m=H.y,m+=C,R=a,i+1<w.length&&(R=w[i+1]),X=H,H=X.x,X=X.y,s+1<k.length&&(X=k[s+1],H=X.x,X=X.y,X+=C),Y=n,a.x===f?Y=m-a.y:a.x>f&&a.x<H?Y=m+(a.x-f)/(H-f)*(X-m)-a.y:f>a.x&&f<R.x&&(Y=m-(a.y+(f-a.x)/(R.x-a.x)*(R.y-a.y))),Y<n&&(n=Y),R.x<=a.x?i++:H<=f?s++:(R.x<=H&&i++,H<=R.x&&s++);if(C-=n,C+=v,i=k,s=C,e===null||2>e.length||i===null||2>i.length)n=null;else{for(v=il(t,e.length+i.length),n=a=f=0;a<i.length&&i[a].x<e[0].x;)m=i[a++],v[n++].h(m.x,m.y+s);for(;f<e.length;)m=e[f++],v[n++].h(m.x,m.y);for(f=e[e.length-1].x;a<i.length&&i[a].x<=f;)a++;for(;a<i.length&&i[a].x>f;)m=i[a++],v[n++].h(m.x,m.y+s);for(i=il(t,n),f=0;f<n;f++)i[f].assign(v[f]);gh(t,v),n=i}if(a=L,f=C,w===null||2>w.length||a===null||2>a.length)s=null;else{for(v=il(t,w.length+a.length),s=m=i=0;i<w.length&&w[i].x<a[0].x;)R=w[i++],v[s++].h(R.x,R.y);for(;m<a.length;)R=a[m++],v[s++].h(R.x,R.y+f);for(a=a[a.length-1].x;i<w.length&&w[i].x<=a;)i++;for(;i<w.length&&w[i].x>a;)f=w[i++],v[s++].h(f.x,f.y);for(a=il(t,s),i=0;i<s;i++)a[i].assign(v[i]);gh(t,v),s=a}return a=A,l=Math.max(0,C)+l.height,gh(t,e),gh(t,k),gh(t,w),gh(t,L),c[0]=n,c[1]=s,new It(C,0,a,l)}function il(t,e){if(t=t.ru[e],t!==void 0&&(t=t.pop(),t!==void 0))return t;t=[];for(var i=0;i<e;i++)t[i]=new z;return t}function gh(t,e){var i=e.length,n=t.ru[i];n===void 0&&(n=[],t.ru[i]=n),n.push(e)}cn.prototype.arrangeTrees=function(){if(this.Rb===Y1)for(var t=this.Ub.iterator;t.next();){var e=t.value;if(e instanceof pu){var i=e.node;if(i!==null){var n=i.position;i=n.x,n=n.y,isFinite(i)||(i=0),isFinite(n)||(n=0),Dx(this,e,i,n)}}}else{for(t=[],e=this.Ub.iterator;e.next();)i=e.value,i instanceof pu&&t.push(i);switch(this.sorting){case Cv:break;case By:t.reverse();break;case Fy:t.sort(this.comparer);break;case Ry:t.sort(this.comparer),t.reverse();break;default:lt("Unhandled sorting value "+this.sorting.toString())}for(i=this.arrangementOrigin,e=i.x,i=i.y,n=0;n<t.length;n++){var s=t[n];switch(Dx(this,s,e+s.la.x,i+s.la.y),this.Rb){case X1:i+=s.Da.height+this.$d.height;break;case Fx:e+=s.Da.width+this.$d.width;break;default:lt("Unhandled arrangement value "+this.Rb.toString())}}}};function Dx(t,e,i,n){if(e!==null){e.x=i,e.y=n,e=e.children;for(var s=e.length,a=0;a<s;a++){var l=e[a];Dx(t,l,i+l.S.x,n+l.S.y)}}}cn.prototype.commitLayout=function(){this.yv(),this.commitNodes(),this.Gu(),this.isRouting&&this.commitLinks()},cn.prototype.commitNodes=function(){for(var t=this.network.vertexes.iterator;t.next();)t.value.commit();for(t.reset();t.next();)this.layoutComments(t.value)},cn.prototype.Gu=function(){if(this.layerStyle===J1){for(var t=this.$v,e=[],i=null,n=this.network.vertexes.iterator;n.next();){var s=n.value;i===null?i=s.bounds.copy():i.ed(s.bounds);var a=e[s.level];a===void 0?a=this.computeLayerSpacing(s):a=Math.max(a,this.computeLayerSpacing(s)),e[s.level]=a}for(n=0;n<e.length;n++)e[n]===void 0&&(e[n]=0);if(this.angle===90||this.angle===270?(i.Bc(this.nodeSpacing/2,this.layerSpacing),n=new z(-this.nodeSpacing/2,-this.layerSpacing/2)):(i.Bc(this.layerSpacing,this.nodeSpacing/2),n=new z(-this.layerSpacing/2,-this.nodeSpacing/2)),s=[],i=this.angle===90||this.angle===270?i.width:i.height,a=0,this.angle===180||this.angle===270)for(var l=0;l<t.length;l++)a+=t[l]+e[l];for(l=0;l<t.length;l++){var c=t[l]+e[l];this.angle===270?(a-=c,s.push(new It(0,a,i,c))):this.angle===90?(s.push(new It(0,a,i,c)),a+=c):this.angle===180?(a-=c,s.push(new It(a,0,c,i))):(s.push(new It(a,0,c,i)),a+=c)}this.commitLayers(s,n)}},cn.prototype.commitLayers=function(){},cn.prototype.commitLinks=function(){for(var t=this.network.edges.iterator;t.next();)t.value.commit()},cn.prototype.yv=function(){for(var t=this.Ub.iterator;t.next();){var e=t.value;e instanceof pu&&r2(this,e)}};function r2(t,e){if(e!==null){t.setPortSpots(e),e=e.children;for(var i=e.length,n=0;n<i;n++)r2(t,e[n])}}cn.prototype.setPortSpots=function(t){var e=t.alignment;if(Mp(e)){var i=this.ud===Pc,n=Fu(t);switch(n){case 0:var s=so;break;case 90:s=ao;break;case 180:s=co;break;default:s=oo}var a=t.children,l=a.length;switch(e){case gf:case Dc:for(e=0;e<l;e++){var c=a[e];if(c=(i?c.sourceEdges:c.destinationEdges).first(),c!==null&&(c=c.link,c!==null)){var f=n===90||n===270?co:oo;if(l===1||e===l-1&&l%2===1)switch(n){case 0:f=co;break;case 90:f=oo;break;case 180:f=so;break;default:f=ao}else e%2===0&&(f=n===90||n===270?so:ao);i?(t.setsPortSpot&&(c.fromSpot=s),t.setsChildPortSpot&&(c.toSpot=f)):(t.setsPortSpot&&(c.fromSpot=f),t.setsChildPortSpot&&(c.toSpot=s))}}break;case vf:for(n=n===90||n===270?so:ao,a=i?t.destinationEdges:t.sourceEdges;a.next();)l=a.value.link,l!==null&&(i?(t.setsPortSpot&&(l.fromSpot=s),t.setsChildPortSpot&&(l.toSpot=n)):(t.setsPortSpot&&(l.fromSpot=n),t.setsChildPortSpot&&(l.toSpot=s)));break;case yd:for(n=n===90||n===270?co:oo,a=i?t.destinationEdges:t.sourceEdges;a.next();)l=a.value.link,l!==null&&(i?(t.setsPortSpot&&(l.fromSpot=s),t.setsChildPortSpot&&(l.toSpot=n)):(t.setsPortSpot&&(l.fromSpot=n),t.setsChildPortSpot&&(l.toSpot=s)))}}else if(i=Fu(t),this.ud===Pc){for(s=t.destinationEdges;s.next();)if(n=s.value.link,n!==null){if(t.setsPortSpot)if(t.portSpot.Xb())switch(i){case 0:n.fromSpot=so;break;case 90:n.fromSpot=ao;break;case 180:n.fromSpot=co;break;default:n.fromSpot=oo}else n.fromSpot=t.portSpot;if(t.setsChildPortSpot)if(t.childPortSpot.Xb())switch(i){case 0:n.toSpot=co;break;case 90:n.toSpot=oo;break;case 180:n.toSpot=so;break;default:n.toSpot=ao}else n.toSpot=t.childPortSpot}}else for(s=t.sourceEdges;s.next();)if(n=s.value.link,n!==null){if(t.setsPortSpot)if(t.portSpot.Xb())switch(i){case 0:n.toSpot=so;break;case 90:n.toSpot=ao;break;case 180:n.toSpot=co;break;default:n.toSpot=oo}else n.toSpot=t.portSpot;if(t.setsChildPortSpot)if(t.childPortSpot.Xb())switch(i){case 0:n.fromSpot=co;break;case 90:n.fromSpot=oo;break;case 180:n.fromSpot=so;break;default:n.fromSpot=ao}else n.fromSpot=t.childPortSpot}};function Fu(t){return t=t.angle,45>=t?0:135>=t?90:225>=t?180:315>=t?270:0}cn.prototype.computeLayerSpacing=function(t){var e=Fu(t);e=e===90||e===270;var i=t.layerSpacing;if(0<t.layerSpacingParentOverlap){var n=Math.min(1,t.layerSpacingParentOverlap);i-=e?t.height*n:t.width*n}return i<(e?-t.height:-t.width)&&(i=e?-t.height:-t.width),i},cn.prototype.computeNodeIndent=function(t){var e=Fu(t),i=t.nodeIndent;if(0<t.nodeIndentPastParent){var n=Math.min(1,t.nodeIndentPastParent);i+=e===90||e===270?t.width*n:t.height*n}return i=Math.max(0,i)},ct.Object.defineProperties(cn.prototype,{roots:{get:function(){return this.Ub},set:function(t){this.Ub!==t&&(this.Ub=t,this.C())}},path:{get:function(){return this.Wn},set:function(t){this.Wn!==t&&(this.Wn=t,this.C())}},treeStyle:{get:function(){return this.vo},set:function(t){this.Rb===t||t!==G1&&t!==Ox&&t!==Ix&&t!==Bx||(this.vo=t,this.C())}},layerStyle:{get:function(){return this.Bq},set:function(t){this.Rb===t||t!==Rx&&t!==zx&&t!==J1||(this.Bq=t,this.C())}},comments:{get:function(){return this.td},set:function(t){this.td!==t&&(this.td=t,this.C())}},arrangement:{get:function(){return this.Rb},set:function(t){this.Rb===t||t!==X1&&t!==Fx&&t!==Y1||(this.Rb=t,this.C())}},arrangementSpacing:{get:function(){return this.$d},set:function(t){this.$d.D(t)||(this.$d.assign(t),this.C())}},rootDefaults:{get:function(){return this.W},set:function(t){this.W!==t&&(this.W=t,this.C())}},alternateDefaults:{get:function(){return this.Y},set:function(t){this.Y!==t&&(this.Y=t,this.C())}},sorting:{get:function(){return this.W.sorting},set:function(t){this.W.sorting===t||t!==Cv&&t!==By&&t!==Fy&&!Ry||(this.W.sorting=t,this.C())}},comparer:{get:function(){return this.W.comparer},set:function(t){this.W.comparer!==t&&(this.W.comparer=t,this.C())}},angle:{get:function(){return this.W.angle},set:function(t){this.W.angle!==t&&(t===0||t===90||t===180||t===270?(this.W.angle=t,this.C()):lt("TreeLayout.angle must be 0, 90, 180, or 270"))}},alignment:{get:function(){return this.W.alignment},set:function(t){this.W.alignment!==t&&(this.W.alignment=t,this.C())}},nodeIndent:{get:function(){return this.W.nodeIndent},set:function(t){this.W.nodeIndent!==t&&0<=t&&(this.W.nodeIndent=t,this.C())}},nodeIndentPastParent:{get:function(){return this.W.nodeIndentPastParent},set:function(t){this.W.nodeIndentPastParent!==t&&0<=t&&1>=t&&(this.W.nodeIndentPastParent=t,this.C())}},nodeSpacing:{get:function(){return this.W.nodeSpacing},set:function(t){this.W.nodeSpacing!==t&&(this.W.nodeSpacing=t,this.C())}},layerSpacing:{get:function(){return this.W.layerSpacing},set:function(t){this.W.layerSpacing!==t&&(this.W.layerSpacing=t,this.C())}},layerSpacingParentOverlap:{get:function(){return this.W.layerSpacingParentOverlap},set:function(t){this.W.layerSpacingParentOverlap!==t&&0<=t&&1>=t&&(this.W.layerSpacingParentOverlap=t,this.C())}},compaction:{get:function(){return this.W.compaction},set:function(t){this.W.compaction===t||t!==Z1&&t!==zy||(this.W.compaction=t,this.C())}},breadthLimit:{get:function(){return this.W.breadthLimit},set:function(t){this.W.breadthLimit!==t&&0<=t&&(this.W.breadthLimit=t,this.C())}},rowSpacing:{get:function(){return this.W.rowSpacing},set:function(t){this.W.rowSpacing!==t&&(this.W.rowSpacing=t,this.C())}},rowIndent:{get:function(){return this.W.rowIndent},set:function(t){this.W.rowIndent!==t&&0<=t&&(this.W.rowIndent=t,this.C())}},commentSpacing:{get:function(){return this.W.commentSpacing},set:function(t){this.W.commentSpacing!==t&&(this.W.commentSpacing=t,this.C())}},commentMargin:{get:function(){return this.W.commentMargin},set:function(t){this.W.commentMargin!==t&&(this.W.commentMargin=t,this.C())}},setsPortSpot:{get:function(){return this.W.setsPortSpot},set:function(t){this.W.setsPortSpot!==t&&(this.W.setsPortSpot=t,this.C())}},portSpot:{get:function(){return this.W.portSpot},set:function(t){this.W.portSpot.D(t)||(this.W.portSpot=t,this.C())}},setsChildPortSpot:{get:function(){return this.W.setsChildPortSpot},set:function(t){this.W.setsChildPortSpot!==t&&(this.W.setsChildPortSpot=t,this.C())}},childPortSpot:{get:function(){return this.W.childPortSpot},set:function(t){this.W.childPortSpot.D(t)||(this.W.childPortSpot=t,this.C())}},alternateSorting:{get:function(){return this.Y.sorting},set:function(t){this.Y.sorting===t||t!==Cv&&t!==By&&t!==Fy&&!Ry||(this.Y.sorting=t,this.C())}},alternateComparer:{get:function(){return this.Y.comparer},set:function(t){this.Y.comparer!==t&&(this.Y.comparer=t,this.C())}},alternateAngle:{get:function(){return this.Y.angle},set:function(t){this.Y.angle===t||t!==0&&t!==90&&t!==180&&t!==270||(this.Y.angle=t,this.C())}},alternateAlignment:{get:function(){return this.Y.alignment},set:function(t){this.Y.alignment!==t&&(this.Y.alignment=t,this.C())}},alternateNodeIndent:{get:function(){return this.Y.nodeIndent},set:function(t){this.Y.nodeIndent!==t&&0<=t&&(this.Y.nodeIndent=t,this.C())}},alternateNodeIndentPastParent:{get:function(){return this.Y.nodeIndentPastParent},set:function(t){this.Y.nodeIndentPastParent!==t&&0<=t&&1>=t&&(this.Y.nodeIndentPastParent=t,this.C())}},alternateNodeSpacing:{get:function(){return this.Y.nodeSpacing},set:function(t){this.Y.nodeSpacing!==t&&(this.Y.nodeSpacing=t,this.C())}},alternateLayerSpacing:{get:function(){return this.Y.layerSpacing},set:function(t){this.Y.layerSpacing!==t&&(this.Y.layerSpacing=t,this.C())}},alternateLayerSpacingParentOverlap:{get:function(){return this.Y.layerSpacingParentOverlap},set:function(t){this.Y.layerSpacingParentOverlap!==t&&0<=t&&1>=t&&(this.Y.layerSpacingParentOverlap=t,this.C())}},alternateCompaction:{get:function(){return this.Y.compaction},set:function(t){this.Y.compaction===t||t!==Z1&&t!==zy||(this.Y.compaction=t,this.C())}},alternateBreadthLimit:{get:function(){return this.Y.breadthLimit},set:function(t){this.Y.breadthLimit!==t&&0<=t&&(this.Y.breadthLimit=t,this.C())}},alternateRowSpacing:{get:function(){return this.Y.rowSpacing},set:function(t){this.Y.rowSpacing!==t&&(this.Y.rowSpacing=t,this.C())}},alternateRowIndent:{get:function(){return this.Y.rowIndent},set:function(t){this.Y.rowIndent!==t&&0<=t&&(this.Y.rowIndent=t,this.C())}},alternateCommentSpacing:{get:function(){return this.Y.commentSpacing},set:function(t){this.Y.commentSpacing!==t&&(this.Y.commentSpacing=t,this.C())}},alternateCommentMargin:{get:function(){return this.Y.commentMargin},set:function(t){this.Y.commentMargin!==t&&(this.Y.commentMargin=t,this.C())}},alternateSetsPortSpot:{get:function(){return this.Y.setsPortSpot},set:function(t){this.Y.setsPortSpot!==t&&(this.Y.setsPortSpot=t,this.C())}},alternatePortSpot:{get:function(){return this.Y.portSpot},set:function(t){this.Y.portSpot.D(t)||(this.Y.portSpot=t,this.C())}},alternateSetsChildPortSpot:{get:function(){return this.Y.setsChildPortSpot},set:function(t){this.Y.setsChildPortSpot!==t&&(this.Y.setsChildPortSpot=t,this.C())}},alternateChildPortSpot:{get:function(){return this.Y.childPortSpot},set:function(t){this.Y.childPortSpot.D(t)||(this.Y.childPortSpot=t,this.C())}}});var U1=new mt(cn,"PathDefault",-1),Pc=new mt(cn,"PathDestination",0),tg=new mt(cn,"PathSource",1),Cv=new mt(cn,"SortingForwards",10),By=new mt(cn,"SortingReverse",11),Fy=new mt(cn,"SortingAscending",12),Ry=new mt(cn,"SortingDescending",13),kv=new mt(cn,"AlignmentCenterSubtrees",20),eg=new mt(cn,"AlignmentCenterChildren",21),Nc=new mt(cn,"AlignmentStart",22),Ac=new mt(cn,"AlignmentEnd",23),gf=new mt(cn,"AlignmentBus",24),Dc=new mt(cn,"AlignmentBusBranching",25),vf=new mt(cn,"AlignmentTopLeftBus",26),yd=new mt(cn,"AlignmentBottomRightBus",27),Z1=new mt(cn,"CompactionNone",30),zy=new mt(cn,"CompactionBlock",31),G1=new mt(cn,"StyleLayered",40),Ix=new mt(cn,"StyleLastParents",41),Ox=new mt(cn,"StyleAlternating",42),Bx=new mt(cn,"StyleRootOnly",43),X1=new mt(cn,"ArrangementVertical",50),Fx=new mt(cn,"ArrangementHorizontal",51),Y1=new mt(cn,"ArrangementFixedRoots",52),Rx=new mt(cn,"LayerIndividual",60),zx=new mt(cn,"LayerSiblings",61),J1=new mt(cn,"LayerUniform",62);cn.className="TreeLayout",cn.PathDefault=U1,cn.PathDestination=Pc,cn.PathSource=tg,cn.SortingForwards=Cv,cn.SortingReverse=By,cn.SortingAscending=Fy,cn.SortingDescending=Ry,cn.AlignmentCenterSubtrees=kv,cn.AlignmentCenterChildren=eg,cn.AlignmentStart=Nc,cn.AlignmentEnd=Ac,cn.AlignmentBus=gf,cn.AlignmentBusBranching=Dc,cn.AlignmentTopLeftBus=vf,cn.AlignmentBottomRightBus=yd,cn.CompactionNone=Z1,cn.CompactionBlock=zy,cn.StyleLayered=G1,cn.StyleLastParents=Ix,cn.StyleAlternating=Ox,cn.StyleRootOnly=Bx,cn.ArrangementVertical=X1,cn.ArrangementHorizontal=Fx,cn.ArrangementFixedRoots=Y1,cn.LayerIndividual=Rx,cn.LayerSiblings=zx,cn.LayerUniform=J1;function ig(t){nr.call(this,t)}gi(ig,nr),ig.prototype.createVertex=function(){return new pu(this)},ig.prototype.createEdge=function(){return new Lv(this)},ig.className="TreeNetwork";function pu(t){lo.call(this,t),this.V=!1,this.hb=null,this.u=[],this.nb=this.Ha=this.F=this.ia=0,this.td=null,this.S=new z(0,0),this.Da=new ii(0,0),this.la=new z(0,0),this.im=this.hm=this.qA=!1,this.kp=this.Yo=null,this.nd=Cv,this.hd=My,this.Kb=0,this.Jb=eg,this.Vq=this.Uq=0,this.Wq=20,this.ie=50,this.Aq=0,this.Hp=zy,this.Ap=0,this.nr=25,this.Gp=this.mr=10,this.Fp=20,this.xr=!0,this.dr=zn,this.wr=!0,this.Dp=zn}gi(pu,lo),pu.prototype.copyInheritedPropertiesFrom=function(t){t!==null&&(this.nd=t.sorting,this.hd=t.comparer,this.Kb=t.angle,this.Jb=t.alignment,this.Uq=t.nodeIndent,this.Vq=t.nodeIndentPastParent,this.Wq=t.nodeSpacing,this.ie=t.layerSpacing,this.Aq=t.layerSpacingParentOverlap,this.Hp=t.compaction,this.Ap=t.breadthLimit,this.nr=t.rowSpacing,this.mr=t.rowIndent,this.Gp=t.commentSpacing,this.Fp=t.commentMargin,this.xr=t.setsPortSpot,this.dr=t.portSpot,this.wr=t.setsChildPortSpot,this.Dp=t.childPortSpot)},ct.Object.defineProperties(pu.prototype,{initialized:{get:function(){return this.V},set:function(t){this.V!==t&&(this.V=t)}},parent:{get:function(){return this.hb},set:function(t){this.hb!==t&&(this.hb=t)}},children:{get:function(){return this.u},set:function(t){if(this.u!==t){if(t!==null)for(var e=t.length,i=0;i<e;i++);this.u=t}}},level:{get:function(){return this.ia},set:function(t){this.ia!==t&&(this.ia=t)}},descendantCount:{get:function(){return this.F},set:function(t){this.F!==t&&(this.F=t)}},maxChildrenCount:{get:function(){return this.Ha},set:function(t){this.Ha!==t&&(this.Ha=t)}},maxGenerationCount:{get:function(){return this.nb},set:function(t){this.nb!==t&&(this.nb=t)}},comments:{get:function(){return this.td},set:function(t){if(this.td!==t){if(t!==null)for(var e=t.length,i=0;i<e;i++);this.td=t}}},sorting:{get:function(){return this.nd},set:function(t){this.nd!==t&&(this.nd=t)}},comparer:{get:function(){return this.hd},set:function(t){this.hd!==t&&(this.hd=t)}},angle:{get:function(){return this.Kb},set:function(t){this.Kb!==t&&(this.Kb=t)}},alignment:{get:function(){return this.Jb},set:function(t){this.Jb!==t&&(this.Jb=t)}},nodeIndent:{get:function(){return this.Uq},set:function(t){this.Uq!==t&&(this.Uq=t)}},nodeIndentPastParent:{get:function(){return this.Vq},set:function(t){this.Vq!==t&&(this.Vq=t)}},nodeSpacing:{get:function(){return this.Wq},set:function(t){this.Wq!==t&&(this.Wq=t)}},layerSpacing:{get:function(){return this.ie},set:function(t){this.ie!==t&&(this.ie=t)}},layerSpacingParentOverlap:{get:function(){return this.Aq},set:function(t){this.Aq!==t&&(this.Aq=t)}},compaction:{get:function(){return this.Hp},set:function(t){this.Hp!==t&&(this.Hp=t)}},breadthLimit:{get:function(){return this.Ap},set:function(t){this.Ap!==t&&(this.Ap=t)}},rowSpacing:{get:function(){return this.nr},set:function(t){this.nr!==t&&(this.nr=t)}},rowIndent:{get:function(){return this.mr},set:function(t){this.mr!==t&&(this.mr=t)}},commentSpacing:{get:function(){return this.Gp},set:function(t){this.Gp!==t&&(this.Gp=t)}},commentMargin:{get:function(){return this.Fp},set:function(t){this.Fp!==t&&(this.Fp=t)}},setsPortSpot:{get:function(){return this.xr},set:function(t){this.xr!==t&&(this.xr=t)}},portSpot:{get:function(){return this.dr},set:function(t){this.dr.D(t)||(this.dr=t)}},setsChildPortSpot:{get:function(){return this.wr},set:function(t){this.wr!==t&&(this.wr=t)}},childPortSpot:{get:function(){return this.Dp},set:function(t){this.Dp.D(t)||(this.Dp=t)}},childrenCount:{get:function(){return this.children.length}},relativePosition:{get:function(){return this.S},set:function(t){this.S.set(t)}},subtreeSize:{get:function(){return this.Da},set:function(t){this.Da.set(t)}},subtreeOffset:{get:function(){return this.la},set:function(t){this.la.set(t)}}}),pu.className="TreeVertex";function Lv(t){Na.call(this,t),this.$t=new z(0,0)}gi(Lv,Na),Lv.prototype.commit=function(){var t=this.link;if(t!==null&&!t.isAvoiding){var e=this.network.layout,i=null,n=null;switch(e.ud){case Pc:i=this.fromVertex,n=this.toVertex;break;case tg:i=this.toVertex,n=this.fromVertex;break;default:lt("Unhandled path value "+e.ud.toString())}if(i!==null&&n!==null){var s=this.$t;if(s.x!==0||s.y!==0||i.qA){n=i.bounds;var a=Fu(i),l=e.computeLayerSpacing(i),c=i.rowSpacing;t.vg();var f=t.curve===Qa,m=t.isOrthogonal,v;if(t.uh(),m||f){for(v=2;4<t.pointsCount;)t.pv(2);var w=t.i(1),C=t.i(2)}else{for(v=1;3<t.pointsCount;)t.pv(1);w=t.i(0),C=t.i(t.pointsCount-1)}var k=t.i(t.pointsCount-1);a===0?(i.alignment===Ac?(a=n.bottom+s.y,s.y===0&&w.y>k.y+i.rowIndent&&(a=Math.min(a,Math.max(w.y,a-e.computeNodeIndent(i))))):i.alignment===Nc?(a=n.top+s.y,s.y===0&&w.y<k.y-i.rowIndent&&(a=Math.max(a,Math.min(w.y,a+e.computeNodeIndent(i))))):a=i.hm||i.im&&i.maxGenerationCount===1?n.top-i.la.y+s.y:n.y+n.height/2+s.y,f?(t.m(v,w.x,a),v++,t.m(v,n.right+l,a),v++,t.m(v,n.right+l+(s.x-c)/3,a),v++,t.m(v,n.right+l+2*(s.x-c)/3,a),v++,t.m(v,n.right+l+(s.x-c),a),v++,t.m(v,C.x,a)):(m&&(t.m(v,n.right+l/2,w.y),v++),t.m(v,n.right+l/2,a),v++,t.m(v,n.right+l+s.x-(m?c/2:c),a),v++,m&&t.m(v,t.i(v-1).x,C.y))):a===90?(i.alignment===Ac?(a=n.right+s.x,s.x===0&&w.x>k.x+i.rowIndent&&(a=Math.min(a,Math.max(w.x,a-e.computeNodeIndent(i))))):i.alignment===Nc?(a=n.left+s.x,s.x===0&&w.x<k.x-i.rowIndent&&(a=Math.max(a,Math.min(w.x,a+e.computeNodeIndent(i))))):a=i.hm||i.im&&i.maxGenerationCount===1?n.left-i.la.x+s.x:n.x+n.width/2+s.x,f?(t.m(v,a,w.y),v++,t.m(v,a,n.bottom+l),v++,t.m(v,a,n.bottom+l+(s.y-c)/3),v++,t.m(v,a,n.bottom+l+2*(s.y-c)/3),v++,t.m(v,a,n.bottom+l+(s.y-c)),v++,t.m(v,a,C.y)):(m&&(t.m(v,w.x,n.bottom+l/2),v++),t.m(v,a,n.bottom+l/2),v++,t.m(v,a,n.bottom+l+s.y-(m?c/2:c)),v++,m&&t.m(v,C.x,t.i(v-1).y))):a===180?(i.alignment===Ac?(a=n.bottom+s.y,s.y===0&&w.y>k.y+i.rowIndent&&(a=Math.min(a,Math.max(w.y,a-e.computeNodeIndent(i))))):i.alignment===Nc?(a=n.top+s.y,s.y===0&&w.y<k.y-i.rowIndent&&(a=Math.max(a,Math.min(w.y,a+e.computeNodeIndent(i))))):a=i.hm||i.im&&i.maxGenerationCount===1?n.top-i.la.y+s.y:n.y+n.height/2+s.y,f?(t.m(v,w.x,a),v++,t.m(v,n.left-l,a),v++,t.m(v,n.left-l+(s.x+c)/3,a),v++,t.m(v,n.left-l+2*(s.x+c)/3,a),v++,t.m(v,n.left-l+(s.x+c),a),v++,t.m(v,C.x,a)):(m&&(t.m(v,n.left-l/2,w.y),v++),t.m(v,n.left-l/2,a),v++,t.m(v,n.left-l+s.x+(m?c/2:c),a),v++,m&&t.m(v,t.i(v-1).x,C.y))):a===270?(i.alignment===Ac?(a=n.right+s.x,s.x===0&&w.x>k.x+i.rowIndent&&(a=Math.min(a,Math.max(w.x,a-e.computeNodeIndent(i))))):i.alignment===Nc?(a=n.left+s.x,s.x===0&&w.x<k.x-i.rowIndent&&(a=Math.max(a,Math.min(w.x,a+e.computeNodeIndent(i))))):a=i.hm||i.im&&i.maxGenerationCount===1?n.left-i.la.x+s.x:n.x+n.width/2+s.x,f?(t.m(v,a,w.y),v++,t.m(v,a,n.top-l),v++,t.m(v,a,n.top-l+(s.y+c)/3),v++,t.m(v,a,n.top-l+2*(s.y+c)/3),v++,t.m(v,a,n.top-l+(s.y+c)),v++,t.m(v,a,C.y)):(m&&(t.m(v,w.x,n.top-l/2),v++),t.m(v,a,n.top-l/2),v++,t.m(v,a,n.top-l+s.y+(m?c/2:c)),v++,m&&t.m(v,C.x,t.i(v-1).y))):lt("Invalid angle "+a),t.zf()}else s=n,t=this.link,n=this.network.layout,e=Fu(i),e!==Fu(s)&&(l=n.computeLayerSpacing(i),c=i.bounds,i=s.bounds,e===0&&i.left-c.right<l+1||e===90&&i.top-c.bottom<l+1||e===180&&c.left-i.right<l+1||e===270&&c.top-i.bottom<l+1||(t.vg(),i=t.curve===Qa,s=t.isOrthogonal,n=Mp(this.fromVertex.alignment),t.uh(),e===0?(e=c.right+l/2,i?t.pointsCount===4&&(i=t.i(3).y,t.L(1,e-20,t.i(1).y),t.m(2,e-20,i),t.m(3,e,i),t.m(4,e+20,i),t.L(5,t.i(5).x,i)):s?n?t.L(3,t.i(2).x,t.i(4).y):t.pointsCount===6&&(t.L(2,e,t.i(2).y),t.L(3,e,t.i(3).y)):t.pointsCount===4?t.m(2,e,t.i(2).y):t.pointsCount===3?t.L(1,e,t.i(2).y):t.pointsCount===2&&t.m(1,e,t.i(1).y)):e===90?(e=c.bottom+l/2,i?t.pointsCount===4&&(i=t.i(3).x,t.L(1,t.i(1).x,e-20),t.m(2,i,e-20),t.m(3,i,e),t.m(4,i,e+20),t.L(5,i,t.i(5).y)):s?n?t.L(3,t.i(2).x,t.i(4).y):t.pointsCount===6&&(t.L(2,t.i(2).x,e),t.L(3,t.i(3).x,e)):t.pointsCount===4?t.m(2,t.i(2).x,e):t.pointsCount===3?t.L(1,t.i(2).x,e):t.pointsCount===2&&t.m(1,t.i(1).x,e)):e===180?(e=c.left-l/2,i?t.pointsCount===4&&(i=t.i(3).y,t.L(1,e+20,t.i(1).y),t.m(2,e+20,i),t.m(3,e,i),t.m(4,e-20,i),t.L(5,t.i(5).x,i)):s?n?t.L(3,t.i(2).x,t.i(4).y):t.pointsCount===6&&(t.L(2,e,t.i(2).y),t.L(3,e,t.i(3).y)):t.pointsCount===4?t.m(2,e,t.i(2).y):t.pointsCount===3?t.L(1,e,t.i(2).y):t.pointsCount===2&&t.m(1,e,t.i(1).y)):e===270&&(e=c.top-l/2,i?t.pointsCount===4&&(i=t.i(3).x,t.L(1,t.i(1).x,e+20),t.m(2,i,e+20),t.m(3,i,e),t.m(4,i,e-20),t.L(5,i,t.i(5).y)):s?n?t.L(3,t.i(2).x,t.i(4).y):t.pointsCount===6&&(t.L(2,t.i(2).x,e),t.L(3,t.i(3).x,e)):t.pointsCount===4?t.m(2,t.i(2).x,e):t.pointsCount===3?t.L(1,t.i(2).x,e):t.pointsCount===2&&t.m(1,t.i(1).x,e)),t.zf()))}}},ct.Object.defineProperties(Lv.prototype,{fromVertex:{get:function(){return this.kd},set:function(t){this.kd!==t&&(this.kd=t)}},toVertex:{get:function(){return this.qd},set:function(t){this.qd!==t&&(this.qd=t)}},relativePoint:{get:function(){return this.$t},set:function(t){this.$t.set(t)}}}),Lv.className="TreeEdge",Vn.prototype.initializeStandardTools=function(){this.gb("Action",new hl,this.mouseDownTools),this.gb("Relinking",new Fa,this.mouseDownTools),this.gb("LinkReshaping",new qr,this.mouseDownTools),this.gb("Rotating",new Ks,this.mouseDownTools),this.gb("Resizing",new rs,this.mouseDownTools),this.gb("Linking",new Ds,this.mouseMoveTools),this.gb("Dragging",new Pr,this.mouseMoveTools),this.gb("DragSelecting",new Wa,this.mouseMoveTools),this.gb("Panning",new Fo,this.mouseMoveTools),this.gb("ContextMenu",new Hs,this.mouseUpTools),this.gb("TextEditing",new ar,this.mouseUpTools),this.gb("ClickCreating",new Th,this.mouseUpTools),this.gb("ClickSelecting",new oc,this.mouseUpTools)},_u("Horizontal",new Tg),_u("Spot",new dm),_u("Table",new Zd),_u("Viewbox",new Pl),_u("TableRow",new Gd),_u("TableColumn",new e0),_u("Graduated",new rd),_u("Grid",new fm),Vp.add("GraphLinksModel",Zo),Vp.add("TreeModel",vl);var q1=Z.go,jx={get licenseKey(){return wt.licenseKey},set licenseKey(t){wt.licenseKey=t},get version(){return wt.version},Group:ji,EnumValue:mt,List:Kt,Set:At,Map:pe,Point:z,Size:ii,Rect:It,Margin:ai,Spot:Ze,Geometry:fe,PathFigure:Mr,PathSegment:an,InputEvent:As,DiagramEvent:Sh,ChangedEvent:Cr,Model:Ve,GraphLinksModel:xn,TreeModel:na,Binding:Un,Transaction:Bo,UndoManager:Tr,CommandHandler:K,Tool:kn,DraggingTool:Pr,DraggingInfo:Ra,DraggingOptions:p,LinkingBaseTool:yr,LinkingTool:Ds,RelinkingTool:Fa,LinkReshapingTool:qr,ResizingTool:rs,RotatingTool:Ks,ClickSelectingTool:oc,ActionTool:hl,ClickCreatingTool:Th,HTMLInfo:Ua,ContextMenuTool:Hs,DragSelectingTool:Wa,PanningTool:Fo,TextEditingTool:ar,ToolManager:Vn,Animation:ms,AnimationManager:qs,AnimationTrigger:zl,Layer:Ho,Diagram:wt,Palette:x,Overview:S,Brush:Tn,GraphObject:at,Panel:ne,RowColumnDefinition:vo,Shape:Xi,TextBlock:Wn,Picture:da,Part:ui,Adornment:Cn,Node:Le,Link:ue,Placeholder:Zs,Layout:pr,LayoutNetwork:nr,LayoutVertex:lo,LayoutEdge:Na,GridLayout:es,PanelLayout:So,CircularLayout:Lr,CircularNetwork:Gh,CircularVertex:N0,CircularEdge:Ym,ForceDirectedLayout:ys,ForceDirectedNetwork:bp,ForceDirectedVertex:Jm,ForceDirectedEdge:qm,LayeredDigraphLayout:Zn,LayeredDigraphNetwork:Mv,LayeredDigraphVertex:Ql,LayeredDigraphEdge:Iy,TreeLayout:cn,TreeNetwork:ig,TreeVertex:pu,TreeEdge:Lv};typeof q1=="object"&&q1.version&&Fe("WARNING: a `go` object on the root object is already defined. "+("Debug"in q1?"debug ":"")+"version: "+q1.version+", replaced with version: "+jx.version),wt.prototype.go=jx,Z.go=jx,typeof qn.exports=="object"&&(qn.exports=typeof G.g!="undefined"?G.g.go:self.go)}();var Mt=typeof G.g!="undefined"?G.g.go:self.go;const kt=typeof G.g!="undefined"?G.g.go:self.go,vt=kt.Group,le=kt.EnumValue,ut=kt.List,ft=kt.Set,Pt=kt.Map,Q=kt.Point,rt=kt.Size,yt=kt.Rect,be=kt.Margin,pt=kt.Spot,Rt=kt.Geometry,Ce=kt.PathFigure,jt=kt.PathSegment,Jt=kt.InputEvent,Ht=kt.DiagramEvent,de=kt.ChangedEvent,De=kt.Model,$t=kt.GraphLinksModel,Xt=kt.TreeModel,Ct=kt.Binding,q=kt.Transaction,Et=kt.UndoManager,Bt=kt.CommandHandler,ve=kt.Tool,Vt=kt.DraggingTool,We=kt.DraggingInfo,ee=kt.LinkingBaseTool,xe=kt.LinkingTool,Nt=kt.RelinkingTool,_e=kt.LinkReshapingTool,ti=kt.ResizingTool,je=kt.RotatingTool,Be=kt.ClickSelectingTool,Se=kt.ActionTool,dt=kt.ClickCreatingTool,W=kt.HTMLInfo,Zt=kt.ContextMenuTool,ze=kt.DragSelectingTool,Me=kt.PanningTool,ye=kt.TextEditingTool,se=kt.ToolManager,Ue=kt.Animation,Fi=kt.AnimationManager,wi=kt.AnimationTrigger,Ai=kt.Layer,ri=kt.Diagram,sn=kt.Palette,Zi=kt.Overview,j=kt.Brush,P=kt.GraphObject,E=kt.Panel,B=kt.RowColumnDefinition,U=kt.Shape,D=kt.TextBlock,St=kt.TextBlockMetrics,ae=kt.Picture,$e=kt.Part,Ae=kt.Adornment,Qe=kt.Node,He=kt.Link,Si=kt.Placeholder,Ei=kt.Layout,Ci=kt.LayoutNetwork,qt=kt.LayoutVertex,ei=kt.LayoutEdge,ln=kt.GridLayout,Ft=kt.PanelLayout,oe=kt.CircularLayout,we=kt.CircularNetwork,Ii=kt.CircularVertex,Pi=kt.CircularEdge,_i=kt.ForceDirectedLayout,hn=kt.ForceDirectedNetwork,mn=kt.ForceDirectedVertex,Ln=kt.ForceDirectedEdge,jn=kt.LayeredDigraphLayout,On=kt.LayeredDigraphNetwork,rn=kt.LayeredDigraphVertex,ir=kt.LayeredDigraphEdge,tr=kt.TreeLayout,hr=kt.TreeNetwork,Er=kt.TreeVertex,Hn=kt.TreeEdge,Ir=kt.version},2859:function(qn,Li,G){"use strict";G.d(Li,{hP:function(){return Zi}});var Mt=function(j,P){return(Mt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,B){E.__proto__=B}||function(E,B){for(var U in B)Object.prototype.hasOwnProperty.call(B,U)&&(E[U]=B[U])})(j,P)};function kt(j,P){function E(){this.constructor=j}Mt(j,P),j.prototype=P===null?Object.create(P):(E.prototype=P.prototype,new E)}function vt(j,P,E,B){return new(E||(E=Promise))(function(U,D){function St(Ae){try{$e(B.next(Ae))}catch(Qe){D(Qe)}}function ae(Ae){try{$e(B.throw(Ae))}catch(Qe){D(Qe)}}function $e(Ae){var Qe;Ae.done?U(Ae.value):(Qe=Ae.value,Qe instanceof E?Qe:new E(function(He){He(Qe)})).then(St,ae)}$e((B=B.apply(j,P||[])).next())})}function le(j,P){var E,B,U,D,St={label:0,sent:function(){if(1&U[0])throw U[1];return U[1]},trys:[],ops:[]};return D={next:ae(0),throw:ae(1),return:ae(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function ae($e){return function(Ae){return function(Qe){if(E)throw new TypeError("Generator is already executing.");for(;St;)try{if(E=1,B&&(U=2&Qe[0]?B.return:Qe[0]?B.throw||((U=B.return)&&U.call(B),0):B.next)&&!(U=U.call(B,Qe[1])).done)return U;switch(B=0,U&&(Qe=[2&Qe[0],U.value]),Qe[0]){case 0:case 1:U=Qe;break;case 4:return St.label++,{value:Qe[1],done:!1};case 5:St.label++,B=Qe[1],Qe=[0];continue;case 7:Qe=St.ops.pop(),St.trys.pop();continue;default:if(U=St.trys,!((U=U.length>0&&U[U.length-1])||Qe[0]!==6&&Qe[0]!==2)){St=0;continue}if(Qe[0]===3&&(!U||Qe[1]>U[0]&&Qe[1]<U[3])){St.label=Qe[1];break}if(Qe[0]===6&&St.label<U[1]){St.label=U[1],U=Qe;break}if(U&&St.label<U[2]){St.label=U[2],St.ops.push(Qe);break}U[2]&&St.ops.pop(),St.trys.pop();continue}Qe=P.call(j,St)}catch(He){Qe=[6,He],B=0}finally{E=U=0}if(5&Qe[0])throw Qe[1];return{value:Qe[0]?Qe[1]:void 0,done:!0}}([$e,Ae])}}}function ut(){for(var j=0,P=0,E=arguments.length;P<E;P++)j+=arguments[P].length;var B=Array(j),U=0;for(P=0;P<E;P++)for(var D=arguments[P],St=0,ae=D.length;St<ae;St++,U++)B[U]=D[St];return B}var ft=function(){function j(){}return j.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},j.setAttributes=function(P,E){for(var B=0,U=E;B<U.length;B++){var D=U[B],St=D[0],ae=D[1];P.setAttribute(St,ae)}},j.createRect=function(P,E,B){var U=document.createElementNS("http://www.w3.org/2000/svg","rect");return U.setAttribute("width",P.toString()),U.setAttribute("height",E.toString()),B&&j.setAttributes(U,B),U},j.createLine=function(P,E,B,U,D){var St=document.createElementNS("http://www.w3.org/2000/svg","line");return St.setAttribute("x1",P.toString()),St.setAttribute("y1",E.toString()),St.setAttribute("x2",B.toString()),St.setAttribute("y2",U.toString()),D&&j.setAttributes(St,D),St},j.createPolygon=function(P,E){var B=document.createElementNS("http://www.w3.org/2000/svg","polygon");return B.setAttribute("points",P),E&&j.setAttributes(B,E),B},j.createCircle=function(P,E){var B=document.createElementNS("http://www.w3.org/2000/svg","circle");return B.setAttribute("cx",(P/2).toString()),B.setAttribute("cy",(P/2).toString()),B.setAttribute("r",P.toString()),E&&j.setAttributes(B,E),B},j.createEllipse=function(P,E,B){var U=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return U.setAttribute("cx",(P/2).toString()),U.setAttribute("cy",(E/2).toString()),U.setAttribute("rx",(P/2).toString()),U.setAttribute("ry",(E/2).toString()),B&&j.setAttributes(U,B),U},j.createGroup=function(P){var E=document.createElementNS("http://www.w3.org/2000/svg","g");return P&&j.setAttributes(E,P),E},j.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},j.createMarker=function(P,E,B,U,D,St,ae){var $e=document.createElementNS("http://www.w3.org/2000/svg","marker");return j.setAttributes($e,[["id",P],["orient",E],["markerWidth",B.toString()],["markerHeight",U.toString()],["refX",D.toString()],["refY",St.toString()]]),$e.appendChild(ae),$e},j.createText=function(P){var E=document.createElementNS("http://www.w3.org/2000/svg","text");return E.setAttribute("x","0"),E.setAttribute("y","0"),P&&j.setAttributes(E,P),E},j.createTSpan=function(P,E){var B=document.createElementNS("http://www.w3.org/2000/svg","tspan");return B.textContent=P,E&&j.setAttributes(B,E),B},j.createImage=function(P){var E=document.createElementNS("http://www.w3.org/2000/svg","image");return P&&j.setAttributes(E,P),E},j.createPoint=function(P,E){var B=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return B.x=P,B.y=E,B},j.createPath=function(P,E){var B=document.createElementNS("http://www.w3.org/2000/svg","path");return B.setAttribute("d",P),E&&j.setAttributes(B,E),B},j}(),Pt=function(){function j(){}return j.addKey=function(P){j.key=P},Object.defineProperty(j,"isLicensed",{get:function(){return!!j.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(j.key)},enumerable:!1,configurable:!0}),j}(),Q=function(){function j(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return j.prototype.rasterize=function(P,E,B){var U=this;return new Promise(function(D){var St=B!==void 0?B:document.createElement("canvas");P===null&&(U.markersOnly=!0,U.naturalSize=!1);var ae=document.createElementNS("http://www.w3.org/2000/svg","svg");ae.setAttribute("xmlns","http://www.w3.org/2000/svg"),ae.setAttribute("width",E.width.baseVal.valueAsString),ae.setAttribute("height",E.height.baseVal.valueAsString),ae.setAttribute("viewBox","0 0 "+E.viewBox.baseVal.width.toString()+" "+E.viewBox.baseVal.height.toString()),ae.innerHTML=E.innerHTML,U.naturalSize===!0?(ae.width.baseVal.value=P.naturalWidth,ae.height.baseVal.value=P.naturalHeight):U.width!==void 0&&U.height!==void 0&&(ae.width.baseVal.value=U.width,ae.height.baseVal.value=U.height),St.width=ae.width.baseVal.value,St.height=ae.height.baseVal.value;var $e=ae.outerHTML,Ae=St.getContext("2d");U.markersOnly!==!0&&Ae.drawImage(P,0,0,St.width,St.height);var Qe=window.URL,He=new Image(St.width,St.height);He.setAttribute("crossOrigin","anonymous");var Si=new Blob([$e],{type:"image/svg+xml"}),Ei=Qe.createObjectURL(Si);He.onload=function(){Ae.drawImage(He,0,0),Qe.revokeObjectURL(Ei);var Ci=St.toDataURL(U.imageType,U.imageQuality);D(Ci)},He.src=Ei})},j}(),rt=function(){},yt=function(){function j(P){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+P+"_"}return Object.defineProperty(j.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),j.prototype.addClass=function(P){return this.styleSheet===void 0&&this.addStyleSheet(),P.name=""+this.classNamePrefix+P.localName,this.classes.push(P),this.styleSheet.sheet.insertRule("."+P.name+" {"+P.style+"}",this.styleSheet.sheet.cssRules.length),P},j.prototype.addRule=function(P){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(P),this.styleSheet.sheet.insertRule(P.selector+" {"+P.style+"}",this.styleSheet.sheet.cssRules.length)},j.prototype.addStyleSheet=function(){var P;this.styleSheet=document.createElement("style"),((P=this.styleSheetRoot)!==null&&P!==void 0?P:document.head).appendChild(this.styleSheet),this.addRule(new be("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new be("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new be("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new pt("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new pt("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},j.prototype.removeStyleSheet=function(){var P;this.styleSheet&&(((P=this.styleSheetRoot)!==null&&P!==void 0?P:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},j}(),be=function(j,P){this.selector=j,this.style=P},pt=function(j,P){this.localName=j,this.style=P},Rt=function(){function j(P,E,B,U,D){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=P,this.displayMode=E,this.markerItems=B,this.uiStyleSettings=U,this.styles=D,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return j.prototype.show=function(P){var E=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=P,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var B=document.createElement("div");B.className=this.toolbarBlockStyleClass.name,B.style.whiteSpace="nowrap",this.uiContainer.appendChild(B),this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(D){var St=document.createElement("div");St.className=""+E.toolbarButtonStyleClass.name,St.setAttribute("data-type-name",D.typeName),St.innerHTML=D.icon,St.addEventListener("click",function(){E.markerToolbarButtonClicked(St,D)}),E.buttons.push(St),E.markerButtons.push(St)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var U=document.createElement("div");U.className=this.toolbarBlockStyleClass.name,U.style.whiteSpace="nowrap",U.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(U),this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(U,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},j.prototype.addButtonClickListener=function(P){this.buttonClickListeners.push(P)},j.prototype.removeButtonClickListener=function(P){this.buttonClickListeners.indexOf(P)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(P),1)},j.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},j.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var P=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var E=0;E<this.markerButtons.length;E++)E<P||E===P&&this.markerButtons.length-1===P?this.markerButtonBlock.appendChild(this.markerButtons[E]):(E===P&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[E]))}},j.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},j.prototype.resetButtonStyles=function(){var P=this;this.buttons.forEach(function(E){E.className=E.className.replace(P.uiStyleSettings.toolbarButtonStyleColorsClassName?P.uiStyleSettings.toolbarButtonStyleColorsClassName:P.toolbarButtonStyleColorsClass.name,"").trim(),E.className=E.className.replace(P.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?P.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:P.toolbarActiveButtonStyleColorsClass.name,"").trim(),E.className+=" "+(P.uiStyleSettings.toolbarButtonStyleColorsClassName?P.uiStyleSettings.toolbarButtonStyleColorsClassName:P.toolbarButtonStyleColorsClass.name)})},j.prototype.addActionButton=function(P,E,B){var U=this,D=document.createElement("div");switch(D.className=""+this.toolbarButtonStyleClass.name,D.innerHTML=E,D.setAttribute("data-action",B),D.addEventListener("click",function(){U.actionToolbarButtonClicked(D,B)}),B){case"select":D.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":D.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":D.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":D.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":D.style.fill=this.uiStyleSettings.closeButtonColor}P.appendChild(D),this.buttons.push(D)},j.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new pt("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new pt("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new pt("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new pt("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new pt("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var P=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new pt("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*P)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*P)+`px;
padding: `+P+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new pt("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new pt("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new be("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new be("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},j.prototype.markerToolbarButtonClicked=function(P,E){this.setActiveButton(P),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(B){return B("marker",E)}),this.markerButtonOverflowBlock.style.display="none"},j.prototype.actionToolbarButtonClicked=function(P,E){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(B){return B("action",E)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},j.prototype.setActiveButton=function(P){this.resetButtonStyles(),P.className=P.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),P.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},j.prototype.setActiveMarkerButton=function(P){var E=this.markerButtons.find(function(B){return B.getAttribute("data-type-name")===P});E&&this.setActiveButton(E)},j.prototype.setCurrentMarker=function(P){var E=this;this.currentMarker=P,this.buttons.filter(function(B){return/delete|notes/.test(B.getAttribute("data-action"))}).forEach(function(B){E.currentMarker===void 0?(B.style.fillOpacity="0.4",B.style.pointerEvents="none"):(B.style.fillOpacity="1",B.style.pointerEvents="all")})},j}(),Ce=function(){function j(P,E,B,U){this.panels=[],this.panelButtons=[],this.markerjsContainer=P,this.displayMode=E,this.uiStyleSettings=B,this.styles=U,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return j.prototype.addStyles=function(){var P;this.toolboxStyleClass=this.styles.addClass(new pt("toolbox",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
font-family: sans-serif;
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
box-sizing: content-box;
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolboxStyleColorsClass=this.styles.addClass(new pt("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var E=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new pt("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new pt("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new pt("toolbox-panel-row",`
display: flex;
`+(this.displayMode==="inline"?"position: absolute;":"")+`
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
cursor: default;
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
`+(this.displayMode==="inline"?"width: 100%;":"")+`
box-sizing: content-box;
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new pt("toolbox-panel-row_colors",`
background-color: `+((P=this.uiStyleSettings.toolboxBackgroundColor)!==null&&P!==void 0?P:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new pt("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*E)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*E)+`px;
padding: `+E+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new pt("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new pt("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new be("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new be("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},j.prototype.show=function(P){var E;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=P,this.uiContainer.className=this.toolboxStyleClass.name+" "+((E=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&E!==void 0?E:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},j.prototype.setPanelButtons=function(P){var E,B,U=this;this.panels=P,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((E=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&E!==void 0?E:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((B=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&B!==void 0?B:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(D){var St;D.uiStyleSettings=U.uiStyleSettings;var ae=document.createElement("div");ae.className=U.toolboxButtonStyleClass.name+" "+((St=U.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&St!==void 0?St:U.toolboxButtonStyleColorsClass.name),ae.innerHTML=D.icon,ae.title=D.title,ae.addEventListener("click",function(){U.panelButtonClick(D)}),U.panelButtons.push(ae),U.buttonRow.appendChild(ae)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},j.prototype.panelButtonClick=function(P){var E=this,B=-1;if(P!==this.activePanel){B=this.panels.indexOf(P),this.panelRow.innerHTML="";var U=P.getUi();U.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(U),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=P}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){E.displayMode==="inline"?E.panelRow.style.display="none":E.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(D,St){var ae,$e;D.className=E.toolboxButtonStyleClass.name+" "+(St===B?""+((ae=E.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&ae!==void 0?ae:E.toolboxActiveButtonStyleColorsClass.name):""+(($e=E.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&$e!==void 0?$e:E.toolboxButtonStyleColorsClass.name))})},j}(),jt=function(j,P){this.title=j,this.icon=P},Jt=function(j){function P(E,B,U,D){var St=j.call(this,E,D||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return St.colors=[],St.addTransparent=!1,St.colorBoxes=[],St.colors=B,St.currentColor=U,St.setCurrentColor=St.setCurrentColor.bind(St),St.getColorBox=St.getColorBox.bind(St),St}return kt(P,j),P.prototype.getUi=function(){var E=this,B=document.createElement("div");return B.style.overflow="hidden",B.style.whiteSpace="nowrap",this.colors.forEach(function(U){var D=E.getColorBox(U);B.appendChild(D),E.colorBoxes.push(D)}),B},P.prototype.getColorBox=function(E){var B=this,U=this.uiStyleSettings.toolbarHeight/4,D=this.uiStyleSettings.toolbarHeight-U,St=document.createElement("div");St.style.display="inline-block",St.style.boxSizing="content-box",St.style.width=D-2+"px",St.style.height=D-2+"px",St.style.padding="1px",St.style.marginRight="2px",St.style.marginBottom="2px",St.style.borderWidth="2px",St.style.borderStyle="solid",St.style.borderRadius=(D+2)/2+"px",St.style.borderColor=E===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",St.addEventListener("click",function(){B.setCurrentColor(E,St)});var ae=document.createElement("div");return ae.style.display="inline-block",ae.style.width=D-2+"px",ae.style.height=D-2+"px",ae.style.backgroundColor=E,ae.style.borderRadius=D/2+"px",E==="transparent"&&(ae.style.fill=this.uiStyleSettings.toolboxAccentColor,ae.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),St.appendChild(ae),St},P.prototype.setCurrentColor=function(E,B){var U=this;this.currentColor=E,this.colorBoxes.forEach(function(D){D.style.borderColor=D===B?U.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(E)},P}(jt),Ht=function(){function j(P,E,B){this._state="new",this._isSelected=!1,this._container=P,this._overlayContainer=E,this.globalSettings=B,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(j.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),j.prototype.ownsTarget=function(P){return!1},Object.defineProperty(j.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),j.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},j.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},j.prototype.pointerDown=function(P,E){},j.prototype.dblClick=function(P,E){},j.prototype.manipulate=function(P){},j.prototype.pointerUp=function(P){this.stateChanged()},j.prototype.dispose=function(){},j.prototype.addMarkerVisualToContainer=function(P){this.container.childNodes.length>0?this.container.insertBefore(P,this.container.childNodes[0]):this.container.appendChild(P)},j.prototype.getState=function(){return{typeName:j.typeName,state:this.state,notes:this.notes}},j.prototype.restoreState=function(P){this._state=P.state,this.notes=P.notes},j.prototype.scale=function(P,E){},j.prototype.colorChanged=function(P){this.onColorChanged&&this.onColorChanged(P),this.stateChanged()},j.prototype.fillColorChanged=function(P){this.onFillColorChanged&&this.onFillColorChanged(P),this.stateChanged()},j.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var P=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),P.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(P)&&this.onStateChanged(this)}},j.typeName="MarkerBase",j}(),de=function(){function j(){this.findGripByVisual=this.findGripByVisual.bind(this)}return j.prototype.findGripByVisual=function(P){return this.topLeft.ownsTarget(P)?this.topLeft:this.topCenter.ownsTarget(P)?this.topCenter:this.topRight.ownsTarget(P)?this.topRight:this.centerLeft.ownsTarget(P)?this.centerLeft:this.centerRight.ownsTarget(P)?this.centerRight:this.bottomLeft.ownsTarget(P)?this.bottomLeft:this.bottomCenter.ownsTarget(P)?this.bottomCenter:this.bottomRight.ownsTarget(P)?this.bottomRight:void 0},j}(),De=function(){function j(){this.GRIP_SIZE=10,this.visual=ft.createGroup(),this.visual.appendChild(ft.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ft.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return j.prototype.ownsTarget=function(P){return P===this.visual||P===this.visual.childNodes[0]||P===this.visual.childNodes[1]},j}(),$t=function(){function j(){}return j.toITransformMatrix=function(P){return{a:P.a,b:P.b,c:P.c,d:P.d,e:P.e,f:P.f}},j.toSVGMatrix=function(P,E){return P.a=E.a,P.b=E.b,P.c=E.c,P.d=E.d,P.e=E.e,P.f=E.f,P},j}(),Xt=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.left=0,D.top=0,D.width=0,D.height=0,D.defaultSize={x:50,y:20},D.offsetX=0,D.offsetY=0,D.rotationAngle=0,D.CB_DISTANCE=10,D._suppressMarkerCreateEvent=!1,D.container.transform.baseVal.appendItem(ft.createTransform()),D.setupControlBox(),D}return kt(P,j),Object.defineProperty(P.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"visual",{get:function(){return this._visual},set:function(E){this._visual=E;var B=ft.createTransform();this._visual.transform.baseVal.appendItem(B)},enumerable:!1,configurable:!0}),P.prototype.ownsTarget=function(E){return!!j.prototype.ownsTarget.call(this,E)||!!(this.controlGrips.findGripByVisual(E)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(E))},P.prototype.pointerDown=function(E,B){j.prototype.pointerDown.call(this,E,B),this.state==="new"&&(this.left=E.x,this.top=E.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var U=this.unrotatePoint(E);if(this.manipulationStartX=U.x,this.manipulationStartY=U.y,this.offsetX=U.x-this.left,this.offsetY=U.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(B),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(B)){this.activeGrip=this.rotatorGrip;var D=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=D.x-this.width/2,this.top=D.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var St=this.container.transform.baseVal.getItem(0);St.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(St,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},P.prototype.pointerUp=function(E){var B=this.state;j.prototype.pointerUp.call(this,E),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(E),this._state="select",B==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},P.prototype.moveVisual=function(E){this.visual.style.transform="translate("+E.x+"px, "+E.y+"px)"},P.prototype.manipulate=function(E){var B=this.unrotatePoint(E);this.state==="creating"?this.resize(E):this.state==="move"?(this.left=this.manipulationStartLeft+(B.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(B.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(B):this.state==="rotate"&&this.rotate(E)},P.prototype.resize=function(E){var B=this.manipulationStartLeft,U=this.manipulationStartWidth,D=this.manipulationStartTop,St=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:B=this.manipulationStartLeft+E.x-this.manipulationStartX,U=this.manipulationStartWidth+this.manipulationStartLeft-B;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:U=this.manipulationStartWidth+E.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:D=this.manipulationStartTop+E.y-this.manipulationStartY,St=this.manipulationStartHeight+this.manipulationStartTop-D;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:St=this.manipulationStartHeight+E.y-this.manipulationStartY}U>=0?(this.left=B,this.width=U):(this.left=B+U,this.width=-U),St>=0?(this.top=D,this.height=St):(this.top=D+St,this.height=-St),this.setSize()},P.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},P.prototype.rotate=function(E){if(Math.abs(E.x-this.centerX)>.1){var B=Math.sign(E.x-this.centerX);this.rotationAngle=180*Math.atan((E.y-this.centerY)/(E.x-this.centerX))/Math.PI+90*B,this.applyRotation()}},P.prototype.applyRotation=function(){var E=this.container.transform.baseVal.getItem(0);E.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(E,0)},P.prototype.rotatePoint=function(E){if(this.rotationAngle===0)return E;var B=this.container.getCTM(),U=ft.createPoint(E.x,E.y);return{x:(U=U.matrixTransform(B)).x,y:U.y}},P.prototype.unrotatePoint=function(E){if(this.rotationAngle===0)return E;var B=this.container.getCTM();B=B.inverse();var U=ft.createPoint(E.x,E.y);return{x:(U=U.matrixTransform(B)).x,y:U.y}},P.prototype.select=function(){j.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},P.prototype.deselect=function(){j.prototype.deselect.call(this),this.controlBox.style.display="none"},P.prototype.setupControlBox=function(){this.controlBox=ft.createGroup();var E=ft.createTransform();E.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(E),this.container.appendChild(this.controlBox),this.controlRect=ft.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=ft.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new de,this.addControlGrips(),this.controlBox.style.display="none"},P.prototype.adjustControlBox=function(){var E=this.controlBox.transform.baseVal.getItem(0);E.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(E,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},P.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},P.prototype.createGrip=function(){var E=new De;return E.visual.transform.baseVal.appendItem(ft.createTransform()),this.controlBox.appendChild(E.visual),E},P.prototype.positionGrips=function(){var E=this.controlGrips.topLeft.GRIP_SIZE,B=-E/2,U=B,D=(this.width+this.CB_DISTANCE)/2-E/2,St=(this.height+this.CB_DISTANCE)/2-E/2,ae=this.height+this.CB_DISTANCE-E/2,$e=this.width+this.CB_DISTANCE-E/2;this.positionGrip(this.controlGrips.topLeft.visual,B,U),this.positionGrip(this.controlGrips.topCenter.visual,D,U),this.positionGrip(this.controlGrips.topRight.visual,$e,U),this.positionGrip(this.controlGrips.centerLeft.visual,B,St),this.positionGrip(this.controlGrips.centerRight.visual,$e,St),this.positionGrip(this.controlGrips.bottomLeft.visual,B,ae),this.positionGrip(this.controlGrips.bottomCenter.visual,D,ae),this.positionGrip(this.controlGrips.bottomRight.visual,$e,ae),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,D,U-3*this.CB_DISTANCE)},P.prototype.positionGrip=function(E,B,U){var D=E.transform.baseVal.getItem(0);D.setTranslate(B,U),E.transform.baseVal.replaceItem(D,0)},P.prototype.hideControlBox=function(){this.controlBox.style.display="none"},P.prototype.showControlBox=function(){this.controlBox.style.display=""},P.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:$t.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:$t.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},j.prototype.getState.call(this))},P.prototype.restoreState=function(E){j.prototype.restoreState.call(this,E);var B=E;this.left=B.left,this.top=B.top,this.width=B.width,this.height=B.height,this.rotationAngle=B.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix($t.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,B.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix($t.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,B.containerTransformMatrix))},P.prototype.scale=function(E,B){j.prototype.scale.call(this,E,B);var U=this.rotatePoint({x:this.left,y:this.top}),D=this.unrotatePoint({x:U.x*E,y:U.y*B});this.left=D.x,this.top=D.y,this.width=this.width*E,this.height=this.height*B,this.adjustControlBox()},P}(Ht),Ct=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.fillColor="transparent",D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.opacity=1,D.setStrokeColor=D.setStrokeColor.bind(D),D.setFillColor=D.setFillColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.createVisual=D.createVisual.bind(D),D}return kt(P,j),P.prototype.ownsTarget=function(E){return!(!j.prototype.ownsTarget.call(this,E)&&E!==this.visual)},P.prototype.createVisual=function(){this.visual=ft.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},P.prototype.pointerDown=function(E,B){j.prototype.pointerDown.call(this,E,B),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},P.prototype.manipulate=function(E){j.prototype.manipulate.call(this,E)},P.prototype.resize=function(E){j.prototype.resize.call(this,E),this.setSize()},P.prototype.setSize=function(){j.prototype.setSize.call(this),ft.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},P.prototype.pointerUp=function(E){j.prototype.pointerUp.call(this,E),this.setSize()},P.prototype.setStrokeColor=function(E){this.strokeColor=E,this.visual&&ft.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(E),this.stateChanged()},P.prototype.setFillColor=function(E){this.fillColor=E,this.visual&&ft.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},P.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.visual&&ft.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},P.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.visual&&ft.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},P.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},j.prototype.getState.call(this))},P.prototype.restoreState=function(E){var B=E;this.fillColor=B.fillColor,this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.opacity=B.opacity,this.createVisual(),j.prototype.restoreState.call(this,E),this.setSize()},P.prototype.scale=function(E,B){j.prototype.scale.call(this,E,B),this.setSize()},P.title="Rectangle marker",P}(Xt),q=function(j){function P(E,B,U,D){var St=j.call(this,E,D||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return St.widths=[],St.widthBoxes=[],St.widths=B,St.currentWidth=U,St.setCurrentWidth=St.setCurrentWidth.bind(St),St}return kt(P,j),P.prototype.getUi=function(){var E=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",this.widths.forEach(function(U){var D=document.createElement("div");D.style.display="flex",D.style.flexGrow="2",D.style.alignItems="center",D.style.justifyContent="space-between",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.borderColor=U===E.currentWidth?E.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){E.setCurrentWidth(U,D)}),B.appendChild(D);var St=document.createElement("div");St.innerText=U.toString(),St.style.marginRight="5px",D.appendChild(St);var ae=document.createElement("div");ae.style.minHeight="20px",ae.style.flexGrow="2",ae.style.display="flex",ae.style.alignItems="center";var $e=document.createElement("hr");$e.style.minWidth="20px",$e.style.border="0px",$e.style.borderTop=U+"px solid "+E.uiStyleSettings.toolboxColor,$e.style.flexGrow="2",ae.appendChild($e),D.appendChild(ae),E.widthBoxes.push(D)}),B},P.prototype.setCurrentWidth=function(E,B){var U=this;this.currentWidth=E,this.widthBoxes.forEach(function(D){D.style.borderColor=D===B?U.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},P}(jt),Et=function(j){function P(E,B,U,D){var St=j.call(this,E,D||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return St.styles=[],St.styleBoxes=[],St.styles=B,St.currentStyle=U,St.setCurrentStyle=St.setCurrentStyle.bind(St),St}return kt(P,j),P.prototype.getUi=function(){var E=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",this.styles.forEach(function(U){var D=document.createElement("div");D.style.display="flex",D.style.alignItems="center",D.style.justifyContent="space-between",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.overflow="hidden",D.style.maxWidth=100/E.styles.length-5+"%",D.style.borderColor=U===E.currentStyle?E.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){E.setCurrentStyle(U,D)}),B.appendChild(D);var St=document.createElement("div");St.style.minHeight="20px",St.style.flexGrow="2",St.style.overflow="hidden";var ae=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+E.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(U!==""?'stroke-dasharray="'+U+'"':"")+` />
</svg>`;St.innerHTML=ae,D.appendChild(St),E.styleBoxes.push(D)}),B},P.prototype.setCurrentStyle=function(E,B){var U=this;this.currentStyle=E,this.styleBoxes.forEach(function(D){D.style.borderColor=D===B?U.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},P}(jt),Bt=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.strokeColor=U.defaultColor,D.strokeWidth=U.defaultStrokeWidth,D.strokeDasharray=U.defaultStrokeDasharray,D.strokePanel=new Jt("Line color",U.defaultColorSet,U.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.strokeWidthPanel=new q("Line width",U.defaultStrokeWidths,U.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new Et("Line style",U.defaultStrokeDasharrays,U.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D}return kt(P,j),Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=j.prototype.getState.call(this);return E.typeName=P.typeName,E},P.typeName="FrameMarker",P.title="Frame marker",P.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',P}(Ct),ve=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1,this.defaultCaptionFontSize="1rem",this.defaultCaptionText="Text"},Vt=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.x1=0,D.y1=0,D.x2=0,D.y2=0,D.defaultLength=50,D.manipulationStartX=0,D.manipulationStartY=0,D.manipulationStartX1=0,D.manipulationStartY1=0,D.manipulationStartX2=0,D.manipulationStartY2=0,D.setupControlBox(),D}return kt(P,j),P.prototype.ownsTarget=function(E){return!!j.prototype.ownsTarget.call(this,E)||!(!this.grip1.ownsTarget(E)&&!this.grip2.ownsTarget(E))},P.prototype.pointerDown=function(E,B){j.prototype.pointerDown.call(this,E,B),this.manipulationStartX=E.x,this.manipulationStartY=E.y,this.state==="new"&&(this.x1=E.x,this.y1=E.y,this.x2=E.x,this.y2=E.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(B)?this.activeGrip=this.grip1:this.grip2.ownsTarget(B)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},P.prototype.pointerUp=function(E){var B=this.state;j.prototype.pointerUp.call(this,E),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(E),this._state="select",B==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},P.prototype.adjustVisual=function(){},P.prototype.manipulate=function(E){this.state==="creating"?this.resize(E):this.state==="move"?(this.x1=this.manipulationStartX1+E.x-this.manipulationStartX,this.y1=this.manipulationStartY1+E.y-this.manipulationStartY,this.x2=this.manipulationStartX2+E.x-this.manipulationStartX,this.y2=this.manipulationStartY2+E.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(E)},P.prototype.resize=function(E){switch(this.activeGrip){case this.grip1:this.x1=E.x,this.y1=E.y;break;case this.grip2:case void 0:this.x2=E.x,this.y2=E.y}this.adjustVisual(),this.adjustControlBox()},P.prototype.select=function(){j.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},P.prototype.deselect=function(){j.prototype.deselect.call(this),this.controlBox.style.display="none"},P.prototype.setupControlBox=function(){this.controlBox=ft.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},P.prototype.adjustControlBox=function(){this.positionGrips()},P.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},P.prototype.createGrip=function(){var E=new De;return E.visual.transform.baseVal.appendItem(ft.createTransform()),this.controlBox.appendChild(E.visual),E},P.prototype.positionGrips=function(){var E=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-E/2,this.y1-E/2),this.positionGrip(this.grip2.visual,this.x2-E/2,this.y2-E/2)},P.prototype.positionGrip=function(E,B,U){var D=E.transform.baseVal.getItem(0);D.setTranslate(B,U),E.transform.baseVal.replaceItem(D,0)},P.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},j.prototype.getState.call(this))},P.prototype.restoreState=function(E){j.prototype.restoreState.call(this,E);var B=E;this.x1=B.x1,this.y1=B.y1,this.x2=B.x2,this.y2=B.y2},P.prototype.scale=function(E,B){j.prototype.scale.call(this,E,B),this.x1=this.x1*E,this.y1=this.y1*B,this.x2=this.x2*E,this.y2=this.y2*B,this.adjustVisual(),this.adjustControlBox()},P}(Ht),We=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.setStrokeColor=D.setStrokeColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.strokeColor=U.defaultColor,D.strokeWidth=U.defaultStrokeWidth,D.strokeDasharray=U.defaultStrokeDasharray,D.strokePanel=new Jt("Line color",U.defaultColorSet,U.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.strokeWidthPanel=new q("Line width",U.defaultStrokeWidths,U.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new Et("Line style",U.defaultStrokeDasharrays,U.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D}return kt(P,j),P.prototype.ownsTarget=function(E){return!(!j.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.selectorLine&&E!==this.visibleLine)},P.prototype.createVisual=function(){this.visual=ft.createGroup(),this.selectorLine=ft.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ft.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},P.prototype.pointerDown=function(E,B){j.prototype.pointerDown.call(this,E,B),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},P.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),ft.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ft.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ft.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},P.prototype.setStrokeColor=function(E){this.strokeColor=E,this.adjustVisual(),this.colorChanged(E)},P.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.adjustVisual()},P.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.adjustVisual(),this.stateChanged()},Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},j.prototype.getState.call(this));return E.typeName=P.typeName,E},P.prototype.restoreState=function(E){j.prototype.restoreState.call(this,E);var B=E;this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.createVisual(),this.adjustVisual()},P.typeName="LineMarker",P.title="Line marker",P.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',P}(Vt),ee=function(j){function P(E,B,U,D){var St=j.call(this,E,D||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return St.fonts=[],St.fontBoxes=[],St.fonts=B,St.currentFont=U,St.setCurrentFont=St.setCurrentFont.bind(St),St}return kt(P,j),P.prototype.getUi=function(){var E=this,B=document.createElement("div");return B.style.overflow="hidden",B.style.flexGrow="2",this.fonts.forEach(function(U){var D=document.createElement("div");D.style.display="inline-block",D.style.alignItems="center",D.style.justifyContent="space-between",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.overflow="hidden",D.style.maxWidth=100/E.fonts.length-5+"%",D.style.borderColor=U===E.currentFont?E.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){E.setCurrentFont(U,D)}),B.appendChild(D);var St=document.createElement("div");St.style.display="flex",St.style.minHeight="20px",St.style.flexGrow="2",St.style.fontFamily=U,St.style.overflow="hidden";var ae=document.createElement("div");ae.style.whiteSpace="nowrap",ae.style.overflow="hidden",ae.style.textOverflow="ellipsis",ae.innerHTML="The quick brown fox jumps over the lazy dog",St.appendChild(ae),D.appendChild(St),E.fontBoxes.push(D)}),B},P.prototype.setCurrentFont=function(E,B){var U=this;this.currentFont=E,this.fontBoxes.forEach(function(D){D.style.borderColor=D===B?U.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},P}(jt),xe=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.color="transparent",D.padding=5,D.DEFAULT_TEXT="\u8BF7\u8F93\u5165\u6587\u672C",D.text=D.DEFAULT_TEXT,D.isMoved=!1,D.color=U.defaultColor,D.fontFamily=U.defaultFontFamily,D.defaultSize={x:100,y:30},D.setColor=D.setColor.bind(D),D.setFont=D.setFont.bind(D),D.renderText=D.renderText.bind(D),D.sizeText=D.sizeText.bind(D),D.textEditDivClicked=D.textEditDivClicked.bind(D),D.showTextEditor=D.showTextEditor.bind(D),D.setSize=D.setSize.bind(D),D.positionTextEditor=D.positionTextEditor.bind(D),D.colorPanel=new Jt("Color",U.defaultColorSet,U.defaultColor),D.colorPanel.onColorChanged=D.setColor,D.fontFamilyPanel=new ee("Font",U.defaultFontFamilies,U.defaultFontFamily),D.fontFamilyPanel.onFontChanged=D.setFont,D}return kt(P,j),P.prototype.ownsTarget=function(E){if(j.prototype.ownsTarget.call(this,E)||E===this.visual||E===this.textElement||E===this.bgRectangle)return!0;var B=!1;return this.textElement.childNodes.forEach(function(U){U===E&&(B=!0)}),B},P.prototype.createVisual=function(){this.visual=ft.createGroup(),this.bgRectangle=ft.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ft.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ft.createTransform()),this.textElement.transform.baseVal.appendItem(ft.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},P.prototype.pointerDown=function(E,B){j.prototype.pointerDown.call(this,E,B),this.isMoved=!1,this.pointerDownPoint=E,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},P.prototype.renderText=function(){var E=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(B){E.textElement.appendChild(ft.createTSpan(B.trim()===""?" ":B.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},P.prototype.getTextScale=function(){var E=this.textElement.getBBox(),B=1;if(E.width>0&&E.height>0){var U=(1*this.width-this.width*this.padding*2/100)/E.width,D=(1*this.height-this.height*this.padding*2/100)/E.height;B=Math.min(U,D)}return B},P.prototype.getTextPosition=function(E){var B=this.textElement.getBBox(),U=0,D=0;return B.width>0&&B.height>0&&(U=(this.width-B.width*E)/2,D=this.height/2-B.height*E/2),{x:U,y:D}},P.prototype.sizeText=function(){var E=this.textElement.getBBox(),B=this.getTextScale(),U=this.getTextPosition(B);U.y-=E.y*B,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+U.x+"px, "+U.y+"px) scale("+B+", "+B+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(U.x,U.y),this.textElement.transform.baseVal.getItem(1).setScale(B,B))},P.prototype.manipulate=function(E){j.prototype.manipulate.call(this,E),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(E.x-this.pointerDownPoint.x)>5||Math.abs(E.y-this.pointerDownPoint.y)>5)},P.prototype.resize=function(E){j.prototype.resize.call(this,E),this.isMoved=!0,this.setSize(),this.sizeText()},P.prototype.setSize=function(){j.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ft.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ft.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},P.prototype.pointerUp=function(E){var B=this.state;B==="creating"&&(this._suppressMarkerCreateEvent=!0),j.prototype.pointerUp.call(this,E),this.setSize(),(B==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},P.prototype.showTextEditor=function(){var E=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(B){B.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var B=Number.parseFloat(E.textEditor.style.fontSize);E.textEditor.clientWidth>=Number.parseInt(E.textEditor.style.maxWidth)&&B>.9;)B-=.1,E.textEditor.style.fontSize=Math.max(B,.9)+"em"}),this.textEditor.addEventListener("keyup",function(B){B.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(B){if(B.clipboardData){var U=B.clipboardData.getData("text"),D=window.getSelection();if(!D.rangeCount)return!1;D.deleteFromDocument(),D.getRangeAt(0).insertNode(document.createTextNode(U)),B.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){E.textEditDivClicked(E.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},P.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var E=this.getTextScale(),B=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),U=this.textElement.getBBox(),D={x:U.width*E,y:U.height*E};B.x-=D.x/2,B.y-=D.y/2,this.textEditor.style.top=B.y+"px",this.textEditor.style.left=B.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-B.x+"px",this.textEditor.style.fontSize=Math.max(16*E,12)+"px",this.textElement.style.display="none"}},P.prototype.textEditDivClicked=function(E){this.text=E.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},P.prototype.select=function(){j.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},P.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),j.prototype.deselect.call(this)},P.prototype.dblClick=function(E,B){j.prototype.dblClick.call(this,E,B),this.showTextEditor()},P.prototype.setColor=function(E){this.textElement&&ft.setAttributes(this.textElement,[["fill",E]]),this.color=E,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(E)},P.prototype.setFont=function(E){this.textElement&&ft.setAttributes(this.textElement,[["font-family",E]]),this.fontFamily=E,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},P.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},P.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},j.prototype.getState.call(this));return E.typeName=P.typeName,E},P.prototype.restoreState=function(E){var B=E;this.color=B.color,this.fontFamily=B.fontFamily,this.padding=B.padding,this.text=B.text,this.createVisual(),j.prototype.restoreState.call(this,E),this.setSize()},P.prototype.scale=function(E,B){j.prototype.scale.call(this,E,B),this.setSize(),this.sizeText(),this.positionTextEditor()},P.typeName="TextMarker",P.title="Text marker",P.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',P}(Xt),Nt=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.color="transparent",D.lineWidth=3,D.drawing=!1,D.pixelRatio=1,D.color=U.defaultColor,D.lineWidth=U.defaultStrokeWidth,D.pixelRatio=U.freehandPixelRatio,D.setColor=D.setColor.bind(D),D.addCanvas=D.addCanvas.bind(D),D.finishCreation=D.finishCreation.bind(D),D.setLineWidth=D.setLineWidth.bind(D),D.colorPanel=new Jt("Color",U.defaultColorSet,U.defaultColor),D.colorPanel.onColorChanged=D.setColor,D.lineWidthPanel=new q("Line width",U.defaultStrokeWidths,U.defaultStrokeWidth),D.lineWidthPanel.onWidthChanged=D.setLineWidth,D}return kt(P,j),P.prototype.ownsTarget=function(E){return!(!j.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.drawingImage)},P.prototype.createVisual=function(){this.visual=ft.createGroup(),this.drawingImage=ft.createImage(),this.visual.appendChild(this.drawingImage);var E=ft.createTransform();this.visual.transform.baseVal.appendItem(E),this.addMarkerVisualToContainer(this.visual)},P.prototype.pointerDown=function(E,B){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(E.x,E.y),this.drawing=!0):j.prototype.pointerDown.call(this,E,B)},P.prototype.manipulate=function(E){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(E.x,E.y),this.canvasContext.stroke()):j.prototype.manipulate.call(this,E)},P.prototype.resize=function(E){j.prototype.resize.call(this,E),ft.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ft.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},P.prototype.pointerUp=function(E){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):j.prototype.pointerUp.call(this,E)},P.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},P.prototype.select=function(){this.state==="creating"&&this.finishCreation(),j.prototype.select.call(this)},P.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),j.prototype.deselect.call(this)},P.prototype.finishCreation=function(){for(var E=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),B=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],U=B[0],D=B[1],St=B[2],ae=B[3],$e=!1,Ae=0;Ae<this.canvasElement.height;Ae++)for(var Qe=0;Qe<this.canvasElement.width;Qe++)E.data[Ae*this.canvasElement.width*4+4*Qe+3]>0&&($e=!0,Ae<D&&(D=Ae),Qe<U&&(U=Qe),Ae>ae&&(ae=Ae),Qe>St&&(St=Qe));if($e){this.left=U/this.pixelRatio,this.top=D/this.pixelRatio,this.width=(St-U)/this.pixelRatio,this.height=(ae-D)/this.pixelRatio;var He=document.createElement("canvas");He.width=St-U,He.height=ae-D,He.getContext("2d").putImageData(this.canvasContext.getImageData(U,D,St-U,ae-D),0,0),this.drawingImgUrl=He.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},P.prototype.setDrawingImage=function(){ft.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ft.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},P.prototype.setColor=function(E){this.color=E,this.colorChanged(E)},P.prototype.setLineWidth=function(E){this.lineWidth=E},Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=Object.assign({drawingImgUrl:this.drawingImgUrl},j.prototype.getState.call(this));return E.typeName=P.typeName,E},P.prototype.restoreState=function(E){this.createVisual(),j.prototype.restoreState.call(this,E),this.drawingImgUrl=E.drawingImgUrl,this.setDrawingImage()},P.prototype.scale=function(E,B){j.prototype.scale.call(this,E,B),this.setDrawingImage()},P.typeName="FreehandMarker",P.title="Freehand marker",P.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',P}(Xt),_e=function(j){function P(E,B,U){var D=j.call(this,E,U||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return D.typeBoxes=[],D.currentType=B,D.setCurrentType=D.setCurrentType.bind(D),D}return kt(P,j),P.prototype.getUi=function(){var E=this,B=document.createElement("div");B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2";for(var U=function(ae){var $e="both";switch(ae){case 0:$e="both";break;case 1:$e="start";break;case 2:$e="end";break;case 3:$e="none"}var Ae=document.createElement("div");if(Ae.style.display="flex",Ae.style.flexGrow="2",Ae.style.alignItems="center",Ae.style.justifyContent="space-between",Ae.style.padding="5px",Ae.style.borderWidth="2px",Ae.style.borderStyle="solid",Ae.style.borderColor=$e===D.currentType?D.uiStyleSettings.toolboxAccentColor:"transparent",Ae.addEventListener("click",function(){E.setCurrentType($e,Ae)}),B.appendChild(Ae),$e==="both"||$e==="start"){var Qe=document.createElement("div");Qe.style.display="flex",Qe.style.alignItems="center",Qe.style.minHeight="20px",Qe.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(D.uiStyleSettings!==void 0?D.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Qe.style.marginLeft="5px",Ae.appendChild(Qe)}var He=document.createElement("div");He.style.display="flex",He.style.alignItems="center",He.style.minHeight="20px",He.style.flexGrow="2";var Si=document.createElement("hr");if(Si.style.minWidth="20px",Si.style.border="0px",Si.style.borderTop="3px solid "+(D.uiStyleSettings!==void 0?D.uiStyleSettings.toolboxColor:"#eeeeee"),Si.style.flexGrow="2",He.appendChild(Si),Ae.appendChild(He),$e==="both"||$e==="end"){var Ei=document.createElement("div");Ei.style.display="flex",Ei.style.alignItems="center",Ei.style.minHeight="20px",Ei.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(D.uiStyleSettings!==void 0?D.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ei.style.marginRight="5px",Ae.appendChild(Ei)}D.typeBoxes.push(Ae)},D=this,St=0;St<4;St++)U(St);return B},P.prototype.setCurrentType=function(E,B){var U=this;this.currentType=E,this.typeBoxes.forEach(function(D){D.style.borderColor=D===B?U.uiStyleSettings!==void 0?U.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},P}(jt),ti=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.arrowType="end",D.arrowBaseHeight=10,D.arrowBaseWidth=10,D.getArrowPoints=D.getArrowPoints.bind(D),D.setArrowType=D.setArrowType.bind(D),D.arrowTypePanel=new _e("Arrow type","end"),D.arrowTypePanel.onArrowTypeChanged=D.setArrowType,D}return kt(P,j),P.prototype.ownsTarget=function(E){return!(!j.prototype.ownsTarget.call(this,E)&&E!==this.arrow1&&E!==this.arrow2)},P.prototype.getArrowPoints=function(E,B){var U=this.arrowBaseWidth+2*this.strokeWidth,D=this.arrowBaseHeight+2*this.strokeWidth;return E-U/2+","+(B+D/2)+" "+E+","+(B-D/2)+" "+(E+U/2)+","+(B+D/2)},P.prototype.createTips=function(){this.arrow1=ft.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ft.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ft.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ft.createTransform()),this.visual.appendChild(this.arrow2)},P.prototype.pointerDown=function(E,B){j.prototype.pointerDown.call(this,E,B),this.state==="creating"&&this.createTips()},P.prototype.adjustVisual=function(){if(j.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2){this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",ft.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ft.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]);var E=0;Math.abs(this.x1-this.x2)>.1&&(E=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2));var B=this.arrow1.transform.baseVal.getItem(0);B.setRotate(E,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(B,0);var U=this.arrow2.transform.baseVal.getItem(0);U.setRotate(E+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(U,0)}},P.prototype.setArrowType=function(E){this.arrowType=E,this.adjustVisual(),this.stateChanged()},Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=Object.assign({arrowType:this.arrowType},j.prototype.getState.call(this));return E.typeName=P.typeName,E},P.prototype.restoreState=function(E){j.prototype.restoreState.call(this,E);var B=E;this.arrowType=B.arrowType,this.createTips(),this.adjustVisual()},P.typeName="ArrowMarker",P.title="Arrow marker",P.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',P}(We),je=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.fillColor=U.defaultFillColor,D.strokeWidth=0,D.fillPanel=new Jt("Color",U.defaultColorSet,U.defaultFillColor),D.fillPanel.onColorChanged=D.setFillColor,D}return kt(P,j),Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=j.prototype.getState.call(this);return E.typeName=P.typeName,E},P.typeName="CoverMarker",P.title="Cover marker",P.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',P}(Ct),Be=function(j){function P(E,B,U,D){var St=j.call(this,E,D||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return St.opacities=[],St.opacityBoxes=[],St.opacities=B,St.currentOpacity=U,St.setCurrentOpacity=St.setCurrentOpacity.bind(St),St}return kt(P,j),P.prototype.getUi=function(){var E=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",B.style.justifyContent="space-between",this.opacities.forEach(function(U){var D=document.createElement("div");D.style.display="flex",D.style.alignItems="center",D.style.justifyContent="center",D.style.padding="5px",D.style.borderWidth="2px",D.style.borderStyle="solid",D.style.borderColor=U===E.currentOpacity?E.uiStyleSettings.toolboxAccentColor:"transparent",D.addEventListener("click",function(){E.setCurrentOpacity(U,D)}),B.appendChild(D);var St=document.createElement("div");St.innerText=100*U+"%",D.appendChild(St),E.opacityBoxes.push(D)}),B},P.prototype.setCurrentOpacity=function(E,B){var U=this;this.currentOpacity=E,this.opacityBoxes.forEach(function(D){D.style.borderColor=D===B?U.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},P}(jt),Se=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.setOpacity=D.setOpacity.bind(D),D.fillColor=U.defaultHighlightColor,D.strokeWidth=0,D.opacity=U.defaultHighlightOpacity,D.fillPanel=new Jt("Color",U.defaultColorSet,D.fillColor),D.fillPanel.onColorChanged=D.setFillColor,D.opacityPanel=new Be("Opacity",U.defaultOpacitySteps,D.opacity),D.opacityPanel.onOpacityChanged=D.setOpacity,D}return kt(P,j),P.prototype.setOpacity=function(E){this.opacity=E,this.visual&&ft.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=j.prototype.getState.call(this);return E.typeName=P.typeName,E},P.typeName="HighlightMarker",P.title="Highlight marker",P.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',P}(je),dt='<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>',W='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',Zt=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.bgColor="transparent",D.tipPosition={x:0,y:0},D.tipBase1Position={x:0,y:0},D.tipBase2Position={x:0,y:0},D.tipMoving=!1,D.color=U.defaultStrokeColor,D.bgColor=U.defaultFillColor,D.fontFamily=U.defaultFontFamily,D.defaultSize={x:100,y:30},D.setBgColor=D.setBgColor.bind(D),D.getTipPoints=D.getTipPoints.bind(D),D.positionTip=D.positionTip.bind(D),D.setTipPoints=D.setTipPoints.bind(D),D.colorPanel=new Jt("Text color",U.defaultColorSet,D.color,dt),D.colorPanel.onColorChanged=D.setColor,D.bgColorPanel=new Jt("Fill color",U.defaultColorSet,D.bgColor,W),D.bgColorPanel.onColorChanged=D.setBgColor,D.fontFamilyPanel=new ee("Font",U.defaultFontFamilies,U.defaultFontFamily),D.fontFamilyPanel.onFontChanged=D.setFont,D.tipGrip=new De,D.tipGrip.visual.transform.baseVal.appendItem(ft.createTransform()),D.controlBox.appendChild(D.tipGrip.visual),D}return kt(P,j),P.prototype.ownsTarget=function(E){return j.prototype.ownsTarget.call(this,E)||this.tipGrip.ownsTarget(E)||this.tip===E},P.prototype.createTip=function(){ft.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ft.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},P.prototype.pointerDown=function(E,B){this.state==="new"&&j.prototype.pointerDown.call(this,E,B),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(B)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):j.prototype.pointerDown.call(this,E,B)},P.prototype.pointerUp=function(E){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,j.prototype.pointerUp.call(this,E);else{var B=this.state==="creating";j.prototype.pointerUp.call(this,E),this.setTipPoints(B),this.positionTip()}},P.prototype.manipulate=function(E){if(this.tipMoving){var B=this.unrotatePoint(E);this.tipPosition={x:B.x-this.manipulationStartLeft,y:B.y-this.manipulationStartTop},this.positionTip()}else j.prototype.manipulate.call(this,E)},P.prototype.setBgColor=function(E){this.bgRectangle&&this.tip&&(ft.setAttributes(this.bgRectangle,[["fill",E]]),ft.setAttributes(this.tip,[["fill",E]])),this.bgColor=E,this.fillColorChanged(E)},P.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},P.prototype.setTipPoints=function(E){E===void 0&&(E=!1);var B=Math.min(this.height/2,15),U=this.height/5;E&&(this.tipPosition={x:B+U/2,y:this.height+20});var D=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?D<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(U=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:B,y:0},this.tipBase2Position={x:B+U,y:0}):(this.tipBase1Position={x:0,y:B},this.tipBase2Position={x:0,y:B+U}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?D<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(U=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-B-U,y:0},this.tipBase2Position={x:this.width-B,y:0}):(this.tipBase1Position={x:this.width,y:B},this.tipBase2Position={x:this.width,y:B+U}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?D<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(U=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-B-U,y:this.height},this.tipBase2Position={x:this.width-B,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-B-U},this.tipBase2Position={x:this.width,y:this.height-B}):D<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(U=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:B,y:this.height},this.tipBase2Position={x:B+U,y:this.height}):(this.tipBase1Position={x:0,y:this.height-B},this.tipBase2Position={x:0,y:this.height-B-U})},P.prototype.resize=function(E){j.prototype.resize.call(this,E),this.positionTip()},P.prototype.positionTip=function(){ft.setAttributes(this.tip,[["points",this.getTipPoints()]]);var E=this.tipGrip.visual.transform.baseVal.getItem(0);E.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(E,0)},Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),P.prototype.select=function(){this.positionTip(),j.prototype.select.call(this)},P.prototype.getState=function(){var E=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},j.prototype.getState.call(this));return E.typeName=P.typeName,E},P.prototype.restoreState=function(E){var B=E;this.bgColor=B.bgColor,this.tipPosition=B.tipPosition,j.prototype.restoreState.call(this,E),this.createTip(),this.setTipPoints()},P.prototype.scale=function(E,B){j.prototype.scale.call(this,E,B),this.tipPosition={x:this.tipPosition.x*E,y:this.tipPosition.y*B},this.positionTip()},P.typeName="CalloutMarker",P.title="Callout marker",P.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',P}(xe),ze=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.fillColor="transparent",D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.opacity=1,D.strokeColor=U.defaultColor,D.strokeWidth=U.defaultStrokeWidth,D.strokeDasharray=U.defaultStrokeDasharray,D.fillColor=U.defaultFillColor,D.setStrokeColor=D.setStrokeColor.bind(D),D.setFillColor=D.setFillColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.setOpacity=D.setOpacity.bind(D),D.createVisual=D.createVisual.bind(D),D.strokePanel=new Jt("Line color",ut(U.defaultColorSet,["transparent"]),U.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.fillPanel=new Jt("Fill color",ut(U.defaultColorSet,["transparent"]),D.fillColor,W),D.fillPanel.onColorChanged=D.setFillColor,D.strokeWidthPanel=new q("Line width",U.defaultStrokeWidths,U.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new Et("Line style",U.defaultStrokeDasharrays,U.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D.opacityPanel=new Be("Opacity",U.defaultOpacitySteps,D.opacity),D.opacityPanel.onOpacityChanged=D.setOpacity,D}return kt(P,j),P.prototype.ownsTarget=function(E){return!(!j.prototype.ownsTarget.call(this,E)&&E!==this.visual)},P.prototype.createVisual=function(){this.visual=ft.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},P.prototype.pointerDown=function(E,B){j.prototype.pointerDown.call(this,E,B),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},P.prototype.manipulate=function(E){j.prototype.manipulate.call(this,E)},P.prototype.resize=function(E){j.prototype.resize.call(this,E),this.setSize()},P.prototype.setSize=function(){j.prototype.setSize.call(this),ft.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},P.prototype.pointerUp=function(E){j.prototype.pointerUp.call(this,E),this.setSize()},P.prototype.setStrokeColor=function(E){this.strokeColor=E,this.visual&&ft.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(E),this.stateChanged()},P.prototype.setFillColor=function(E){this.fillColor=E,this.visual&&ft.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(E),this.stateChanged()},P.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.visual&&ft.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},P.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.visual&&ft.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},P.prototype.setOpacity=function(E){this.opacity=E,this.visual&&ft.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},j.prototype.getState.call(this));return E.typeName=P.typeName,E},P.prototype.restoreState=function(E){var B=E;this.fillColor=B.fillColor,this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.opacity=B.opacity,this.createVisual(),j.prototype.restoreState.call(this,E),this.setSize()},P.prototype.scale=function(E,B){j.prototype.scale.call(this,E,B),this.setSize()},P.typeName="EllipseMarker",P.title="Ellipse marker",P.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',P}(Xt),Me=function(j){function P(E,B,U){return j.call(this,E,B,U)||this}return kt(P,j),Object.defineProperty(P.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),P.prototype.ownsTarget=function(E){return!(!j.prototype.ownsTarget.call(this,E)&&E!==this.tip1&&E!==this.tip2)},P.prototype.createTips=function(){this.tip1=ft.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(ft.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ft.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(ft.createTransform()),this.visual.appendChild(this.tip2)},P.prototype.pointerDown=function(E,B){j.prototype.pointerDown.call(this,E,B),this.state==="creating"&&this.createTips()},P.prototype.adjustVisual=function(){if(j.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ft.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),ft.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var E=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),B=this.tip1.transform.baseVal.getItem(0);B.setRotate(E,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(B,0);var U=this.tip2.transform.baseVal.getItem(0);U.setRotate(E+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(U,0)}},Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=j.prototype.getState.call(this);return E.typeName=P.typeName,E},P.prototype.restoreState=function(E){j.prototype.restoreState.call(this,E),this.createTips(),this.adjustVisual()},P.typeName="MeasurementMarker",P.title="Measurement marker",P.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',P}(We),ye=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.strokePanel.colors=U.defaultColorSet,D.fillColor="transparent",D}return kt(P,j),Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=j.prototype.getState.call(this);return E.typeName=P.typeName,E},P.typeName="EllipseFrameMarker",P.title="Ellipse frame marker",P.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',P}(ze),se=function(){function j(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(j.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),j.prototype.addUndoStep=function(P){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(P)||(this.undoStack.push(P),JSON.stringify(this.lastRedoStep)!==JSON.stringify(P)&&this.redoStack.splice(0,this.redoStack.length))},j.prototype.replaceLastUndoStep=function(P){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=P)},j.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},j.prototype.undo=function(){if(this.undoStack.length>1){var P=this.undoStack.pop();return P!==void 0&&this.redoStack.push(P),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},j.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},j}(),Ue=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.curveX=0,D.curveY=0,D.manipulationStartCurveX=0,D.manipulationStartCurveY=0,D.setStrokeColor=D.setStrokeColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.positionGrips=D.positionGrips.bind(D),D.addControlGrips=D.addControlGrips.bind(D),D.adjustVisual=D.adjustVisual.bind(D),D.setupControlBox=D.setupControlBox.bind(D),D.resize=D.resize.bind(D),D.strokeColor=U.defaultColor,D.strokeWidth=U.defaultStrokeWidth,D.strokeDasharray=U.defaultStrokeDasharray,D.strokePanel=new Jt("Line color",U.defaultColorSet,U.defaultColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.strokeWidthPanel=new q("Line width",U.defaultStrokeWidths,U.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new Et("Line style",U.defaultStrokeDasharrays,U.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D}return kt(P,j),P.prototype.ownsTarget=function(E){return!(!j.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.selectorCurve&&E!==this.visibleCurve&&!this.curveGrip.ownsTarget(E))},P.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},P.prototype.createVisual=function(){this.visual=ft.createGroup(),this.selectorCurve=ft.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ft.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},P.prototype.pointerDown=function(E,B){j.prototype.pointerDown.call(this,E,B),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=E.x,this.curveY=E.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(B)&&(this.activeGrip=this.curveGrip,this._state="resize")},P.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),ft.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ft.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ft.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},P.prototype.setupControlBox=function(){j.prototype.setupControlBox.call(this),this.curveControlLine1=ft.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ft.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},P.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,j.prototype.addControlGrips.call(this)},P.prototype.positionGrips=function(){j.prototype.positionGrips.call(this);var E=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-E/2,this.curveY-E/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},P.prototype.manipulate=function(E){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+E.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+E.y-this.manipulationStartY),j.prototype.manipulate.call(this,E)},P.prototype.resize=function(E){this.activeGrip===this.curveGrip&&(this.curveX=E.x,this.curveY=E.y),j.prototype.resize.call(this,E),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},P.prototype.setStrokeColor=function(E){this.strokeColor=E,this.adjustVisual(),this.colorChanged(E)},P.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.adjustVisual()},P.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.adjustVisual()},P.prototype.scale=function(E,B){this.curveX=this.curveX*E,this.curveY=this.curveY*B,j.prototype.scale.call(this,E,B)},Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},j.prototype.getState.call(this));return E.typeName=P.typeName,E},P.prototype.restoreState=function(E){j.prototype.restoreState.call(this,E);var B=E;this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.curveX=B.curveX,this.curveY=B.curveY,this.createVisual(),this.adjustVisual()},P.typeName="CurveMarker",P.title="Curve marker",P.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',P}(Vt),Fi=function(j){function P(E,B,U){var D=j.call(this,E,B,U)||this;return D.fillColor="transparent",D.strokeColor="transparent",D.strokeWidth=0,D.strokeDasharray="",D.textColor="transparent",D.fontSize="1rem",D.isMoved=!1,D.captionText="Caption",D.PADDING=5,D.captionBoxWidth=0,D.captionBoxHeight=0,D.strokeColor=U.defaultColor,D.strokeWidth=U.defaultStrokeWidth,D.strokeDasharray=U.defaultStrokeDasharray,D.fillColor=U.defaultFillColor,D.textColor=U.defaultStrokeColor,D.fontFamily=U.defaultFontFamily,D.fontSize=U.defaultCaptionFontSize,D.captionText=U.defaultCaptionText,D.setStrokeColor=D.setStrokeColor.bind(D),D.setFillColor=D.setFillColor.bind(D),D.setStrokeWidth=D.setStrokeWidth.bind(D),D.setStrokeDasharray=D.setStrokeDasharray.bind(D),D.createVisual=D.createVisual.bind(D),D.sizeCaption=D.sizeCaption.bind(D),D.setCaptionText=D.setCaptionText.bind(D),D.showTextEditor=D.showTextEditor.bind(D),D.positionTextEditor=D.positionTextEditor.bind(D),D.finishTextEditing=D.finishTextEditing.bind(D),D.setFont=D.setFont.bind(D),D.setTextColor=D.setTextColor.bind(D),D.strokePanel=new Jt("Line color",ut(U.defaultColorSet,["transparent"]),D.strokeColor),D.strokePanel.onColorChanged=D.setStrokeColor,D.fillPanel=new Jt("Fill color",ut(U.defaultColorSet,["transparent"]),D.fillColor,W),D.fillPanel.onColorChanged=D.setFillColor,D.strokeWidthPanel=new q("Line width",U.defaultStrokeWidths,U.defaultStrokeWidth),D.strokeWidthPanel.onWidthChanged=D.setStrokeWidth,D.strokeStylePanel=new Et("Line style",U.defaultStrokeDasharrays,U.defaultStrokeDasharray),D.strokeStylePanel.onStyleChanged=D.setStrokeDasharray,D.fontFamilyPanel=new ee("Font",U.defaultFontFamilies,U.defaultFontFamily),D.fontFamilyPanel.onFontChanged=D.setFont,D.textColorPanel=new Jt("Text color",U.defaultColorSet,D.textColor,dt),D.textColorPanel.onColorChanged=D.setTextColor,D}return kt(P,j),P.prototype.ownsTarget=function(E){return!(!j.prototype.ownsTarget.call(this,E)&&E!==this.visual&&E!==this.frame&&E!==this.captionBg&&E!==this.captionElement)},P.prototype.createVisual=function(){this.visual=ft.createGroup(),this.addMarkerVisualToContainer(this.visual),this.captionBg=ft.createRect(1,1,[["fill",this.fillColor]]),this.visual.appendChild(this.captionBg),this.captionElement=ft.createText([["fill",this.textColor],["font-family",this.fontFamily]]),this.captionElement.style.fontSize=this.fontSize,this.captionElement.style.textAnchor="start",this.captionElement.style.dominantBaseline="text-before-edge",this.captionElement.textContent=this.captionText,this.visual.appendChild(this.captionElement),this.frame=ft.createRect(this.width,this.height,[["fill","transparent"],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray]]),this.visual.appendChild(this.frame),this.sizeCaption()},P.prototype.setCaptionText=function(E){this.captionText=E,this.captionElement.textContent=this.captionText,this.sizeCaption()},P.prototype.pointerDown=function(E,B){j.prototype.pointerDown.call(this,E,B),this.isMoved=!1,this.pointerDownPoint=E,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(E),this._state="creating")},P.prototype.manipulate=function(E){j.prototype.manipulate.call(this,E),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(E.x-this.pointerDownPoint.x)>5||Math.abs(E.y-this.pointerDownPoint.y)>5)},P.prototype.resize=function(E){j.prototype.resize.call(this,E),this.setSize()},P.prototype.sizeCaption=function(){var E=this.captionElement.getBBox();this.captionText.trim()!==""?(this.captionBoxWidth=E.width+2*this.PADDING,this.captionBoxHeight=E.height+2*this.PADDING):(this.captionBoxWidth=0,this.captionBoxHeight=0),ft.setAttributes(this.captionBg,[["width",this.captionBoxWidth.toString()],["height",this.captionBoxHeight.toString()],["clip-path","path('M0,0 H"+this.width+" V"+this.height+" H"+-this.width+" Z')"]]),ft.setAttributes(this.captionElement,[["x",this.PADDING.toString()],["y",this.PADDING.toString()],["clip-path","path('M0,0 H"+(this.width-this.PADDING)+" V"+this.height+" H"+(-this.width-this.PADDING)+" Z')"]])},P.prototype.showTextEditor=function(){var E=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditBox=document.createElement("input"),this.textEditBox.style.position="absolute",this.textEditBox.style.width=this.width+"px",this.captionBoxHeight>0&&(this.textEditBox.style.height=this.captionBoxHeight+"px"),this.textEditBox.style.fontSize=this.fontSize,this.textEditBox.style.fontFamily=this.fontFamily,this.textEditBox.style.backgroundColor=this.fillColor,this.textEditBox.style.color=this.textColor,this.textEditBox.style.borderWidth="0",this.textEditBox.setAttribute("value",this.captionText),this.textEditBox.select(),this.textEditDiv.appendChild(this.textEditBox),this.overlayContainer.appendChild(this.textEditDiv),this.textEditBox.addEventListener("pointerup",function(B){B.stopPropagation()}),this.textEditBox.addEventListener("keypress",function(B){B.key==="Enter"&&E.finishTextEditing(E.textEditBox.value)}),this.textEditBox.addEventListener("keyup",function(B){B.cancelBubble=!0}),this.textEditBox.addEventListener("blur",function(){E.finishTextEditing(E.textEditBox.value)}),this.textEditDiv.addEventListener("pointerup",function(){E.finishTextEditing(E.textEditBox.value)}),this.positionTextEditor(),this.textEditBox.focus()},P.prototype.positionTextEditor=function(){this.state==="edit"&&(this.textEditBox===void 0?this.showTextEditor():(this.textEditBox.style.left=this.left+"px",this.textEditBox.style.top=this.top+"px",this.textEditBox.style.transform="rotate("+this.rotationAngle+"deg)",this.textEditBox.style.transformOrigin=this.width/2+"px "+this.height/2+"px"))},P.prototype.finishTextEditing=function(E){this.setCaptionText(E.trim()),this.overlayContainer.innerHTML="",this.stateChanged()},P.prototype.setFont=function(E){this.captionElement&&ft.setAttributes(this.captionElement,[["font-family",E]]),this.fontFamily=E,this.textEditBox&&(this.textEditBox.style.fontFamily=this.fontFamily),this.sizeCaption(),this.stateChanged()},P.prototype.setTextColor=function(E){this.captionElement&&ft.setAttributes(this.captionElement,[["fill",E]]),this.textColor=E,this.textEditBox&&(this.textEditBox.style.color=this.textColor),this.stateChanged()},P.prototype.setSize=function(){j.prototype.setSize.call(this),ft.setAttributes(this.frame,[["width",this.width.toString()],["height",this.height.toString()]]),this.sizeCaption()},P.prototype.pointerUp=function(E){j.prototype.pointerUp.call(this,E),this.setSize(),!this.isMoved&&Date.now()-this.pointerDownTimestamp>500&&this.showTextEditor(),this.pointerDownPoint=void 0},P.prototype.dblClick=function(E,B){j.prototype.dblClick.call(this,E,B),this.showTextEditor()},P.prototype.setStrokeColor=function(E){this.strokeColor=E,this.frame&&ft.setAttributes(this.frame,[["stroke",this.strokeColor]]),this.colorChanged(E),this.stateChanged()},P.prototype.setFillColor=function(E){this.fillColor=E,this.captionBg&&ft.setAttributes(this.captionBg,[["fill",this.fillColor]]),this.fillColorChanged(E),this.stateChanged()},P.prototype.setStrokeWidth=function(E){this.strokeWidth=E,this.frame&&ft.setAttributes(this.frame,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},P.prototype.setStrokeDasharray=function(E){this.strokeDasharray=E,this.frame&&ft.setAttributes(this.frame,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},Object.defineProperty(P.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.fontFamilyPanel,this.textColorPanel]},enumerable:!1,configurable:!0}),P.prototype.getState=function(){var E=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:1,textColor:this.textColor,fontFamily:this.fontFamily,fontSize:this.fontSize,captionText:this.captionText},j.prototype.getState.call(this));return E.typeName=this.typeName,E},P.prototype.restoreState=function(E){var B=E;this.fillColor=B.fillColor,this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.textColor=B.textColor,this.fontFamily=B.fontFamily,this.captionText=B.captionText,this.fontSize=B.fontSize,this.createVisual(),j.prototype.restoreState.call(this,E),this.setSize()},P.prototype.scale=function(E,B){j.prototype.scale.call(this,E,B),this.setSize()},P.typeName="CaptionFrameMarker",P.title="Caption frame marker",P.icon='<svg viewBox="0 0 24 24"><path d="M5 3c-1.11 0-2 .89-2 2v14c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2H5m0 2h14v14H5V5m2 2v2h10V7H7z"/></svg>',P}(Xt),wi=function(){function j(P,E){E===void 0&&(E=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=P,this.cancelable=E}return Object.defineProperty(j.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),j.prototype.preventDefault=function(){this._defaultPrevented=!0},j}(),Ai=function(j){function P(E,B,U){var D=j.call(this,E,!1)||this;return D.dataUrl=B,D.state=U,D}return kt(P,j),P}(wi),ri=function(j){function P(E,B,U){U===void 0&&(U=!1);var D=j.call(this,E,U)||this;return D.marker=B,D}return kt(P,j),P}(wi),sn=function(){function j(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return j.prototype.addEventListener=function(P,E){this[P].push(E)},j.prototype.removeEventListener=function(P,E){var B=this[P].indexOf(E);B>-1&&this[P].splice(B,1)},j}(),Zi=function(){function j(P){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ve,this._isOpen=!1,this.undoRedoManager=new se,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new sn,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=j.instanceCounter++,this.styles=new yt(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=P,this.targetRoot=document.body,this.width=P.clientWidth,this.height=P.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(j.prototype,"ALL_MARKER_TYPES",{get:function(){return[Bt,Nt,ti,xe,ye,ze,Se,Zt,Me,je,We,Ue,Fi]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Bt,Nt,ti,xe,ze,Se,Zt]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Bt,Nt,ti,xe,Se]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(P){var E=this;this._availableMarkerTypes.splice(0),P.forEach(function(B){if(typeof B=="string"){var U=E.ALL_MARKER_TYPES.find(function(D){return D.typeName===B});U!==void 0&&E._availableMarkerTypes.push(U)}else E._availableMarkerTypes.push(B)})},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(P){this._zoomLevel=P,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),j.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Pt.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},j.prototype.show=function(){var P=this;this.styles.styleSheetRoot===void 0&&rt.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=rt.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(E){return E(new wi(P))})},j.prototype.render=function(){return vt(this,void 0,void 0,function(){var P;return le(this,function(E){switch(E.label){case 0:return this.setCurrentMarker(),(P=new Q).naturalSize=this.renderAtNaturalSize,P.imageType=this.renderImageType,P.imageQuality=this.renderImageQuality,P.markersOnly=this.renderMarkersOnly,P.width=this.renderWidth,P.height=this.renderHeight,[4,P.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return E.sent(),[4,P.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,E.sent()]}})})},j.prototype.close=function(P){var E=this;if(P===void 0&&(P=!1),this.isOpen){var B=!1;P||this.eventListeners.beforeclose.forEach(function(U){var D=new wi(E,!0);U(D),D.defaultPrevented&&(B=!0)}),B||(this.coverDiv&&this.closeUI(),this.targetObserver&&(this.targetObserver.unobserve(this.target),this.targetObserver.unobserve(this.editorCanvas)),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(U){return U(new wi(E))}),this.detachEvents(),this._isOpen=!1)}},j.prototype.addMarkersToToolbar=function(){for(var P,E=[],B=0;B<arguments.length;B++)E[B]=arguments[B];(P=this._availableMarkerTypes).push.apply(P,E)},j.prototype.addRenderEventListener=function(P){this.addEventListener("render",function(E){P(E.dataUrl,E.state)})},j.prototype.removeRenderEventListener=function(P){},j.prototype.addCloseEventListener=function(P){this.addEventListener("close",function(){P()})},j.prototype.removeCloseEventListener=function(P){},j.prototype.setupResizeObserver=function(){var P=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){P.resize(P.target.clientWidth,P.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return P.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},j.prototype.onPopupTargetResize=function(){var P=1*this.target.clientWidth/this.target.clientHeight,E=this.editorCanvas.clientWidth/P>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*P:this.editorCanvas.clientWidth,B=E<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/P;this.resize(E,B)},j.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},j.prototype.resize=function(P,E){this._isResizing=!0;var B=P/this.imageWidth,U=E/this.imageHeight;this.imageWidth=Math.round(P),this.imageHeight=Math.round(E),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(B,U),this._isResizing=!1},j.prototype.scaleMarkers=function(P,E){var B,U=this;this._currentMarker&&this._currentMarker instanceof xe?this._currentMarker.scale(P,E):(B=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(D){D!==U._currentMarker&&D.scale(P,E)}),B!==void 0&&this.setCurrentMarker(B)},j.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},j.prototype.setTopLeft=function(){var P=this.editingTarget.getBoundingClientRect(),E=this.editorCanvas.getBoundingClientRect();this.left=P.left-E.left,this.top=P.top-E.top},j.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},j.prototype.addDefs=function(){for(var P,E=[],B=0;B<arguments.length;B++)E[B]=arguments[B];this.defs=ft.createDefs(),this.addDefsToImage(),(P=this.defs).append.apply(P,E)},j.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},j.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},j.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},j.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},j.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},j.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},j.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},j.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var P=document.createElement("a");P.href="https://markerjs.com/",P.target="_blank",P.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',P.title="Powered by marker.js",P.style.display="grid",P.style.alignItems="center",P.style.justifyItems="center",P.style.padding="3px",P.style.width="20px",P.style.height="20px",this.logoUI.appendChild(P),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},j.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},j.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},j.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},j.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var P=this.settings.uiOffsetTop!==void 0?this.target.offsetTop+this.settings.uiOffsetTop:this.target.offsetTop>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=P+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Rt(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.settings.uiOffsetTop===void 0&&this.target.offsetTop<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Ce(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},j.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},j.prototype.removeMarker=function(P){this.markerImage.removeChild(P.container),this.markers.indexOf(P)>-1&&this.markers.splice(this.markers.indexOf(P),1),P.dispose()},j.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},j.prototype.toolbarButtonClicked=function(P,E){if(P==="marker"&&E!==void 0)this.createNewMarker(E);else if(P==="action")switch(E){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},j.prototype.deleteSelectedMarker=function(){var P=this;if(this._currentMarker!==void 0){var E=!1;if(this.eventListeners.markerbeforedelete.forEach(function(U){var D=new ri(P,P._currentMarker,!0);U(D),D.defaultPrevented&&(E=!0)}),!E){var B=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(U){return U(new ri(P,B))})}}},j.prototype.clear=function(){var P=this,E=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(St){var ae=new ri(P,void 0,!0);St(ae),ae.defaultPrevented&&(E=!0)}),!E)){this.setCurrentMarker();for(var B=function(St){var ae=U.markers[St];U.setCurrentMarker(U.markers[St]),U._currentMarker.dispose(),U.markerImage.removeChild(U._currentMarker.container),U.markers.splice(U.markers.indexOf(U._currentMarker),1),U.eventListeners.markerdelete.forEach(function($e){return $e(new ri(P,ae))})},U=this,D=this.markers.length-1;D>=0;D--)B(D);this.addUndoStep()}},Object.defineProperty(j.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),j.prototype.showNotesEditor=function(){var P;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(P=this._currentMarker.notes)!==null&&P!==void 0?P:"",this.overlayContainer.appendChild(this.notesArea))},j.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},j.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},j.prototype.addUndoStep=function(){var P=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var E=this.getState(),B=this.undoRedoManager.getLastUndoStep();if(!B||B.width===E.width&&B.height===E.height){var U=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(E),U<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(D){return D(new wi(P))})}else this.undoRedoManager.replaceLastUndoStep(E),this.eventListeners.statechange.forEach(function(D){return D(new wi(P))})}},j.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},j.prototype.undoStep=function(){var P=this,E=this.undoRedoManager.undo();E!==void 0&&(this.restoreState(E),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(B){return B(new wi(P))}))},j.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},j.prototype.redoStep=function(){var P=this,E=this.undoRedoManager.redo();E!==void 0&&(this.restoreState(E),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(B){return B(new wi(P))}))},j.prototype.stepZoom=function(){var P=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=P<this.zoomSteps.length-1?this.zoomSteps[P+1]:this.zoomSteps[0]},j.prototype.panTo=function(P){this.contentDiv.scrollBy({left:this.prevPanPoint.x-P.x,top:this.prevPanPoint.y-P.y}),this.prevPanPoint=P},j.prototype.startRenderAndClose=function(){return vt(this,void 0,void 0,function(){var P,E,B=this;return le(this,function(U){switch(U.label){case 0:return[4,this.render()];case 1:return P=U.sent(),E=this.getState(),this.eventListeners.render.forEach(function(D){return D(new Ai(B,P,E))}),this.close(!0),[2]}})})},j.prototype.getState=function(P){P===!0&&this.setCurrentMarker();var E={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(B){return E.markers.push(B.getState())}),E},j.prototype.restoreState=function(P){var E=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);P.markers.forEach(function(B){var U=E._availableMarkerTypes.find(function(St){return St.typeName===B.typeName});if(U!==void 0){var D=E.addNewMarker(U);D.restoreState(B),E.markers.push(D)}}),P.width&&P.height&&(P.width!==this.imageWidth||P.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/P.width,this.imageHeight/P.height),this.eventListeners.restorestate.forEach(function(B){return B(new wi(E))})},j.prototype.addNewMarker=function(P){var E=ft.createGroup();return this.markerImage.appendChild(E),new P(E,this.overlayContainer,this.settings)},j.prototype.createNewMarker=function(P){var E,B=this;(E=typeof P=="string"?this._availableMarkerTypes.find(function(U){return U.typeName===P}):P)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(E),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(E.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(U){return U(new ri(B,B._currentMarker))}))},j.prototype.markerCreated=function(P){var E=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(P),this.setCurrentMarker(P),P instanceof Nt&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Nt):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(B){return B(new ri(E,E._currentMarker))})},j.prototype.colorChanged=function(P){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=P,this.settings.defaultStrokeColor=P)},j.prototype.fillColorChanged=function(P){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=P)},j.prototype.markerStateChanged=function(P){var E=this;this.eventListeners.markerchange.forEach(function(B){return B(new ri(E,P))})},j.prototype.setCurrentMarker=function(P){var E=this;this._currentMarker!==P&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(B){return B(new ri(E,E._currentMarker))})),this._currentMarker=P,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(B){return B(new ri(E,E._currentMarker))}))},j.prototype.onPointerDown=function(P){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||P.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var E=this.markers.find(function(B){return B.ownsTarget(P.target)});E!==void 0?(this.setCurrentMarker(E),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(P.clientX,P.clientY),P.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:P.clientX,y:P.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(P.clientX,P.clientY))},j.prototype.onDblClick=function(P){if(this._isFocused||this.focus(),this.mode==="select"){var E=this.markers.find(function(B){return B.ownsTarget(P.target)});E!==void 0&&E!==this._currentMarker&&this.setCurrentMarker(E),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(P.clientX,P.clientY),P.target):this.setCurrentMarker()}},j.prototype.onPointerMove=function(P){this.touchPoints!==1&&P.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||P.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(P.clientX,P.clientY)):this.zoomLevel>1&&this.panTo({x:P.clientX,y:P.clientY}))},j.prototype.onPointerUp=function(P){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(P.clientX,P.clientY)),this.isDragging=!1,this.addUndoStep()},j.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},j.prototype.onKeyUp=function(P){this._currentMarker===void 0||this.notesArea!==void 0||P.key!=="Delete"&&P.key!=="Backspace"||this.deleteSelectedMarker()},j.prototype.clientToLocalCoordinates=function(P,E){var B=this.markerImage.getBoundingClientRect();return{x:(P-B.left)/this.zoomLevel,y:(E-B.top)/this.zoomLevel}},j.prototype.onWindowResize=function(){this.positionUI()},j.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var P=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=P+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},j.prototype.addLicenseKey=function(P){Pt.addKey(P)},j.prototype.addEventListener=function(P,E){this.eventListeners.addEventListener(P,E)},j.prototype.removeEventListener=function(P,E){this.eventListeners.removeEventListener(P,E)},j.prototype.renderState=function(P){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(P),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(j.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),j.prototype.focus=function(){var P=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(E){return E(new wi(P))}))},j.prototype.blur=function(){var P=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(E){return E(new wi(P))}))},j.instanceCounter=0,j}()},5630:function(qn,Li,G){"use strict";var Mt=G(32855),kt=G(27247),vt=G(74430),le=G(11913),ut=G(43079),ft=G(92310),Pt=G.n(ft),Q=G(18929),rt=G(59301),yt=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],be=(0,rt.forwardRef)(function(pt,Rt){var Ce,jt=pt.prefixCls,Jt=jt===void 0?"rc-checkbox":jt,Ht=pt.className,de=pt.style,De=pt.checked,$t=pt.disabled,Xt=pt.defaultChecked,Ct=Xt===void 0?!1:Xt,q=pt.type,Et=q===void 0?"checkbox":q,Bt=pt.title,ve=pt.onChange,Vt=(0,ut.Z)(pt,yt),We=(0,rt.useRef)(null),ee=(0,Q.Z)(Ct,{value:De}),xe=(0,le.Z)(ee,2),Nt=xe[0],_e=xe[1];(0,rt.useImperativeHandle)(Rt,function(){return{focus:function(){var Se;(Se=We.current)===null||Se===void 0||Se.focus()},blur:function(){var Se;(Se=We.current)===null||Se===void 0||Se.blur()},input:We.current}});var ti=Pt()(Jt,Ht,(Ce={},(0,vt.Z)(Ce,"".concat(Jt,"-checked"),Nt),(0,vt.Z)(Ce,"".concat(Jt,"-disabled"),$t),Ce)),je=function(Se){$t||("checked"in pt||_e(Se.target.checked),ve==null||ve({target:(0,kt.Z)((0,kt.Z)({},pt),{},{type:Et,checked:Se.target.checked}),stopPropagation:function(){Se.stopPropagation()},preventDefault:function(){Se.preventDefault()},nativeEvent:Se.nativeEvent}))};return rt.createElement("span",{className:ti,title:Bt,style:de},rt.createElement("input",(0,Mt.Z)({},Vt,{className:"".concat(Jt,"-input"),ref:We,onChange:je,disabled:$t,checked:!!Nt,type:Et})),rt.createElement("span",{className:"".concat(Jt,"-inner")}))});Li.Z=be},31561:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Et}});var Mt=G(32855),kt=G(74430),vt=G(11913),le=G(43079),ut=G(35593),ft=G(92310),Pt=G.n(ft),Q=G(8654),rt=G(59301),yt=G(10228),be=G(16089),pt=yt.Z.ESC,Rt=yt.Z.TAB;function Ce(Bt){var ve=Bt.visible,Vt=Bt.triggerRef,We=Bt.onVisibleChange,ee=Bt.autoFocus,xe=Bt.overlayRef,Nt=rt.useRef(!1),_e=function(){if(ve){var Se,dt;(Se=Vt.current)===null||Se===void 0||(dt=Se.focus)===null||dt===void 0||dt.call(Se),We==null||We(!1)}},ti=function(){var Se;return(Se=xe.current)!==null&&Se!==void 0&&Se.focus?(xe.current.focus(),Nt.current=!0,!0):!1},je=function(Se){switch(Se.keyCode){case pt:_e();break;case Rt:{var dt=!1;Nt.current||(dt=ti()),dt?Se.preventDefault():_e();break}}};rt.useEffect(function(){return ve?(window.addEventListener("keydown",je),ee&&(0,be.Z)(ti,3),function(){window.removeEventListener("keydown",je),Nt.current=!1}):function(){Nt.current=!1}},[ve])}var jt=(0,rt.forwardRef)(function(Bt,ve){var Vt=Bt.overlay,We=Bt.arrow,ee=Bt.prefixCls,xe=(0,rt.useMemo)(function(){var _e;return typeof Vt=="function"?_e=Vt():_e=Vt,_e},[Vt]),Nt=(0,Q.sQ)(ve,xe==null?void 0:xe.ref);return rt.createElement(rt.Fragment,null,We&&rt.createElement("div",{className:"".concat(ee,"-arrow")}),rt.cloneElement(xe,{ref:(0,Q.Yr)(xe)?Nt:void 0}))}),Jt=jt,Ht={adjustX:1,adjustY:1},de=[0,0],De={topLeft:{points:["bl","tl"],overflow:Ht,offset:[0,-4],targetOffset:de},top:{points:["bc","tc"],overflow:Ht,offset:[0,-4],targetOffset:de},topRight:{points:["br","tr"],overflow:Ht,offset:[0,-4],targetOffset:de},bottomLeft:{points:["tl","bl"],overflow:Ht,offset:[0,4],targetOffset:de},bottom:{points:["tc","bc"],overflow:Ht,offset:[0,4],targetOffset:de},bottomRight:{points:["tr","br"],overflow:Ht,offset:[0,4],targetOffset:de}},$t=De,Xt=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function Ct(Bt,ve){var Vt,We=Bt.arrow,ee=We===void 0?!1:We,xe=Bt.prefixCls,Nt=xe===void 0?"rc-dropdown":xe,_e=Bt.transitionName,ti=Bt.animation,je=Bt.align,Be=Bt.placement,Se=Be===void 0?"bottomLeft":Be,dt=Bt.placements,W=dt===void 0?$t:dt,Zt=Bt.getPopupContainer,ze=Bt.showAction,Me=Bt.hideAction,ye=Bt.overlayClassName,se=Bt.overlayStyle,Ue=Bt.visible,Fi=Bt.trigger,wi=Fi===void 0?["hover"]:Fi,Ai=Bt.autoFocus,ri=Bt.overlay,sn=Bt.children,Zi=Bt.onVisibleChange,j=(0,le.Z)(Bt,Xt),P=rt.useState(),E=(0,vt.Z)(P,2),B=E[0],U=E[1],D="visible"in Bt?Ue:B,St=rt.useRef(null),ae=rt.useRef(null),$e=rt.useRef(null);rt.useImperativeHandle(ve,function(){return St.current});var Ae=function(Ft){U(Ft),Zi==null||Zi(Ft)};Ce({visible:D,triggerRef:$e,onVisibleChange:Ae,autoFocus:Ai,overlayRef:ae});var Qe=function(Ft){var oe=Bt.onOverlayClick;U(!1),oe&&oe(Ft)},He=function(){return rt.createElement(Jt,{ref:ae,overlay:ri,prefixCls:Nt,arrow:ee})},Si=function(){return typeof ri=="function"?He:He()},Ei=function(){var Ft=Bt.minOverlayWidthMatchTrigger,oe=Bt.alignPoint;return"minOverlayWidthMatchTrigger"in Bt?Ft:!oe},Ci=function(){var Ft=Bt.openClassName;return Ft!==void 0?Ft:"".concat(Nt,"-open")},qt=rt.cloneElement(sn,{className:Pt()((Vt=sn.props)===null||Vt===void 0?void 0:Vt.className,D&&Ci()),ref:(0,Q.Yr)(sn)?(0,Q.sQ)($e,sn.ref):void 0}),ei=Me;return!ei&&wi.indexOf("contextMenu")!==-1&&(ei=["click"]),rt.createElement(ut.Z,(0,Mt.Z)({builtinPlacements:W},j,{prefixCls:Nt,ref:St,popupClassName:Pt()(ye,(0,kt.Z)({},"".concat(Nt,"-show-arrow"),ee)),popupStyle:se,action:wi,showAction:ze,hideAction:ei,popupPlacement:Se,popupAlign:je,popupTransitionName:_e,popupAnimation:ti,popupVisible:D,stretch:Ei()?"minWidth":"",popup:Si(),onPopupVisibleChange:Ae,onPopupClick:Qe,getPopupContainer:Zt}),qt)}var q=rt.forwardRef(Ct),Et=q},93681:function(qn,Li,G){"use strict";G.r(Li),G.d(Li,{BaseInput:function(){return yt},default:function(){return De}});var Mt=G(32855),kt=G(27247),vt=G(74430),le=G(34666),ut=G(92310),ft=G.n(ut),Pt=G(59301),Q=G(5643),rt=function(Xt){var Ct,q,Et=Xt.inputElement,Bt=Xt.prefixCls,ve=Xt.prefix,Vt=Xt.suffix,We=Xt.addonBefore,ee=Xt.addonAfter,xe=Xt.className,Nt=Xt.style,_e=Xt.disabled,ti=Xt.readOnly,je=Xt.focused,Be=Xt.triggerFocus,Se=Xt.allowClear,dt=Xt.value,W=Xt.handleReset,Zt=Xt.hidden,ze=Xt.classes,Me=Xt.classNames,ye=Xt.dataAttrs,se=Xt.styles,Ue=Xt.components,Fi=(Ue==null?void 0:Ue.affixWrapper)||"span",wi=(Ue==null?void 0:Ue.groupWrapper)||"span",Ai=(Ue==null?void 0:Ue.wrapper)||"span",ri=(Ue==null?void 0:Ue.groupAddon)||"span",sn=(0,Pt.useRef)(null),Zi=function(He){var Si;(Si=sn.current)!==null&&Si!==void 0&&Si.contains(He.target)&&(Be==null||Be())},j=function(){var He;if(!Se)return null;var Si=!_e&&!ti&&dt,Ei="".concat(Bt,"-clear-icon"),Ci=(0,le.Z)(Se)==="object"&&Se!==null&&Se!==void 0&&Se.clearIcon?Se.clearIcon:"\u2716";return Pt.createElement("span",{onClick:W,onMouseDown:function(ei){return ei.preventDefault()},className:ft()(Ei,(He={},(0,vt.Z)(He,"".concat(Ei,"-hidden"),!Si),(0,vt.Z)(He,"".concat(Ei,"-has-suffix"),!!Vt),He)),role:"button",tabIndex:-1},Ci)},P=(0,Pt.cloneElement)(Et,{value:dt,hidden:Zt,className:ft()((Ct=Et.props)===null||Ct===void 0?void 0:Ct.className,!(0,Q.X3)(Xt)&&!(0,Q.He)(Xt)&&xe)||null,style:(0,kt.Z)((0,kt.Z)({},(q=Et.props)===null||q===void 0?void 0:q.style),!(0,Q.X3)(Xt)&&!(0,Q.He)(Xt)?Nt:{})});if((0,Q.X3)(Xt)){var E,B="".concat(Bt,"-affix-wrapper"),U=ft()(B,(E={},(0,vt.Z)(E,"".concat(B,"-disabled"),_e),(0,vt.Z)(E,"".concat(B,"-focused"),je),(0,vt.Z)(E,"".concat(B,"-readonly"),ti),(0,vt.Z)(E,"".concat(B,"-input-with-clear-btn"),Vt&&Se&&dt),E),!(0,Q.He)(Xt)&&xe,ze==null?void 0:ze.affixWrapper,Me==null?void 0:Me.affixWrapper),D=(Vt||Se)&&Pt.createElement("span",{className:ft()("".concat(Bt,"-suffix"),Me==null?void 0:Me.suffix),style:se==null?void 0:se.suffix},j(),Vt);P=Pt.createElement(Fi,(0,Mt.Z)({className:U,style:(0,kt.Z)((0,kt.Z)({},(0,Q.He)(Xt)?void 0:Nt),se==null?void 0:se.affixWrapper),hidden:!(0,Q.He)(Xt)&&Zt,onClick:Zi},ye==null?void 0:ye.affixWrapper,{ref:sn}),ve&&Pt.createElement("span",{className:ft()("".concat(Bt,"-prefix"),Me==null?void 0:Me.prefix),style:se==null?void 0:se.prefix},ve),(0,Pt.cloneElement)(Et,{value:dt,hidden:null}),D)}if((0,Q.He)(Xt)){var St="".concat(Bt,"-group"),ae="".concat(St,"-addon"),$e=ft()("".concat(Bt,"-wrapper"),St,ze==null?void 0:ze.wrapper),Ae=ft()("".concat(Bt,"-group-wrapper"),xe,ze==null?void 0:ze.group);return Pt.createElement(wi,{className:Ae,style:Nt,hidden:Zt},Pt.createElement(Ai,{className:$e},We&&Pt.createElement(ri,{className:ae},We),(0,Pt.cloneElement)(P,{hidden:null}),ee&&Pt.createElement(ri,{className:ae},ee)))}return P},yt=rt,be=G(3300),pt=G(11913),Rt=G(43079),Ce=G(18929),jt=G(2738),Jt=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","type","classes","classNames","styles"],Ht=(0,Pt.forwardRef)(function($t,Xt){var Ct=$t.autoComplete,q=$t.onChange,Et=$t.onFocus,Bt=$t.onBlur,ve=$t.onPressEnter,Vt=$t.onKeyDown,We=$t.prefixCls,ee=We===void 0?"rc-input":We,xe=$t.disabled,Nt=$t.htmlSize,_e=$t.className,ti=$t.maxLength,je=$t.suffix,Be=$t.showCount,Se=$t.type,dt=Se===void 0?"text":Se,W=$t.classes,Zt=$t.classNames,ze=$t.styles,Me=(0,Rt.Z)($t,Jt),ye=(0,Ce.Z)($t.defaultValue,{value:$t.value}),se=(0,pt.Z)(ye,2),Ue=se[0],Fi=se[1],wi=(0,Pt.useState)(!1),Ai=(0,pt.Z)(wi,2),ri=Ai[0],sn=Ai[1],Zi=(0,Pt.useRef)(null),j=function(Ae){Zi.current&&(0,Q.nH)(Zi.current,Ae)};(0,Pt.useImperativeHandle)(Xt,function(){return{focus:j,blur:function(){var Ae;(Ae=Zi.current)===null||Ae===void 0||Ae.blur()},setSelectionRange:function(Ae,Qe,He){var Si;(Si=Zi.current)===null||Si===void 0||Si.setSelectionRange(Ae,Qe,He)},select:function(){var Ae;(Ae=Zi.current)===null||Ae===void 0||Ae.select()},input:Zi.current}}),(0,Pt.useEffect)(function(){sn(function($e){return $e&&xe?!1:$e})},[xe]);var P=function(Ae){$t.value===void 0&&Fi(Ae.target.value),Zi.current&&(0,Q.rJ)(Zi.current,Ae,q)},E=function(Ae){ve&&Ae.key==="Enter"&&ve(Ae),Vt==null||Vt(Ae)},B=function(Ae){sn(!0),Et==null||Et(Ae)},U=function(Ae){sn(!1),Bt==null||Bt(Ae)},D=function(Ae){Fi(""),j(),Zi.current&&(0,Q.rJ)(Zi.current,Ae,q)},St=function(){var Ae=(0,jt.Z)($t,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","classes","htmlSize","styles","classNames"]);return Pt.createElement("input",(0,Mt.Z)({autoComplete:Ct},Ae,{onChange:P,onFocus:B,onBlur:U,onKeyDown:E,className:ft()(ee,(0,vt.Z)({},"".concat(ee,"-disabled"),xe),Zt==null?void 0:Zt.input),style:ze==null?void 0:ze.input,ref:Zi,size:Nt,type:dt}))},ae=function(){var Ae=Number(ti)>0;if(je||Be){var Qe=(0,Q.D7)(Ue),He=(0,be.Z)(Qe).length,Si=(0,le.Z)(Be)==="object"?Be.formatter({value:Qe,count:He,maxLength:ti}):"".concat(He).concat(Ae?" / ".concat(ti):"");return Pt.createElement(Pt.Fragment,null,!!Be&&Pt.createElement("span",{className:ft()("".concat(ee,"-show-count-suffix"),(0,vt.Z)({},"".concat(ee,"-show-count-has-suffix"),!!je),Zt==null?void 0:Zt.count),style:(0,kt.Z)({},ze==null?void 0:ze.count)},Si),je)}return null};return Pt.createElement(yt,(0,Mt.Z)({},Me,{prefixCls:ee,className:_e,inputElement:St(),handleReset:D,value:(0,Q.D7)(Ue),focused:ri,triggerFocus:j,suffix:ae(),disabled:xe,classes:W,classNames:Zt,styles:ze}))}),de=Ht,De=de},5643:function(qn,Li,G){"use strict";G.d(Li,{D7:function(){return ut},He:function(){return Mt},X3:function(){return kt},nH:function(){return le},rJ:function(){return vt}});function Mt(ft){return!!(ft.addonBefore||ft.addonAfter)}function kt(ft){return!!(ft.prefix||ft.suffix||ft.allowClear)}function vt(ft,Pt,Q,rt){if(Q){var yt=Pt;if(Pt.type==="click"){var be=ft.cloneNode(!0);yt=Object.create(Pt,{target:{value:be},currentTarget:{value:be}}),be.value="",Q(yt);return}if(rt!==void 0){yt=Object.create(Pt,{target:{value:ft},currentTarget:{value:ft}}),ft.value=rt,Q(yt);return}Q(yt)}}function le(ft,Pt){if(ft){ft.focus(Pt);var Q=Pt||{},rt=Q.cursor;if(rt){var yt=ft.value.length;switch(rt){case"start":ft.setSelectionRange(0,0);break;case"end":ft.setSelectionRange(yt,yt);break;default:ft.setSelectionRange(0,yt)}}}}function ut(ft){return typeof ft=="undefined"||ft===null?"":String(ft)}},15285:function(qn,Li,G){"use strict";G.d(Li,{iz:function(){return Fe},ck:function(){return Er},BW:function(){return me},sN:function(){return Er},Wd:function(){return Ot},ZP:function(){return ni},Xl:function(){return Vt}});var Mt=G(32855),kt=G(74430),vt=G(27247),le=G(3300),ut=G(11913),ft=G(43079),Pt=G(92310),Q=G.n(Pt),rt=G(11780),yt=G(18929),be=G(13697),pt=G(48736),Rt=G(59301),Ce=G(4676),jt=Rt.createContext(null);function Jt(Ut,Wt){return Ut===void 0?null:"".concat(Ut,"-").concat(Wt)}function Ht(Ut){var Wt=Rt.useContext(jt);return Jt(Wt,Ut)}var de=G(80547),De=["children","locked"],$t=Rt.createContext(null);function Xt(Ut,Wt){var Dt=(0,vt.Z)({},Ut);return Object.keys(Wt).forEach(function(ke){var re=Wt[ke];re!==void 0&&(Dt[ke]=re)}),Dt}function Ct(Ut){var Wt=Ut.children,Dt=Ut.locked,ke=(0,ft.Z)(Ut,De),re=Rt.useContext($t),Ie=(0,de.Z)(function(){return Xt(re,ke)},[re,ke],function(mt,Xe){return!Dt&&(mt[0]!==Xe[0]||!(0,be.Z)(mt[1],Xe[1],!0))});return Rt.createElement($t.Provider,{value:Ie},Wt)}var q=[],Et=Rt.createContext(null);function Bt(){return Rt.useContext(Et)}var ve=Rt.createContext(q);function Vt(Ut){var Wt=Rt.useContext(ve);return Rt.useMemo(function(){return Ut!==void 0?[].concat((0,le.Z)(Wt),[Ut]):Wt},[Wt,Ut])}var We=Rt.createContext(null),ee=Rt.createContext({}),xe=ee,Nt=G(29194);function _e(Ut){var Wt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,Nt.Z)(Ut)){var Dt=Ut.nodeName.toLowerCase(),ke=["input","select","textarea","button"].includes(Dt)||Ut.isContentEditable||Dt==="a"&&!!Ut.getAttribute("href"),re=Ut.getAttribute("tabindex"),Ie=Number(re),mt=null;return re&&!Number.isNaN(Ie)?mt=Ie:ke&&mt===null&&(mt=0),ke&&Ut.disabled&&(mt=null),mt!==null&&(mt>=0||Wt&&mt<0)}return!1}function ti(Ut){var Wt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Dt=(0,le.Z)(Ut.querySelectorAll("*")).filter(function(ke){return _e(ke,Wt)});return _e(Ut,Wt)&&Dt.unshift(Ut),Dt}var je=null;function Be(){je=document.activeElement}function Se(){je=null}function dt(){if(je)try{je.focus()}catch(Ut){}}function W(Ut,Wt){if(Wt.keyCode===9){var Dt=ti(Ut),ke=Dt[Wt.shiftKey?0:Dt.length-1],re=ke===document.activeElement||Ut===document.activeElement;if(re){var Ie=Dt[Wt.shiftKey?Dt.length-1:0];Ie.focus(),Wt.preventDefault()}}}var Zt=G(10228),ze=G(16089),Me=Zt.Z.LEFT,ye=Zt.Z.RIGHT,se=Zt.Z.UP,Ue=Zt.Z.DOWN,Fi=Zt.Z.ENTER,wi=Zt.Z.ESC,Ai=Zt.Z.HOME,ri=Zt.Z.END,sn=[se,Ue,Me,ye];function Zi(Ut,Wt,Dt,ke){var re,Ie,mt,Xe,pi="prev",ci="next",Ui="children",Ni="parent";if(Ut==="inline"&&ke===Fi)return{inlineTrigger:!0};var Gi=(re={},(0,kt.Z)(re,se,pi),(0,kt.Z)(re,Ue,ci),re),ki=(Ie={},(0,kt.Z)(Ie,Me,Dt?ci:pi),(0,kt.Z)(Ie,ye,Dt?pi:ci),(0,kt.Z)(Ie,Ue,Ui),(0,kt.Z)(Ie,Fi,Ui),Ie),di=(mt={},(0,kt.Z)(mt,se,pi),(0,kt.Z)(mt,Ue,ci),(0,kt.Z)(mt,Fi,Ui),(0,kt.Z)(mt,wi,Ni),(0,kt.Z)(mt,Me,Dt?Ui:Ni),(0,kt.Z)(mt,ye,Dt?Ni:Ui),mt),Ki={inline:Gi,horizontal:ki,vertical:di,inlineSub:Gi,horizontalSub:di,verticalSub:di},Kt=(Xe=Ki["".concat(Ut).concat(Wt?"":"Sub")])===null||Xe===void 0?void 0:Xe[ke];switch(Kt){case pi:return{offset:-1,sibling:!0};case ci:return{offset:1,sibling:!0};case Ni:return{offset:-1,sibling:!1};case Ui:return{offset:1,sibling:!1};default:return null}}function j(Ut){for(var Wt=Ut;Wt;){if(Wt.getAttribute("data-menu-list"))return Wt;Wt=Wt.parentElement}return null}function P(Ut,Wt){for(var Dt=Ut||document.activeElement;Dt;){if(Wt.has(Dt))return Dt;Dt=Dt.parentElement}return null}function E(Ut,Wt){var Dt=ti(Ut,!0);return Dt.filter(function(ke){return Wt.has(ke)})}function B(Ut,Wt,Dt){var ke=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Ut)return null;var re=E(Ut,Wt),Ie=re.length,mt=re.findIndex(function(Xe){return Dt===Xe});return ke<0?mt===-1?mt=Ie-1:mt-=1:ke>0&&(mt+=1),mt=(mt+Ie)%Ie,re[mt]}var U=function(Wt,Dt){var ke=new Set,re=new Map,Ie=new Map;return Wt.forEach(function(mt){var Xe=document.querySelector("[data-menu-id='".concat(Jt(Dt,mt),"']"));Xe&&(ke.add(Xe),Ie.set(Xe,mt),re.set(mt,Xe))}),{elements:ke,key2element:re,element2key:Ie}};function D(Ut,Wt,Dt,ke,re,Ie,mt,Xe,pi,ci){var Ui=Rt.useRef(),Ni=Rt.useRef();Ni.current=Wt;var Gi=function(){ze.Z.cancel(Ui.current)};return Rt.useEffect(function(){return function(){Gi()}},[]),function(ki){var di=ki.which;if([].concat(sn,[Fi,wi,Ai,ri]).includes(di)){var Ki=Ie(),Kt=U(Ki,ke),Ri=Kt,At=Ri.elements,vi=Ri.key2element,Qi=Ri.element2key,Ti=vi.get(Wt),gn=P(Ti,At),Mn=Qi.get(gn),mi=Zi(Ut,mt(Mn,!0).length===1,Dt,di);if(!mi&&di!==Ai&&di!==ri)return;(sn.includes(di)||[Ai,ri].includes(di))&&ki.preventDefault();var Ye=function(Kn){if(Kn){var Ar=Kn,tn=Kn.querySelector("a");tn!=null&&tn.getAttribute("href")&&(Ar=tn);var Hi=Qi.get(Kn);Xe(Hi),Gi(),Ui.current=(0,ze.Z)(function(){Ni.current===Hi&&Ar.focus()})}};if([Ai,ri].includes(di)||mi.sibling||!gn){var Je;!gn||Ut==="inline"?Je=re.current:Je=j(gn);var Oi,pe=E(Je,At);di===Ai?Oi=pe[0]:di===ri?Oi=pe[pe.length-1]:Oi=B(Je,At,gn,mi.offset),Ye(Oi)}else if(mi.inlineTrigger)pi(Mn);else if(mi.offset>0)pi(Mn,!0),Gi(),Ui.current=(0,ze.Z)(function(){Kt=U(Ki,ke);var Qn=gn.getAttribute("aria-controls"),Kn=document.getElementById(Qn),Ar=B(Kn,Kt.elements);Ye(Ar)},5);else if(mi.offset<0){var z=mt(Mn,!0),fn=z[z.length-2],vn=vi.get(fn);pi(fn,!1),Ye(vn)}}ci==null||ci(ki)}}function St(Ut){Promise.resolve().then(Ut)}var ae="__RC_UTIL_PATH_SPLIT__",$e=function(Wt){return Wt.join(ae)},Ae=function(Wt){return Wt.split(ae)},Qe="rc-menu-more";function He(){var Ut=Rt.useState({}),Wt=(0,ut.Z)(Ut,2),Dt=Wt[1],ke=(0,Rt.useRef)(new Map),re=(0,Rt.useRef)(new Map),Ie=Rt.useState([]),mt=(0,ut.Z)(Ie,2),Xe=mt[0],pi=mt[1],ci=(0,Rt.useRef)(0),Ui=(0,Rt.useRef)(!1),Ni=function(){Ui.current||Dt({})},Gi=(0,Rt.useCallback)(function(vi,Qi){var Ti=$e(Qi);re.current.set(Ti,vi),ke.current.set(vi,Ti),ci.current+=1;var gn=ci.current;St(function(){gn===ci.current&&Ni()})},[]),ki=(0,Rt.useCallback)(function(vi,Qi){var Ti=$e(Qi);re.current.delete(Ti),ke.current.delete(vi)},[]),di=(0,Rt.useCallback)(function(vi){pi(vi)},[]),Ki=(0,Rt.useCallback)(function(vi,Qi){var Ti=ke.current.get(vi)||"",gn=Ae(Ti);return Qi&&Xe.includes(gn[0])&&gn.unshift(Qe),gn},[Xe]),Kt=(0,Rt.useCallback)(function(vi,Qi){return vi.some(function(Ti){var gn=Ki(Ti,!0);return gn.includes(Qi)})},[Ki]),Ri=function(){var Qi=(0,le.Z)(ke.current.keys());return Xe.length&&Qi.push(Qe),Qi},At=(0,Rt.useCallback)(function(vi){var Qi="".concat(ke.current.get(vi)).concat(ae),Ti=new Set;return(0,le.Z)(re.current.keys()).forEach(function(gn){gn.startsWith(Qi)&&Ti.add(re.current.get(gn))}),Ti},[]);return Rt.useEffect(function(){return function(){Ui.current=!0}},[]),{registerPath:Gi,unregisterPath:ki,refreshOverflowKeys:di,isSubPathKey:Kt,getKeyPath:Ki,getKeys:Ri,getSubPathKeys:At}}function Si(Ut){var Wt=Rt.useRef(Ut);Wt.current=Ut;var Dt=Rt.useCallback(function(){for(var ke,re=arguments.length,Ie=new Array(re),mt=0;mt<re;mt++)Ie[mt]=arguments[mt];return(ke=Wt.current)===null||ke===void 0?void 0:ke.call.apply(ke,[Wt].concat(Ie))},[]);return Ut?Dt:void 0}var Ei=Math.random().toFixed(5).toString().slice(2),Ci=0;function qt(Ut){var Wt=(0,yt.Z)(Ut,{value:Ut}),Dt=(0,ut.Z)(Wt,2),ke=Dt[0],re=Dt[1];return Rt.useEffect(function(){Ci+=1;var Ie="".concat(Ei,"-").concat(Ci);re("rc-menu-uuid-".concat(Ie))},[]),ke}var ei=G(33377),ln=G(93912),Ft=G(18881),oe=G(85461),we=G(2738),Ii=G(8654);function Pi(Ut,Wt,Dt,ke){var re=Rt.useContext($t),Ie=re.activeKey,mt=re.onActive,Xe=re.onInactive,pi={active:Ie===Ut};return Wt||(pi.onMouseEnter=function(ci){Dt==null||Dt({key:Ut,domEvent:ci}),mt(Ut)},pi.onMouseLeave=function(ci){ke==null||ke({key:Ut,domEvent:ci}),Xe(Ut)}),pi}function _i(Ut){var Wt=Rt.useContext($t),Dt=Wt.mode,ke=Wt.rtl,re=Wt.inlineIndent;if(Dt!=="inline")return null;var Ie=Ut;return ke?{paddingRight:Ie*re}:{paddingLeft:Ie*re}}function hn(Ut){var Wt=Ut.icon,Dt=Ut.props,ke=Ut.children,re;return Wt===null||Wt===!1?null:(typeof Wt=="function"?re=Rt.createElement(Wt,(0,vt.Z)({},Dt)):typeof Wt!="boolean"&&(re=Wt),re||ke||null)}var mn=["item"];function Ln(Ut){var Wt=Ut.item,Dt=(0,ft.Z)(Ut,mn);return Object.defineProperty(Dt,"item",{get:function(){return(0,pt.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),Wt}}),Dt}var jn=["title","attribute","elementRef"],On=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],rn=["active"],ir=function(Ut){(0,Ft.Z)(Dt,Ut);var Wt=(0,oe.Z)(Dt);function Dt(){return(0,ei.Z)(this,Dt),Wt.apply(this,arguments)}return(0,ln.Z)(Dt,[{key:"render",value:function(){var re=this.props,Ie=re.title,mt=re.attribute,Xe=re.elementRef,pi=(0,ft.Z)(re,jn),ci=(0,we.Z)(pi,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,pt.ZP)(!mt,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),Rt.createElement(rt.Z.Item,(0,Mt.Z)({},mt,{title:typeof Ie=="string"?Ie:void 0},ci,{ref:Xe}))}}]),Dt}(Rt.Component),tr=Rt.forwardRef(function(Ut,Wt){var Dt,ke=Ut.style,re=Ut.className,Ie=Ut.eventKey,mt=Ut.warnKey,Xe=Ut.disabled,pi=Ut.itemIcon,ci=Ut.children,Ui=Ut.role,Ni=Ut.onMouseEnter,Gi=Ut.onMouseLeave,ki=Ut.onClick,di=Ut.onKeyDown,Ki=Ut.onFocus,Kt=(0,ft.Z)(Ut,On),Ri=Ht(Ie),At=Rt.useContext($t),vi=At.prefixCls,Qi=At.onItemClick,Ti=At.disabled,gn=At.overflowDisabled,Mn=At.itemIcon,mi=At.selectedKeys,Ye=At.onActive,Je=Rt.useContext(xe),Oi=Je._internalRenderMenuItem,pe="".concat(vi,"-item"),z=Rt.useRef(),fn=Rt.useRef(),vn=Ti||Xe,Qn=(0,Ii.x1)(Wt,fn),Kn=Vt(Ie),Ar=function(br){return{key:Ie,keyPath:(0,le.Z)(Kn).reverse(),item:z.current,domEvent:br}},tn=pi||Mn,Hi=Pi(Ie,vn,Ni,Gi),Sn=Hi.active,Ji=(0,ft.Z)(Hi,rn),Fn=mi.includes(Ie),Xr=_i(Kn.length),no=function(br){if(!vn){var po=Ar(br);ki==null||ki(Ln(po)),Qi(po)}},Jn=function(br){if(di==null||di(br),br.which===Zt.Z.ENTER){var po=Ar(br);ki==null||ki(Ln(po)),Qi(po)}},ii=function(br){Ye(Ie),Ki==null||Ki(br)},xr={};Ut.role==="option"&&(xr["aria-selected"]=Fn);var wr=Rt.createElement(ir,(0,Mt.Z)({ref:z,elementRef:Qn,role:Ui===null?"none":Ui||"menuitem",tabIndex:Xe?null:-1,"data-menu-id":gn&&Ri?null:Ri},Kt,Ji,xr,{component:"li","aria-disabled":Xe,style:(0,vt.Z)((0,vt.Z)({},Xr),ke),className:Q()(pe,(Dt={},(0,kt.Z)(Dt,"".concat(pe,"-active"),Sn),(0,kt.Z)(Dt,"".concat(pe,"-selected"),Fn),(0,kt.Z)(Dt,"".concat(pe,"-disabled"),vn),Dt),re),onClick:no,onKeyDown:Jn,onFocus:ii}),ci,Rt.createElement(hn,{props:(0,vt.Z)((0,vt.Z)({},Ut),{},{isSelected:Fn}),icon:tn}));return Oi&&(wr=Oi(wr,Ut,{selected:Fn})),wr});function hr(Ut,Wt){var Dt=Ut.eventKey,ke=Bt(),re=Vt(Dt);return Rt.useEffect(function(){if(ke)return ke.registerPath(Dt,re),function(){ke.unregisterPath(Dt,re)}},[re]),ke?null:Rt.createElement(tr,(0,Mt.Z)({},Ut,{ref:Wt}))}var Er=Rt.forwardRef(hr),Hn=["className","children"],Ir=function(Wt,Dt){var ke=Wt.className,re=Wt.children,Ie=(0,ft.Z)(Wt,Hn),mt=Rt.useContext($t),Xe=mt.prefixCls,pi=mt.mode,ci=mt.rtl;return Rt.createElement("ul",(0,Mt.Z)({className:Q()(Xe,ci&&"".concat(Xe,"-rtl"),"".concat(Xe,"-sub"),"".concat(Xe,"-").concat(pi==="inline"?"inline":"vertical"),ke),role:"menu"},Ie,{"data-menu-list":!0,ref:Dt}),re)},T=Rt.forwardRef(Ir);T.displayName="SubMenuList";var ur=T,$n=G(11592);function Yn(Ut,Wt){return(0,$n.Z)(Ut).map(function(Dt,ke){if(Rt.isValidElement(Dt)){var re,Ie,mt=Dt.key,Xe=(re=(Ie=Dt.props)===null||Ie===void 0?void 0:Ie.eventKey)!==null&&re!==void 0?re:mt,pi=Xe==null;pi&&(Xe="tmp_key-".concat([].concat((0,le.Z)(Wt),[ke]).join("-")));var ci={key:Xe,eventKey:Xe};return Rt.cloneElement(Dt,ci)}return Dt})}var Nr=G(35593),Gn={adjustX:1,adjustY:1},uo={topLeft:{points:["bl","tl"],overflow:Gn},topRight:{points:["br","tr"],overflow:Gn},bottomLeft:{points:["tl","bl"],overflow:Gn},bottomRight:{points:["tr","br"],overflow:Gn},leftTop:{points:["tr","tl"],overflow:Gn},leftBottom:{points:["br","bl"],overflow:Gn},rightTop:{points:["tl","tr"],overflow:Gn},rightBottom:{points:["bl","br"],overflow:Gn}},zo={topLeft:{points:["bl","tl"],overflow:Gn},topRight:{points:["br","tr"],overflow:Gn},bottomLeft:{points:["tl","bl"],overflow:Gn},bottomRight:{points:["tr","br"],overflow:Gn},rightTop:{points:["tr","tl"],overflow:Gn},rightBottom:{points:["br","bl"],overflow:Gn},leftTop:{points:["tl","tr"],overflow:Gn},leftBottom:{points:["bl","br"],overflow:Gn}},gr=null;function pn(Ut,Wt,Dt){if(Wt)return Wt;if(Dt)return Dt[Ut]||Dt.other}var gi={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function ct(Ut){var Wt=Ut.prefixCls,Dt=Ut.visible,ke=Ut.children,re=Ut.popup,Ie=Ut.popupStyle,mt=Ut.popupClassName,Xe=Ut.popupOffset,pi=Ut.disabled,ci=Ut.mode,Ui=Ut.onVisibleChange,Ni=Rt.useContext($t),Gi=Ni.getPopupContainer,ki=Ni.rtl,di=Ni.subMenuOpenDelay,Ki=Ni.subMenuCloseDelay,Kt=Ni.builtinPlacements,Ri=Ni.triggerSubMenuAction,At=Ni.forceSubMenuRender,vi=Ni.rootClassName,Qi=Ni.motion,Ti=Ni.defaultMotions,gn=Rt.useState(!1),Mn=(0,ut.Z)(gn,2),mi=Mn[0],Ye=Mn[1],Je=ki?(0,vt.Z)((0,vt.Z)({},zo),Kt):(0,vt.Z)((0,vt.Z)({},uo),Kt),Oi=gi[ci],pe=pn(ci,Qi,Ti),z=Rt.useRef(pe);ci!=="inline"&&(z.current=pe);var fn=(0,vt.Z)((0,vt.Z)({},z.current),{},{leavedClassName:"".concat(Wt,"-hidden"),removeOnLeave:!1,motionAppear:!0}),vn=Rt.useRef();return Rt.useEffect(function(){return vn.current=(0,ze.Z)(function(){Ye(Dt)}),function(){ze.Z.cancel(vn.current)}},[Dt]),Rt.createElement(Nr.Z,{prefixCls:Wt,popupClassName:Q()("".concat(Wt,"-popup"),(0,kt.Z)({},"".concat(Wt,"-rtl"),ki),mt,vi),stretch:ci==="horizontal"?"minWidth":null,getPopupContainer:Gi,builtinPlacements:Je,popupPlacement:Oi,popupVisible:mi,popup:re,popupStyle:Ie,popupAlign:Xe&&{offset:Xe},action:pi?[]:[Ri],mouseEnterDelay:di,mouseLeaveDelay:Ki,onPopupVisibleChange:Ui,forceRender:At,popupMotion:fn,fresh:!0},ke)}var J=G(77900);function ot(Ut){var Wt=Ut.id,Dt=Ut.open,ke=Ut.keyPath,re=Ut.children,Ie="inline",mt=Rt.useContext($t),Xe=mt.prefixCls,pi=mt.forceSubMenuRender,ci=mt.motion,Ui=mt.defaultMotions,Ni=mt.mode,Gi=Rt.useRef(!1);Gi.current=Ni===Ie;var ki=Rt.useState(!Gi.current),di=(0,ut.Z)(ki,2),Ki=di[0],Kt=di[1],Ri=Gi.current?Dt:!1;Rt.useEffect(function(){Gi.current&&Kt(!1)},[Ni]);var At=(0,vt.Z)({},pn(Ie,ci,Ui));ke.length>1&&(At.motionAppear=!1);var vi=At.onVisibleChanged;return At.onVisibleChanged=function(Qi){return!Gi.current&&!Qi&&Kt(!0),vi==null?void 0:vi(Qi)},Ki?null:Rt.createElement(Ct,{mode:Ie,locked:!Gi.current},Rt.createElement(J.default,(0,Mt.Z)({visible:Ri},At,{forceRender:pi,removeOnLeave:!1,leavedClassName:"".concat(Xe,"-hidden")}),function(Qi){var Ti=Qi.className,gn=Qi.style;return Rt.createElement(ur,{id:Wt,className:Ti,style:gn},re)}))}var nt=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],Z=["active"],xt=function(Wt){var Dt,ke=Wt.style,re=Wt.className,Ie=Wt.title,mt=Wt.eventKey,Xe=Wt.warnKey,pi=Wt.disabled,ci=Wt.internalPopupClose,Ui=Wt.children,Ni=Wt.itemIcon,Gi=Wt.expandIcon,ki=Wt.popupClassName,di=Wt.popupOffset,Ki=Wt.popupStyle,Kt=Wt.onClick,Ri=Wt.onMouseEnter,At=Wt.onMouseLeave,vi=Wt.onTitleClick,Qi=Wt.onTitleMouseEnter,Ti=Wt.onTitleMouseLeave,gn=(0,ft.Z)(Wt,nt),Mn=Ht(mt),mi=Rt.useContext($t),Ye=mi.prefixCls,Je=mi.mode,Oi=mi.openKeys,pe=mi.disabled,z=mi.overflowDisabled,fn=mi.activeKey,vn=mi.selectedKeys,Qn=mi.itemIcon,Kn=mi.expandIcon,Ar=mi.onItemClick,tn=mi.onOpenChange,Hi=mi.onActive,Sn=Rt.useContext(xe),Ji=Sn._internalRenderSubMenuItem,Fn=Rt.useContext(We),Xr=Fn.isSubPathKey,no=Vt(),Jn="".concat(Ye,"-submenu"),ii=pe||pi,xr=Rt.useRef(),wr=Rt.useRef(),ko=Ni!=null?Ni:Qn,br=Gi!=null?Gi:Kn,po=Oi.includes(mt),ds=!z&&po,Ps=Xr(vn,mt),xs=Pi(mt,ii,Qi,Ti),Ns=xs.active,ws=(0,ft.Z)(xs,Z),It=Rt.useState(!1),Lo=(0,ut.Z)(It,2),Va=Lo[0],Ia=Lo[1],Xs=function(Do){ii||Ia(Do)},Ao=function(Do){Xs(!0),Ri==null||Ri({key:mt,domEvent:Do})},al=function(Do){Xs(!1),At==null||At({key:mt,domEvent:Do})},oa=Rt.useMemo(function(){return Ns||(Je!=="inline"?Va||Xr([fn],mt):!1)},[Je,Ns,fn,Va,mt,Xr]),vr=_i(no.length),jr=function(Do){ii||(vi==null||vi({key:mt,domEvent:Do}),Je==="inline"&&tn(mt,!po))},ya=Si(function(Eo){Kt==null||Kt(Ln(Eo)),Ar(Eo)}),yn=function(Do){Je!=="inline"&&tn(mt,Do)},Xn=function(){Hi(mt)},Pn=Mn&&"".concat(Mn,"-popup"),ai=Rt.createElement("div",(0,Mt.Z)({role:"menuitem",style:vr,className:"".concat(Jn,"-title"),tabIndex:ii?null:-1,ref:xr,title:typeof Ie=="string"?Ie:null,"data-menu-id":z&&Mn?null:Mn,"aria-expanded":ds,"aria-haspopup":!0,"aria-controls":Pn,"aria-disabled":ii,onClick:jr,onFocus:Xn},ws),Ie,Rt.createElement(hn,{icon:Je!=="horizontal"?br:void 0,props:(0,vt.Z)((0,vt.Z)({},Wt),{},{isOpen:ds,isSubMenu:!0})},Rt.createElement("i",{className:"".concat(Jn,"-arrow")}))),cr=Rt.useRef(Je);if(Je!=="inline"&&no.length>1?cr.current="vertical":cr.current=Je,!z){var _r=cr.current;ai=Rt.createElement(ct,{mode:_r,prefixCls:Jn,visible:!ci&&ds&&Je!=="inline",popupClassName:ki,popupOffset:di,popupStyle:Ki,popup:Rt.createElement(Ct,{mode:_r==="horizontal"?"vertical":_r},Rt.createElement(ur,{id:Pn,ref:wr},Ui)),disabled:ii,onVisibleChange:yn},ai)}var ro=Rt.createElement(rt.Z.Item,(0,Mt.Z)({role:"none"},gn,{component:"li",style:ke,className:Q()(Jn,"".concat(Jn,"-").concat(Je),re,(Dt={},(0,kt.Z)(Dt,"".concat(Jn,"-open"),ds),(0,kt.Z)(Dt,"".concat(Jn,"-active"),oa),(0,kt.Z)(Dt,"".concat(Jn,"-selected"),Ps),(0,kt.Z)(Dt,"".concat(Jn,"-disabled"),ii),Dt)),onMouseEnter:Ao,onMouseLeave:al}),ai,!z&&Rt.createElement(ot,{id:Pn,open:ds,keyPath:no},Ui));return Ji&&(ro=Ji(ro,Wt,{selected:Ps,active:oa,open:ds,disabled:ii})),Rt.createElement(Ct,{onItemClick:ya,mode:Je==="horizontal"?"vertical":Je,itemIcon:ko,expandIcon:br},ro)};function Ot(Ut){var Wt=Ut.eventKey,Dt=Ut.children,ke=Vt(Wt),re=Yn(Dt,ke),Ie=Bt();Rt.useEffect(function(){if(Ie)return Ie.registerPath(Wt,ke),function(){Ie.unregisterPath(Wt,ke)}},[ke]);var mt;return Ie?mt=re:mt=Rt.createElement(xt,Ut,re),Rt.createElement(ve.Provider,{value:ke},mt)}var ge=G(34666),te=["className","title","eventKey","children"],lt=["children"],Qt=function(Wt){var Dt=Wt.className,ke=Wt.title,re=Wt.eventKey,Ie=Wt.children,mt=(0,ft.Z)(Wt,te),Xe=Rt.useContext($t),pi=Xe.prefixCls,ci="".concat(pi,"-item-group");return Rt.createElement("li",(0,Mt.Z)({role:"presentation"},mt,{onClick:function(Ni){return Ni.stopPropagation()},className:Q()(ci,Dt)}),Rt.createElement("div",{role:"presentation",className:"".concat(ci,"-title"),title:typeof ke=="string"?ke:void 0},ke),Rt.createElement("ul",{role:"group",className:"".concat(ci,"-list")},Ie))};function me(Ut){var Wt=Ut.children,Dt=(0,ft.Z)(Ut,lt),ke=Vt(Dt.eventKey),re=Yn(Wt,ke),Ie=Bt();return Ie?re:Rt.createElement(Qt,(0,we.Z)(Dt,["warnKey"]),re)}function Fe(Ut){var Wt=Ut.className,Dt=Ut.style,ke=Rt.useContext($t),re=ke.prefixCls,Ie=Bt();return Ie?null:Rt.createElement("li",{role:"separator",className:Q()("".concat(re,"-item-divider"),Wt),style:Dt})}var Tt=["label","children","key","type"];function ce(Ut){return(Ut||[]).map(function(Wt,Dt){if(Wt&&(0,ge.Z)(Wt)==="object"){var ke=Wt,re=ke.label,Ie=ke.children,mt=ke.key,Xe=ke.type,pi=(0,ft.Z)(ke,Tt),ci=mt!=null?mt:"tmp-".concat(Dt);return Ie||Xe==="group"?Xe==="group"?Rt.createElement(me,(0,Mt.Z)({key:ci},pi,{title:re}),ce(Ie)):Rt.createElement(Ot,(0,Mt.Z)({key:ci},pi,{title:re}),ce(Ie)):Xe==="divider"?Rt.createElement(Fe,(0,Mt.Z)({key:ci},pi)):Rt.createElement(Er,(0,Mt.Z)({key:ci},pi),re)}return null}).filter(function(Wt){return Wt})}function bi(Ut,Wt,Dt){var ke=Ut;return Wt&&(ke=ce(Wt)),Yn(ke,Dt)}var li=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem"],Mi=[],Pe=Rt.forwardRef(function(Ut,Wt){var Dt,ke,re=Ut,Ie=re.prefixCls,mt=Ie===void 0?"rc-menu":Ie,Xe=re.rootClassName,pi=re.style,ci=re.className,Ui=re.tabIndex,Ni=Ui===void 0?0:Ui,Gi=re.items,ki=re.children,di=re.direction,Ki=re.id,Kt=re.mode,Ri=Kt===void 0?"vertical":Kt,At=re.inlineCollapsed,vi=re.disabled,Qi=re.disabledOverflow,Ti=re.subMenuOpenDelay,gn=Ti===void 0?.1:Ti,Mn=re.subMenuCloseDelay,mi=Mn===void 0?.1:Mn,Ye=re.forceSubMenuRender,Je=re.defaultOpenKeys,Oi=re.openKeys,pe=re.activeKey,z=re.defaultActiveFirst,fn=re.selectable,vn=fn===void 0?!0:fn,Qn=re.multiple,Kn=Qn===void 0?!1:Qn,Ar=re.defaultSelectedKeys,tn=re.selectedKeys,Hi=re.onSelect,Sn=re.onDeselect,Ji=re.inlineIndent,Fn=Ji===void 0?24:Ji,Xr=re.motion,no=re.defaultMotions,Jn=re.triggerSubMenuAction,ii=Jn===void 0?"hover":Jn,xr=re.builtinPlacements,wr=re.itemIcon,ko=re.expandIcon,br=re.overflowedIndicator,po=br===void 0?"...":br,ds=re.overflowedIndicatorPopupClassName,Ps=re.getPopupContainer,xs=re.onClick,Ns=re.onOpenChange,ws=re.onKeyDown,It=re.openAnimation,Lo=re.openTransitionName,Va=re._internalRenderMenuItem,Ia=re._internalRenderSubMenuItem,Xs=(0,ft.Z)(re,li),Ao=Rt.useMemo(function(){return bi(ki,Gi,Mi)},[ki,Gi]),al=Rt.useState(!1),oa=(0,ut.Z)(al,2),vr=oa[0],jr=oa[1],ya=Rt.useRef(),yn=qt(Ki),Xn=di==="rtl",Pn=(0,yt.Z)(Je,{value:Oi,postState:function(Zr){return Zr||Mi}}),ai=(0,ut.Z)(Pn,2),cr=ai[0],_r=ai[1],ro=function(Zr){var fo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Mr(){_r(Zr),Ns==null||Ns(Zr)}fo?(0,Ce.flushSync)(Mr):Mr()},Eo=Rt.useState(cr),Do=(0,ut.Z)(Eo,2),Ze=Do[0],Nn=Do[1],An=Rt.useRef(!1),Rr=Rt.useMemo(function(){return(Ri==="inline"||Ri==="vertical")&&At?["vertical",At]:[Ri,!1]},[Ri,At]),Io=(0,ut.Z)(Rr,2),Oo=Io[0],on=Io[1],Il=Oo==="inline",Ys=Rt.useState(Oo),Rs=(0,ut.Z)(Ys,2),Go=Rs[0],Ol=Rs[1],sa=Rt.useState(on),fs=(0,ut.Z)(sa,2),jo=fs[0],ll=fs[1];Rt.useEffect(function(){Ol(Oo),ll(on),An.current&&(Il?_r(Ze):ro(Mi))},[Oo,on]);var Ml=Rt.useState(0),Cl=(0,ut.Z)(Ml,2),yu=Cl[0],Bl=Cl[1],aa=yu>=Ao.length-1||Go!=="horizontal"||Qi;Rt.useEffect(function(){Il&&Nn(cr)},[cr]),Rt.useEffect(function(){return An.current=!0,function(){An.current=!1}},[]);var zs=He(),Wr=zs.registerPath,kl=zs.unregisterPath,xu=zs.refreshOverflowKeys,Ll=zs.isSubPathKey,zn=zs.getKeyPath,dr=zs.getKeys,ho=zs.getSubPathKeys,Ms=Rt.useMemo(function(){return{registerPath:Wr,unregisterPath:kl}},[Wr,kl]),_o=Rt.useMemo(function(){return{isSubPathKey:Ll}},[Ll]);Rt.useEffect(function(){xu(aa?Mi:Ao.slice(yu+1).map(function($r){return $r.key}))},[yu,aa]);var oo=(0,yt.Z)(pe||z&&((Dt=Ao[0])===null||Dt===void 0?void 0:Dt.key),{value:pe}),co=(0,ut.Z)(oo,2),so=co[0],ao=co[1],Oa=Si(function($r){ao($r)}),Ba=Si(function(){ao(void 0)});(0,Rt.useImperativeHandle)(Wt,function(){return{list:ya.current,focus:function(Zr){var fo,Mr=dr(),an=U(Mr,yn),Cs=an.elements,js=an.key2element,mo=an.element2key,er=E(ya.current,Cs),$o=so!=null?so:er[0]?mo.get(er[0]):(fo=Ao.find(function(xa){return!xa.props.disabled}))===null||fo===void 0?void 0:fo.key,ps=js.get($o);if($o&&ps){var Or;ps==null||(Or=ps.focus)===null||Or===void 0||Or.call(ps,Zr)}}}});var Ur=(0,yt.Z)(Ar||[],{value:tn,postState:function(Zr){return Array.isArray(Zr)?Zr:Zr==null?Mi:[Zr]}}),tc=(0,ut.Z)(Ur,2),wu=tc[0],ec=tc[1],nn=function(Zr){if(vn){var fo=Zr.key,Mr=wu.includes(fo),an;Kn?Mr?an=wu.filter(function(js){return js!==fo}):an=[].concat((0,le.Z)(wu),[fo]):an=[fo],ec(an);var Cs=(0,vt.Z)((0,vt.Z)({},Zr),{},{selectedKeys:an});Mr?Sn==null||Sn(Cs):Hi==null||Hi(Cs)}!Kn&&cr.length&&Go!=="inline"&&ro(Mi)},kd=Si(function($r){xs==null||xs(Ln($r)),nn($r)}),ht=Si(function($r,Zr){var fo=cr.filter(function(an){return an!==$r});if(Zr)fo.push($r);else if(Go!=="inline"){var Mr=ho($r);fo=fo.filter(function(an){return!Mr.has(an)})}(0,be.Z)(cr,fo,!0)||ro(fo,!0)}),fe=function(Zr,fo){var Mr=fo!=null?fo:!cr.includes(Zr);ht(Zr,Mr)},ju=D(Go,so,Xn,yn,ya,dr,zn,ao,fe,ws);Rt.useEffect(function(){jr(!0)},[]);var Rc=Rt.useMemo(function(){return{_internalRenderMenuItem:Va,_internalRenderSubMenuItem:Ia}},[Va,Ia]),eu=Go!=="horizontal"||Qi?Ao:Ao.map(function($r,Zr){return Rt.createElement(Ct,{key:$r.key,overflowDisabled:Zr>yu},$r)}),iu=Rt.createElement(rt.Z,(0,Mt.Z)({id:Ki,ref:ya,prefixCls:"".concat(mt,"-overflow"),component:"ul",itemComponent:Er,className:Q()(mt,"".concat(mt,"-root"),"".concat(mt,"-").concat(Go),ci,(ke={},(0,kt.Z)(ke,"".concat(mt,"-inline-collapsed"),jo),(0,kt.Z)(ke,"".concat(mt,"-rtl"),Xn),ke),Xe),dir:di,style:pi,role:"menu",tabIndex:Ni,data:eu,renderRawItem:function(Zr){return Zr},renderRawRest:function(Zr){var fo=Zr.length,Mr=fo?Ao.slice(-fo):null;return Rt.createElement(Ot,{eventKey:Qe,title:po,disabled:aa,internalPopupClose:fo===0,popupClassName:ds},Mr)},maxCount:Go!=="horizontal"||Qi?rt.Z.INVALIDATE:rt.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Zr){Bl(Zr)},onKeyDown:ju},Xs));return Rt.createElement(xe.Provider,{value:Rc},Rt.createElement(jt.Provider,{value:yn},Rt.createElement(Ct,{prefixCls:mt,rootClassName:Xe,mode:Go,openKeys:cr,rtl:Xn,disabled:vi,motion:vr?Xr:null,defaultMotions:vr?no:null,activeKey:so,onActive:Oa,onInactive:Ba,selectedKeys:wu,inlineIndent:Fn,subMenuOpenDelay:gn,subMenuCloseDelay:mi,forceSubMenuRender:Ye,builtinPlacements:xr,triggerSubMenuAction:ii,getPopupContainer:Ps,itemIcon:wr,expandIcon:ko,onItemClick:kd,onOpenChange:ht},Rt.createElement(We.Provider,{value:_o},iu),Rt.createElement("div",{style:{display:"none"},"aria-hidden":!0},Rt.createElement(Et.Provider,{value:Ms},Ao)))))}),qe=Pe,Re=qe;Re.Item=Er,Re.SubMenu=Ot,Re.ItemGroup=me,Re.Divider=Fe;var ni=Re},11780:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Be}});var Mt=G(32855),kt=G(27247),vt=G(11913),le=G(43079),ut=G(59301),ft=G(92310),Pt=G.n(ft),Q=G(29301),rt=G(34280),yt=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],be=void 0;function pt(Se,dt){var W=Se.prefixCls,Zt=Se.invalidate,ze=Se.item,Me=Se.renderItem,ye=Se.responsive,se=Se.responsiveDisabled,Ue=Se.registerSize,Fi=Se.itemKey,wi=Se.className,Ai=Se.style,ri=Se.children,sn=Se.display,Zi=Se.order,j=Se.component,P=j===void 0?"div":j,E=(0,le.Z)(Se,yt),B=ye&&!sn;function U(Ae){Ue(Fi,Ae)}ut.useEffect(function(){return function(){U(null)}},[]);var D=Me&&ze!==be?Me(ze,{index:Zi}):ri,St;Zt||(St={opacity:B?0:1,height:B?0:be,overflowY:B?"hidden":be,order:ye?Zi:be,pointerEvents:B?"none":be,position:B?"absolute":be});var ae={};B&&(ae["aria-hidden"]=!0);var $e=ut.createElement(P,(0,Mt.Z)({className:Pt()(!Zt&&W,wi),style:(0,kt.Z)((0,kt.Z)({},St),Ai)},ae,E,{ref:dt}),D);return ye&&($e=ut.createElement(Q.Z,{onResize:function(Qe){var He=Qe.offsetWidth;U(He)},disabled:se},$e)),$e}var Rt=ut.forwardRef(pt);Rt.displayName="Item";var Ce=Rt,jt=G(6089),Jt=G(4676),Ht=G(16089);function de(Se){if(typeof MessageChannel=="undefined")(0,Ht.Z)(Se);else{var dt=new MessageChannel;dt.port1.onmessage=function(){return Se()},dt.port2.postMessage(void 0)}}function De(){var Se=ut.useRef(null),dt=function(Zt){Se.current||(Se.current=[],de(function(){(0,Jt.unstable_batchedUpdates)(function(){Se.current.forEach(function(ze){ze()}),Se.current=null})})),Se.current.push(Zt)};return dt}function $t(Se,dt){var W=ut.useState(dt),Zt=(0,vt.Z)(W,2),ze=Zt[0],Me=Zt[1],ye=(0,jt.Z)(function(se){Se(function(){Me(se)})});return[ze,ye]}var Xt=ut.createContext(null),Ct=["component"],q=["className"],Et=["className"],Bt=function(dt,W){var Zt=ut.useContext(Xt);if(!Zt){var ze=dt.component,Me=ze===void 0?"div":ze,ye=(0,le.Z)(dt,Ct);return ut.createElement(Me,(0,Mt.Z)({},ye,{ref:W}))}var se=Zt.className,Ue=(0,le.Z)(Zt,q),Fi=dt.className,wi=(0,le.Z)(dt,Et);return ut.createElement(Xt.Provider,{value:null},ut.createElement(Ce,(0,Mt.Z)({ref:W,className:Pt()(se,Fi)},Ue,wi)))},ve=ut.forwardRef(Bt);ve.displayName="RawItem";var Vt=ve,We=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],ee="responsive",xe="invalidate";function Nt(Se){return"+ ".concat(Se.length," ...")}function _e(Se,dt){var W=Se.prefixCls,Zt=W===void 0?"rc-overflow":W,ze=Se.data,Me=ze===void 0?[]:ze,ye=Se.renderItem,se=Se.renderRawItem,Ue=Se.itemKey,Fi=Se.itemWidth,wi=Fi===void 0?10:Fi,Ai=Se.ssr,ri=Se.style,sn=Se.className,Zi=Se.maxCount,j=Se.renderRest,P=Se.renderRawRest,E=Se.suffix,B=Se.component,U=B===void 0?"div":B,D=Se.itemComponent,St=Se.onVisibleChange,ae=(0,le.Z)(Se,We),$e=Ai==="full",Ae=De(),Qe=$t(Ae,null),He=(0,vt.Z)(Qe,2),Si=He[0],Ei=He[1],Ci=Si||0,qt=$t(Ae,new Map),ei=(0,vt.Z)(qt,2),ln=ei[0],Ft=ei[1],oe=$t(Ae,0),we=(0,vt.Z)(oe,2),Ii=we[0],Pi=we[1],_i=$t(Ae,0),hn=(0,vt.Z)(_i,2),mn=hn[0],Ln=hn[1],jn=$t(Ae,0),On=(0,vt.Z)(jn,2),rn=On[0],ir=On[1],tr=(0,ut.useState)(null),hr=(0,vt.Z)(tr,2),Er=hr[0],Hn=hr[1],Ir=(0,ut.useState)(null),T=(0,vt.Z)(Ir,2),ur=T[0],$n=T[1],Yn=ut.useMemo(function(){return ur===null&&$e?Number.MAX_SAFE_INTEGER:ur||0},[ur,Si]),Nr=(0,ut.useState)(!1),Gn=(0,vt.Z)(Nr,2),uo=Gn[0],zo=Gn[1],gr="".concat(Zt,"-item"),pn=Math.max(Ii,mn),gi=Zi===ee,ct=Me.length&&gi,J=Zi===xe,ot=ct||typeof Zi=="number"&&Me.length>Zi,nt=(0,ut.useMemo)(function(){var ni=Me;return ct?Si===null&&$e?ni=Me:ni=Me.slice(0,Math.min(Me.length,Ci/wi)):typeof Zi=="number"&&(ni=Me.slice(0,Zi)),ni},[Me,wi,Si,Zi,ct]),Z=(0,ut.useMemo)(function(){return ct?Me.slice(Yn+1):Me.slice(nt.length)},[Me,nt,ct,Yn]),xt=(0,ut.useCallback)(function(ni,Ut){var Wt;return typeof Ue=="function"?Ue(ni):(Wt=Ue&&(ni==null?void 0:ni[Ue]))!==null&&Wt!==void 0?Wt:Ut},[Ue]),Ot=(0,ut.useCallback)(ye||function(ni){return ni},[ye]);function ge(ni,Ut,Wt){ur===ni&&(Ut===void 0||Ut===Er)||($n(ni),Wt||(zo(ni<Me.length-1),St==null||St(ni)),Ut!==void 0&&Hn(Ut))}function te(ni,Ut){Ei(Ut.clientWidth)}function lt(ni,Ut){Ft(function(Wt){var Dt=new Map(Wt);return Ut===null?Dt.delete(ni):Dt.set(ni,Ut),Dt})}function Qt(ni,Ut){Ln(Ut),Pi(mn)}function me(ni,Ut){ir(Ut)}function Fe(ni){return ln.get(xt(nt[ni],ni))}(0,rt.Z)(function(){if(Ci&&typeof pn=="number"&&nt){var ni=rn,Ut=nt.length,Wt=Ut-1;if(!Ut){ge(0,null);return}for(var Dt=0;Dt<Ut;Dt+=1){var ke=Fe(Dt);if($e&&(ke=ke||0),ke===void 0){ge(Dt-1,void 0,!0);break}if(ni+=ke,Wt===0&&ni<=Ci||Dt===Wt-1&&ni+Fe(Wt)<=Ci){ge(Wt,null);break}else if(ni+pn>Ci){ge(Dt-1,ni-ke-rn+mn);break}}E&&Fe(0)+rn>Ci&&Hn(null)}},[Ci,ln,mn,rn,xt,nt]);var Tt=uo&&!!Z.length,ce={};Er!==null&&ct&&(ce={position:"absolute",left:Er,top:0});var bi={prefixCls:gr,responsive:ct,component:D,invalidate:J},li=se?function(ni,Ut){var Wt=xt(ni,Ut);return ut.createElement(Xt.Provider,{key:Wt,value:(0,kt.Z)((0,kt.Z)({},bi),{},{order:Ut,item:ni,itemKey:Wt,registerSize:lt,display:Ut<=Yn})},se(ni,Ut))}:function(ni,Ut){var Wt=xt(ni,Ut);return ut.createElement(Ce,(0,Mt.Z)({},bi,{order:Ut,key:Wt,item:ni,renderItem:Ot,itemKey:Wt,registerSize:lt,display:Ut<=Yn}))},Mi={order:Tt?Yn:Number.MAX_SAFE_INTEGER,className:"".concat(gr,"-rest"),registerSize:Qt,display:Tt},Pe=j||Nt,qe=P?ut.createElement(Xt.Provider,{value:(0,kt.Z)((0,kt.Z)({},bi),Mi)},P(Z)):ut.createElement(Ce,(0,Mt.Z)({},bi,Mi),typeof Pe=="function"?Pe(Z):Pe),Re=ut.createElement(U,(0,Mt.Z)({className:Pt()(!J&&Zt,sn),style:ri,ref:dt},ae),nt.map(li),ot?qe:null,E&&ut.createElement(Ce,(0,Mt.Z)({},bi,{responsive:gi,responsiveDisabled:!ct,order:Yn,className:"".concat(gr,"-suffix"),registerSize:me,display:!0,style:ce}),E));return gi?ut.createElement(Q.Z,{onResize:te,disabled:!ct},Re):Re}var ti=ut.forwardRef(_e);ti.displayName="Overflow",ti.Item=Vt,ti.RESPONSIVE=ee,ti.INVALIDATE=xe;var je=ti,Be=je},17115:function(qn,Li,G){"use strict";G.d(Li,{ZP:function(){return Pt}});var Mt=G(11913),kt=G(59301),vt=G(47273),le=0,ut=(0,vt.Z)();function ft(){var Q;return ut?(Q=le,le+=1):Q="TEST_OR_SSR",Q}function Pt(Q){var rt=kt.useState(),yt=(0,Mt.Z)(rt,2),be=yt[0],pt=yt[1];return kt.useEffect(function(){pt("rc_select_".concat(ft()))},[]),Q||be}},77861:function(qn,Li,G){"use strict";G.d(Li,{Ac:function(){return Ei},Xo:function(){return Ln},Wx:function(){return On},ZP:function(){return ot},lk:function(){return Xt}});var Mt=G(32855),kt=G(3300),vt=G(74430),le=G(27247),ut=G(11913),ft=G(43079),Pt=G(34666),Q=G(18929),rt=G(48736),yt=G(59301),be=G(92310),pt=G.n(be),Rt=G(34280),Ce=G(49658),jt=G(10228),Jt=G(8654),Ht=function(Z){var xt=Z.className,Ot=Z.customizeIcon,ge=Z.customizeIconProps,te=Z.onMouseDown,lt=Z.onClick,Qt=Z.children,me;return typeof Ot=="function"?me=Ot(ge):me=Ot,yt.createElement("span",{className:xt,onMouseDown:function(Tt){Tt.preventDefault(),te&&te(Tt)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:lt,"aria-hidden":!0},me!==void 0?me:yt.createElement("span",{className:pt()(xt.split(/\s+/).map(function(Fe){return"".concat(Fe,"-icon")}))},Qt))},de=Ht;function De(nt,Z,xt,Ot,ge){var te=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,lt=arguments.length>6?arguments[6]:void 0,Qt=arguments.length>7?arguments[7]:void 0,me=yt.useMemo(function(){if((0,Pt.Z)(Ot)==="object")return Ot.clearIcon;if(ge)return ge},[Ot,ge]),Fe=yt.useMemo(function(){return!!(!te&&Ot&&(xt.length||lt)&&!(Qt==="combobox"&&lt===""))},[Ot,te,xt.length,lt,Qt]);return{allowClear:Fe,clearIcon:yt.createElement(de,{className:"".concat(nt,"-clear"),onMouseDown:Z,customizeIcon:me},"\xD7")}}var $t=yt.createContext(null);function Xt(){return yt.useContext($t)}function Ct(){var nt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:10,Z=yt.useState(!1),xt=(0,ut.Z)(Z,2),Ot=xt[0],ge=xt[1],te=yt.useRef(null),lt=function(){window.clearTimeout(te.current)};yt.useEffect(function(){return lt},[]);var Qt=function(Fe,Tt){lt(),te.current=window.setTimeout(function(){ge(Fe),Tt&&Tt()},nt)};return[Ot,Qt,lt]}function q(){var nt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:250,Z=yt.useRef(null),xt=yt.useRef(null);yt.useEffect(function(){return function(){window.clearTimeout(xt.current)}},[]);function Ot(ge){(ge||Z.current===null)&&(Z.current=ge),window.clearTimeout(xt.current),xt.current=window.setTimeout(function(){Z.current=null},nt)}return[function(){return Z.current},Ot]}function Et(nt,Z,xt,Ot){var ge=yt.useRef(null);ge.current={open:Z,triggerOpen:xt,customizedTrigger:Ot},yt.useEffect(function(){function te(lt){var Qt;if(!((Qt=ge.current)!==null&&Qt!==void 0&&Qt.customizedTrigger)){var me=lt.target;me.shadowRoot&&lt.composed&&(me=lt.composedPath()[0]||me),ge.current.open&&nt().filter(function(Fe){return Fe}).every(function(Fe){return!Fe.contains(me)&&Fe!==me})&&ge.current.triggerOpen(!1)}}return window.addEventListener("mousedown",te),function(){return window.removeEventListener("mousedown",te)}},[])}var Bt=G(26112),ve=G(11780),Vt=function(Z,xt){var Ot,ge,te=Z.prefixCls,lt=Z.id,Qt=Z.inputElement,me=Z.disabled,Fe=Z.tabIndex,Tt=Z.autoFocus,ce=Z.autoComplete,bi=Z.editable,li=Z.activeDescendantId,Mi=Z.value,Pe=Z.maxLength,qe=Z.onKeyDown,Re=Z.onMouseDown,ni=Z.onChange,Ut=Z.onPaste,Wt=Z.onCompositionStart,Dt=Z.onCompositionEnd,ke=Z.open,re=Z.attrs,Ie=Qt||yt.createElement("input",null),mt=Ie,Xe=mt.ref,pi=mt.props,ci=pi.onKeyDown,Ui=pi.onChange,Ni=pi.onMouseDown,Gi=pi.onCompositionStart,ki=pi.onCompositionEnd,di=pi.style;return(0,rt.Kp)(!("maxLength"in Ie.props),"Passing 'maxLength' to input element directly may not work because input in BaseSelect is controlled."),Ie=yt.cloneElement(Ie,(0,le.Z)((0,le.Z)((0,le.Z)({type:"search"},pi),{},{id:lt,ref:(0,Jt.sQ)(xt,Xe),disabled:me,tabIndex:Fe,autoComplete:ce||"off",autoFocus:Tt,className:pt()("".concat(te,"-selection-search-input"),(Ot=Ie)===null||Ot===void 0||(ge=Ot.props)===null||ge===void 0?void 0:ge.className),role:"combobox","aria-label":"Search","aria-expanded":ke||!1,"aria-haspopup":"listbox","aria-owns":"".concat(lt,"_list"),"aria-autocomplete":"list","aria-controls":"".concat(lt,"_list"),"aria-activedescendant":ke?li:void 0},re),{},{value:bi?Mi:"",maxLength:Pe,readOnly:!bi,unselectable:bi?null:"on",style:(0,le.Z)((0,le.Z)({},di),{},{opacity:bi?null:0}),onKeyDown:function(Kt){qe(Kt),ci&&ci(Kt)},onMouseDown:function(Kt){Re(Kt),Ni&&Ni(Kt)},onChange:function(Kt){ni(Kt),Ui&&Ui(Kt)},onCompositionStart:function(Kt){Wt(Kt),Gi&&Gi(Kt)},onCompositionEnd:function(Kt){Dt(Kt),ki&&ki(Kt)},onPaste:Ut})),Ie},We=yt.forwardRef(Vt);We.displayName="Input";var ee=We;function xe(nt){return Array.isArray(nt)?nt:nt!==void 0?[nt]:[]}var Nt=typeof window!="undefined"&&window.document&&window.document.documentElement,_e=Nt;function ti(nt){return nt!=null}function je(nt){return!nt&&nt!==0}function Be(nt){return["string","number"].includes((0,Pt.Z)(nt))}function Se(nt){var Z=void 0;return nt&&(Be(nt.title)?Z=nt.title.toString():Be(nt.label)&&(Z=nt.label.toString())),Z}function dt(nt,Z){_e?yt.useLayoutEffect(nt,Z):yt.useEffect(nt,Z)}function W(nt){var Z;return(Z=nt.key)!==null&&Z!==void 0?Z:nt.value}var Zt=function(Z){Z.preventDefault(),Z.stopPropagation()},ze=function(Z){var xt=Z.id,Ot=Z.prefixCls,ge=Z.values,te=Z.open,lt=Z.searchValue,Qt=Z.autoClearSearchValue,me=Z.inputRef,Fe=Z.placeholder,Tt=Z.disabled,ce=Z.mode,bi=Z.showSearch,li=Z.autoFocus,Mi=Z.autoComplete,Pe=Z.activeDescendantId,qe=Z.tabIndex,Re=Z.removeIcon,ni=Z.maxTagCount,Ut=Z.maxTagTextLength,Wt=Z.maxTagPlaceholder,Dt=Wt===void 0?function(fn){return"+ ".concat(fn.length," ...")}:Wt,ke=Z.tagRender,re=Z.onToggleOpen,Ie=Z.onRemove,mt=Z.onInputChange,Xe=Z.onInputPaste,pi=Z.onInputKeyDown,ci=Z.onInputMouseDown,Ui=Z.onInputCompositionStart,Ni=Z.onInputCompositionEnd,Gi=yt.useRef(null),ki=(0,yt.useState)(0),di=(0,ut.Z)(ki,2),Ki=di[0],Kt=di[1],Ri=(0,yt.useState)(!1),At=(0,ut.Z)(Ri,2),vi=At[0],Qi=At[1],Ti="".concat(Ot,"-selection"),gn=te||ce==="multiple"&&Qt===!1||ce==="tags"?lt:"",Mn=ce==="tags"||ce==="multiple"&&Qt===!1||bi&&(te||vi);dt(function(){Kt(Gi.current.scrollWidth)},[gn]);function mi(fn,vn,Qn,Kn,Ar){return yt.createElement("span",{className:pt()("".concat(Ti,"-item"),(0,vt.Z)({},"".concat(Ti,"-item-disabled"),Qn)),title:Se(fn)},yt.createElement("span",{className:"".concat(Ti,"-item-content")},vn),Kn&&yt.createElement(de,{className:"".concat(Ti,"-item-remove"),onMouseDown:Zt,onClick:Ar,customizeIcon:Re},"\xD7"))}function Ye(fn,vn,Qn,Kn,Ar){var tn=function(Sn){Zt(Sn),re(!te)};return yt.createElement("span",{onMouseDown:tn},ke({label:vn,value:fn,disabled:Qn,closable:Kn,onClose:Ar}))}function Je(fn){var vn=fn.disabled,Qn=fn.label,Kn=fn.value,Ar=!Tt&&!vn,tn=Qn;if(typeof Ut=="number"&&(typeof Qn=="string"||typeof Qn=="number")){var Hi=String(tn);Hi.length>Ut&&(tn="".concat(Hi.slice(0,Ut),"..."))}var Sn=function(Fn){Fn&&Fn.stopPropagation(),Ie(fn)};return typeof ke=="function"?Ye(Kn,tn,vn,Ar,Sn):mi(fn,tn,vn,Ar,Sn)}function Oi(fn){var vn=typeof Dt=="function"?Dt(fn):Dt;return mi({title:vn},vn,!1)}var pe=yt.createElement("div",{className:"".concat(Ti,"-search"),style:{width:Ki},onFocus:function(){Qi(!0)},onBlur:function(){Qi(!1)}},yt.createElement(ee,{ref:me,open:te,prefixCls:Ot,id:xt,inputElement:null,disabled:Tt,autoFocus:li,autoComplete:Mi,editable:Mn,activeDescendantId:Pe,value:gn,onKeyDown:pi,onMouseDown:ci,onChange:mt,onPaste:Xe,onCompositionStart:Ui,onCompositionEnd:Ni,tabIndex:qe,attrs:(0,Bt.Z)(Z,!0)}),yt.createElement("span",{ref:Gi,className:"".concat(Ti,"-search-mirror"),"aria-hidden":!0},gn,"\xA0")),z=yt.createElement(ve.Z,{prefixCls:"".concat(Ti,"-overflow"),data:ge,renderItem:Je,renderRest:Oi,suffix:pe,itemKey:W,maxCount:ni});return yt.createElement(yt.Fragment,null,z,!ge.length&&!gn&&yt.createElement("span",{className:"".concat(Ti,"-placeholder")},Fe))},Me=ze,ye=function(Z){var xt=Z.inputElement,Ot=Z.prefixCls,ge=Z.id,te=Z.inputRef,lt=Z.disabled,Qt=Z.autoFocus,me=Z.autoComplete,Fe=Z.activeDescendantId,Tt=Z.mode,ce=Z.open,bi=Z.values,li=Z.placeholder,Mi=Z.tabIndex,Pe=Z.showSearch,qe=Z.searchValue,Re=Z.activeValue,ni=Z.maxLength,Ut=Z.onInputKeyDown,Wt=Z.onInputMouseDown,Dt=Z.onInputChange,ke=Z.onInputPaste,re=Z.onInputCompositionStart,Ie=Z.onInputCompositionEnd,mt=Z.title,Xe=yt.useState(!1),pi=(0,ut.Z)(Xe,2),ci=pi[0],Ui=pi[1],Ni=Tt==="combobox",Gi=Ni||Pe,ki=bi[0],di=qe||"";Ni&&Re&&!ci&&(di=Re),yt.useEffect(function(){Ni&&Ui(!1)},[Ni,Re]);var Ki=Tt!=="combobox"&&!ce&&!Pe?!1:!!di,Kt=mt===void 0?Se(ki):mt,Ri=function(){if(ki)return null;var vi=Ki?{visibility:"hidden"}:void 0;return yt.createElement("span",{className:"".concat(Ot,"-selection-placeholder"),style:vi},li)};return yt.createElement(yt.Fragment,null,yt.createElement("span",{className:"".concat(Ot,"-selection-search")},yt.createElement(ee,{ref:te,prefixCls:Ot,id:ge,open:ce,inputElement:xt,disabled:lt,autoFocus:Qt,autoComplete:me,editable:Gi,activeDescendantId:Fe,value:di,onKeyDown:Ut,onMouseDown:Wt,onChange:function(vi){Ui(!0),Dt(vi)},onPaste:ke,onCompositionStart:re,onCompositionEnd:Ie,tabIndex:Mi,attrs:(0,Bt.Z)(Z,!0),maxLength:Ni?ni:void 0})),!Ni&&ki?yt.createElement("span",{className:"".concat(Ot,"-selection-item"),title:Kt,style:Ki?{visibility:"hidden"}:void 0},ki.label):null,Ri())},se=ye;function Ue(nt){return![jt.Z.ESC,jt.Z.SHIFT,jt.Z.BACKSPACE,jt.Z.TAB,jt.Z.WIN_KEY,jt.Z.ALT,jt.Z.META,jt.Z.WIN_KEY_RIGHT,jt.Z.CTRL,jt.Z.SEMICOLON,jt.Z.EQUALS,jt.Z.CAPS_LOCK,jt.Z.CONTEXT_MENU,jt.Z.F1,jt.Z.F2,jt.Z.F3,jt.Z.F4,jt.Z.F5,jt.Z.F6,jt.Z.F7,jt.Z.F8,jt.Z.F9,jt.Z.F10,jt.Z.F11,jt.Z.F12].includes(nt)}var Fi=function(Z,xt){var Ot=(0,yt.useRef)(null),ge=(0,yt.useRef)(!1),te=Z.prefixCls,lt=Z.open,Qt=Z.mode,me=Z.showSearch,Fe=Z.tokenWithEnter,Tt=Z.autoClearSearchValue,ce=Z.onSearch,bi=Z.onSearchSubmit,li=Z.onToggleOpen,Mi=Z.onInputKeyDown,Pe=Z.domRef;yt.useImperativeHandle(xt,function(){return{focus:function(){Ot.current.focus()},blur:function(){Ot.current.blur()}}});var qe=q(0),Re=(0,ut.Z)(qe,2),ni=Re[0],Ut=Re[1],Wt=function(di){var Ki=di.which;(Ki===jt.Z.UP||Ki===jt.Z.DOWN)&&di.preventDefault(),Mi&&Mi(di),Ki===jt.Z.ENTER&&Qt==="tags"&&!ge.current&&!lt&&(bi==null||bi(di.target.value)),Ue(Ki)&&li(!0)},Dt=function(){Ut(!0)},ke=(0,yt.useRef)(null),re=function(di){ce(di,!0,ge.current)!==!1&&li(!0)},Ie=function(){ge.current=!0},mt=function(di){ge.current=!1,Qt!=="combobox"&&re(di.target.value)},Xe=function(di){var Ki=di.target.value;if(Fe&&ke.current&&/[\r\n]/.test(ke.current)){var Kt=ke.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");Ki=Ki.replace(Kt,ke.current)}ke.current=null,re(Ki)},pi=function(di){var Ki=di.clipboardData,Kt=Ki.getData("text");ke.current=Kt},ci=function(di){var Ki=di.target;if(Ki!==Ot.current){var Kt=document.body.style.msTouchAction!==void 0;Kt?setTimeout(function(){Ot.current.focus()}):Ot.current.focus()}},Ui=function(di){var Ki=ni();di.target!==Ot.current&&!Ki&&Qt!=="combobox"&&di.preventDefault(),(Qt!=="combobox"&&(!me||!Ki)||!lt)&&(lt&&Tt!==!1&&ce("",!0,!1),li())},Ni={inputRef:Ot,onInputKeyDown:Wt,onInputMouseDown:Dt,onInputChange:Xe,onInputPaste:pi,onInputCompositionStart:Ie,onInputCompositionEnd:mt},Gi=Qt==="multiple"||Qt==="tags"?yt.createElement(Me,(0,Mt.Z)({},Z,Ni)):yt.createElement(se,(0,Mt.Z)({},Z,Ni));return yt.createElement("div",{ref:Pe,className:"".concat(te,"-selector"),onClick:ci,onMouseDown:Ui},Gi)},wi=yt.forwardRef(Fi);wi.displayName="Selector";var Ai=wi,ri=G(35593),sn=["prefixCls","disabled","visible","children","popupElement","animation","transitionName","dropdownStyle","dropdownClassName","direction","placement","builtinPlacements","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","getPopupContainer","empty","getTriggerDOMNode","onPopupVisibleChange","onPopupMouseEnter"],Zi=function(Z){var xt=Z===!0?0:1;return{bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:xt,adjustY:1},htmlRegion:"scroll"},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:xt,adjustY:1},htmlRegion:"scroll"},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:xt,adjustY:1},htmlRegion:"scroll"},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:xt,adjustY:1},htmlRegion:"scroll"}}},j=function(Z,xt){var Ot=Z.prefixCls,ge=Z.disabled,te=Z.visible,lt=Z.children,Qt=Z.popupElement,me=Z.animation,Fe=Z.transitionName,Tt=Z.dropdownStyle,ce=Z.dropdownClassName,bi=Z.direction,li=bi===void 0?"ltr":bi,Mi=Z.placement,Pe=Z.builtinPlacements,qe=Z.dropdownMatchSelectWidth,Re=Z.dropdownRender,ni=Z.dropdownAlign,Ut=Z.getPopupContainer,Wt=Z.empty,Dt=Z.getTriggerDOMNode,ke=Z.onPopupVisibleChange,re=Z.onPopupMouseEnter,Ie=(0,ft.Z)(Z,sn),mt="".concat(Ot,"-dropdown"),Xe=Qt;Re&&(Xe=Re(Qt));var pi=yt.useMemo(function(){return Pe||Zi(qe)},[Pe,qe]),ci=me?"".concat(mt,"-").concat(me):Fe,Ui=typeof qe=="number",Ni=yt.useMemo(function(){return Ui?null:qe===!1?"minWidth":"width"},[qe,Ui]),Gi=Tt;Ui&&(Gi=(0,le.Z)((0,le.Z)({},Gi),{},{width:qe}));var ki=yt.useRef(null);return yt.useImperativeHandle(xt,function(){return{getPopupElement:function(){return ki.current}}}),yt.createElement(ri.Z,(0,Mt.Z)({},Ie,{showAction:ke?["click"]:[],hideAction:ke?["click"]:[],popupPlacement:Mi||(li==="rtl"?"bottomRight":"bottomLeft"),builtinPlacements:pi,prefixCls:mt,popupTransitionName:ci,popup:yt.createElement("div",{ref:ki,onMouseEnter:re},Xe),stretch:Ni,popupAlign:ni,popupVisible:te,getPopupContainer:Ut,popupClassName:pt()(ce,(0,vt.Z)({},"".concat(mt,"-empty"),Wt)),popupStyle:Gi,getTriggerDOMNode:Dt,onPopupVisibleChange:ke}),lt)},P=yt.forwardRef(j);P.displayName="SelectTrigger";var E=P,B=G(40954);function U(nt,Z){var xt=nt.key,Ot;return"value"in nt&&(Ot=nt.value),xt!=null?xt:Ot!==void 0?Ot:"rc-index-key-".concat(Z)}function D(nt,Z){var xt=nt||{},Ot=xt.label,ge=xt.value,te=xt.options,lt=xt.groupLabel,Qt=Ot||(Z?"children":"label");return{label:Qt,value:ge||"value",options:te||"options",groupLabel:lt||Qt}}function St(nt){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},xt=Z.fieldNames,Ot=Z.childrenAsData,ge=[],te=D(xt,!1),lt=te.label,Qt=te.value,me=te.options,Fe=te.groupLabel;function Tt(ce,bi){ce.forEach(function(li){if(bi||!(me in li)){var Mi=li[Qt];ge.push({key:U(li,ge.length),groupOption:bi,data:li,label:li[lt],value:Mi})}else{var Pe=li[Fe];Pe===void 0&&Ot&&(Pe=li.label),ge.push({key:U(li,ge.length),group:!0,data:li,label:Pe}),Tt(li[me],!0)}})}return Tt(nt,!1),ge}function ae(nt){var Z=(0,le.Z)({},nt);return"props"in Z||Object.defineProperty(Z,"props",{get:function(){return(0,rt.ZP)(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),Z}}),Z}function $e(nt,Z){if(!Z||!Z.length)return null;var xt=!1;function Ot(te,lt){var Qt=(0,B.Z)(lt),me=Qt[0],Fe=Qt.slice(1);if(!me)return[te];var Tt=te.split(me);return xt=xt||Tt.length>1,Tt.reduce(function(ce,bi){return[].concat((0,kt.Z)(ce),(0,kt.Z)(Ot(bi,Fe)))},[]).filter(function(ce){return ce})}var ge=Ot(nt,Z);return xt?ge:null}var Ae=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],Qe=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"];function He(nt){return nt==="tags"||nt==="multiple"}var Si=yt.forwardRef(function(nt,Z){var xt,Ot,ge=nt.id,te=nt.prefixCls,lt=nt.className,Qt=nt.showSearch,me=nt.tagRender,Fe=nt.direction,Tt=nt.omitDomProps,ce=nt.displayValues,bi=nt.onDisplayValuesChange,li=nt.emptyOptions,Mi=nt.notFoundContent,Pe=Mi===void 0?"Not Found":Mi,qe=nt.onClear,Re=nt.mode,ni=nt.disabled,Ut=nt.loading,Wt=nt.getInputElement,Dt=nt.getRawInputElement,ke=nt.open,re=nt.defaultOpen,Ie=nt.onDropdownVisibleChange,mt=nt.activeValue,Xe=nt.onActiveValueChange,pi=nt.activeDescendantId,ci=nt.searchValue,Ui=nt.autoClearSearchValue,Ni=nt.onSearch,Gi=nt.onSearchSplit,ki=nt.tokenSeparators,di=nt.allowClear,Ki=nt.suffixIcon,Kt=nt.clearIcon,Ri=nt.OptionList,At=nt.animation,vi=nt.transitionName,Qi=nt.dropdownStyle,Ti=nt.dropdownClassName,gn=nt.dropdownMatchSelectWidth,Mn=nt.dropdownRender,mi=nt.dropdownAlign,Ye=nt.placement,Je=nt.builtinPlacements,Oi=nt.getPopupContainer,pe=nt.showAction,z=pe===void 0?[]:pe,fn=nt.onFocus,vn=nt.onBlur,Qn=nt.onKeyUp,Kn=nt.onKeyDown,Ar=nt.onMouseDown,tn=(0,ft.Z)(nt,Ae),Hi=He(Re),Sn=(Qt!==void 0?Qt:Hi)||Re==="combobox",Ji=(0,le.Z)({},tn);Qe.forEach(function(zn){delete Ji[zn]}),Tt==null||Tt.forEach(function(zn){delete Ji[zn]});var Fn=yt.useState(!1),Xr=(0,ut.Z)(Fn,2),no=Xr[0],Jn=Xr[1];yt.useEffect(function(){Jn((0,Ce.Z)())},[]);var ii=yt.useRef(null),xr=yt.useRef(null),wr=yt.useRef(null),ko=yt.useRef(null),br=yt.useRef(null),po=Ct(),ds=(0,ut.Z)(po,3),Ps=ds[0],xs=ds[1],Ns=ds[2];yt.useImperativeHandle(Z,function(){var zn,dr;return{focus:(zn=ko.current)===null||zn===void 0?void 0:zn.focus,blur:(dr=ko.current)===null||dr===void 0?void 0:dr.blur,scrollTo:function(Ms){var _o;return(_o=br.current)===null||_o===void 0?void 0:_o.scrollTo(Ms)}}});var ws=yt.useMemo(function(){var zn;if(Re!=="combobox")return ci;var dr=(zn=ce[0])===null||zn===void 0?void 0:zn.value;return typeof dr=="string"||typeof dr=="number"?String(dr):""},[ci,Re,ce]),It=Re==="combobox"&&typeof Wt=="function"&&Wt()||null,Lo=typeof Dt=="function"&&Dt(),Va=(0,Jt.x1)(xr,Lo==null||(xt=Lo.props)===null||xt===void 0?void 0:xt.ref),Ia=yt.useState(!1),Xs=(0,ut.Z)(Ia,2),Ao=Xs[0],al=Xs[1];(0,Rt.Z)(function(){al(!0)},[]);var oa=(0,Q.Z)(!1,{defaultValue:re,value:ke}),vr=(0,ut.Z)(oa,2),jr=vr[0],ya=vr[1],yn=Ao?jr:!1,Xn=!Pe&&li;(ni||Xn&&yn&&Re==="combobox")&&(yn=!1);var Pn=Xn?!1:yn,ai=yt.useCallback(function(zn){var dr=zn!==void 0?zn:!yn;ni||(ya(dr),yn!==dr&&(Ie==null||Ie(dr)))},[ni,yn,ya,Ie]),cr=yt.useMemo(function(){return(ki||[]).some(function(zn){return[`
`,`\r
`].includes(zn)})},[ki]),_r=function(dr,ho,Ms){var _o=!0,oo=dr;Xe==null||Xe(null);var co=Ms?null:$e(dr,ki);return Re!=="combobox"&&co&&(oo="",Gi==null||Gi(co),ai(!1),_o=!1),Ni&&ws!==oo&&Ni(oo,{source:ho?"typing":"effect"}),_o},ro=function(dr){!dr||!dr.trim()||Ni(dr,{source:"submit"})};yt.useEffect(function(){!yn&&!Hi&&Re!=="combobox"&&_r("",!1,!1)},[yn]),yt.useEffect(function(){jr&&ni&&ya(!1),ni&&xs(!1)},[ni]);var Eo=q(),Do=(0,ut.Z)(Eo,2),Ze=Do[0],Nn=Do[1],An=function(dr){var ho=Ze(),Ms=dr.which;if(Ms===jt.Z.ENTER&&(Re!=="combobox"&&dr.preventDefault(),yn||ai(!0)),Nn(!!ws),Ms===jt.Z.BACKSPACE&&!ho&&Hi&&!ws&&ce.length){for(var _o=(0,kt.Z)(ce),oo=null,co=_o.length-1;co>=0;co-=1){var so=_o[co];if(!so.disabled){_o.splice(co,1),oo=so;break}}oo&&bi(_o,{type:"remove",values:[oo]})}for(var ao=arguments.length,Oa=new Array(ao>1?ao-1:0),Ba=1;Ba<ao;Ba++)Oa[Ba-1]=arguments[Ba];if(yn&&br.current){var Ur;(Ur=br.current).onKeyDown.apply(Ur,[dr].concat(Oa))}Kn==null||Kn.apply(void 0,[dr].concat(Oa))},Rr=function(dr){for(var ho=arguments.length,Ms=new Array(ho>1?ho-1:0),_o=1;_o<ho;_o++)Ms[_o-1]=arguments[_o];if(yn&&br.current){var oo;(oo=br.current).onKeyUp.apply(oo,[dr].concat(Ms))}Qn==null||Qn.apply(void 0,[dr].concat(Ms))},Io=function(dr){var ho=ce.filter(function(Ms){return Ms!==dr});bi(ho,{type:"remove",values:[dr]})},Oo=yt.useRef(!1),on=function(){xs(!0),ni||(fn&&!Oo.current&&fn.apply(void 0,arguments),z.includes("focus")&&ai(!0)),Oo.current=!0},Il=function(){xs(!1,function(){Oo.current=!1,ai(!1)}),!ni&&(ws&&(Re==="tags"?Ni(ws,{source:"submit"}):Re==="multiple"&&Ni("",{source:"blur"})),vn&&vn.apply(void 0,arguments))},Ys=[];yt.useEffect(function(){return function(){Ys.forEach(function(zn){return clearTimeout(zn)}),Ys.splice(0,Ys.length)}},[]);var Rs=function(dr){var ho,Ms=dr.target,_o=(ho=wr.current)===null||ho===void 0?void 0:ho.getPopupElement();if(_o&&_o.contains(Ms)){var oo=setTimeout(function(){var Oa=Ys.indexOf(oo);if(Oa!==-1&&Ys.splice(Oa,1),Ns(),!no&&!_o.contains(document.activeElement)){var Ba;(Ba=ko.current)===null||Ba===void 0||Ba.focus()}});Ys.push(oo)}for(var co=arguments.length,so=new Array(co>1?co-1:0),ao=1;ao<co;ao++)so[ao-1]=arguments[ao];Ar==null||Ar.apply(void 0,[dr].concat(so))},Go=yt.useState({}),Ol=(0,ut.Z)(Go,2),sa=Ol[1];function fs(){sa({})}var jo;Lo&&(jo=function(dr){ai(dr)}),Et(function(){var zn;return[ii.current,(zn=wr.current)===null||zn===void 0?void 0:zn.getPopupElement()]},Pn,ai,!!Lo);var ll=yt.useMemo(function(){return(0,le.Z)((0,le.Z)({},nt),{},{notFoundContent:Pe,open:yn,triggerOpen:Pn,id:ge,showSearch:Sn,multiple:Hi,toggleOpen:ai})},[nt,Pe,Pn,yn,ge,Sn,Hi,ai]),Ml=!!Ki||Ut,Cl;Ml&&(Cl=yt.createElement(de,{className:pt()("".concat(te,"-arrow"),(0,vt.Z)({},"".concat(te,"-arrow-loading"),Ut)),customizeIcon:Ki,customizeIconProps:{loading:Ut,searchValue:ws,open:yn,focused:Ps,showSearch:Sn}}));var yu=function(){var dr;qe==null||qe(),(dr=ko.current)===null||dr===void 0||dr.focus(),bi([],{type:"clear",values:ce}),_r("",!1,!1)},Bl=De(te,yu,ce,di,Kt,ni,ws,Re),aa=Bl.allowClear,zs=Bl.clearIcon,Wr=yt.createElement(Ri,{ref:br}),kl=pt()(te,lt,(Ot={},(0,vt.Z)(Ot,"".concat(te,"-focused"),Ps),(0,vt.Z)(Ot,"".concat(te,"-multiple"),Hi),(0,vt.Z)(Ot,"".concat(te,"-single"),!Hi),(0,vt.Z)(Ot,"".concat(te,"-allow-clear"),di),(0,vt.Z)(Ot,"".concat(te,"-show-arrow"),Ml),(0,vt.Z)(Ot,"".concat(te,"-disabled"),ni),(0,vt.Z)(Ot,"".concat(te,"-loading"),Ut),(0,vt.Z)(Ot,"".concat(te,"-open"),yn),(0,vt.Z)(Ot,"".concat(te,"-customize-input"),It),(0,vt.Z)(Ot,"".concat(te,"-show-search"),Sn),Ot)),xu=yt.createElement(E,{ref:wr,disabled:ni,prefixCls:te,visible:Pn,popupElement:Wr,animation:At,transitionName:vi,dropdownStyle:Qi,dropdownClassName:Ti,direction:Fe,dropdownMatchSelectWidth:gn,dropdownRender:Mn,dropdownAlign:mi,placement:Ye,builtinPlacements:Je,getPopupContainer:Oi,empty:li,getTriggerDOMNode:function(){return xr.current},onPopupVisibleChange:jo,onPopupMouseEnter:fs},Lo?yt.cloneElement(Lo,{ref:Va}):yt.createElement(Ai,(0,Mt.Z)({},nt,{domRef:xr,prefixCls:te,inputElement:It,ref:ko,id:ge,showSearch:Sn,autoClearSearchValue:Ui,mode:Re,activeDescendantId:pi,tagRender:me,values:ce,open:yn,onToggleOpen:ai,activeValue:mt,searchValue:ws,onSearch:_r,onSearchSubmit:ro,onRemove:Io,tokenWithEnter:cr}))),Ll;return Lo?Ll=xu:Ll=yt.createElement("div",(0,Mt.Z)({className:kl},Ji,{ref:ii,onMouseDown:Rs,onKeyDown:An,onKeyUp:Rr,onFocus:on,onBlur:Il}),Ps&&!yn&&yt.createElement("span",{style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0},"aria-live":"polite"},"".concat(ce.map(function(zn){var dr=zn.label,ho=zn.value;return["number","string"].includes((0,Pt.Z)(dr))?dr:ho}).join(", "))),xu,Cl,aa&&zs),yt.createElement($t.Provider,{value:ll},Ll)}),Ei=Si,Ci=function(nt,Z){var xt=yt.useRef({values:new Map,options:new Map}),Ot=yt.useMemo(function(){var te=xt.current,lt=te.values,Qt=te.options,me=nt.map(function(ce){if(ce.label===void 0){var bi;return(0,le.Z)((0,le.Z)({},ce),{},{label:(bi=lt.get(ce.value))===null||bi===void 0?void 0:bi.label})}return ce}),Fe=new Map,Tt=new Map;return me.forEach(function(ce){Fe.set(ce.value,ce),Tt.set(ce.value,Z.get(ce.value)||Qt.get(ce.value))}),xt.current.values=Fe,xt.current.options=Tt,me},[nt,Z]),ge=yt.useCallback(function(te){return Z.get(te)||xt.current.options.get(te)},[Z]);return[Ot,ge]};function qt(nt,Z){return xe(nt).join("").toUpperCase().includes(Z)}var ei=function(nt,Z,xt,Ot,ge){return yt.useMemo(function(){if(!xt||Ot===!1)return nt;var te=Z.options,lt=Z.label,Qt=Z.value,me=[],Fe=typeof Ot=="function",Tt=xt.toUpperCase(),ce=Fe?Ot:function(li,Mi){return ge?qt(Mi[ge],Tt):Mi[te]?qt(Mi[lt!=="children"?lt:"label"],Tt):qt(Mi[Qt],Tt)},bi=Fe?function(li){return ae(li)}:function(li){return li};return nt.forEach(function(li){if(li[te]){var Mi=ce(xt,bi(li));if(Mi)me.push(li);else{var Pe=li[te].filter(function(qe){return ce(xt,bi(qe))});Pe.length&&me.push((0,le.Z)((0,le.Z)({},li),{},(0,vt.Z)({},te,Pe)))}return}ce(xt,bi(li))&&me.push(li)}),me},[nt,Ot,ge,xt,Z])},ln=G(17115),Ft=G(11592),oe=["children","value"],we=["children"];function Ii(nt){var Z=nt,xt=Z.key,Ot=Z.props,ge=Ot.children,te=Ot.value,lt=(0,ft.Z)(Ot,oe);return(0,le.Z)({key:xt,value:te!==void 0?te:xt,children:ge},lt)}function Pi(nt){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return(0,Ft.Z)(nt).map(function(xt,Ot){if(!yt.isValidElement(xt)||!xt.type)return null;var ge=xt,te=ge.type.isSelectOptGroup,lt=ge.key,Qt=ge.props,me=Qt.children,Fe=(0,ft.Z)(Qt,we);return Z||!te?Ii(xt):(0,le.Z)((0,le.Z)({key:"__RC_SELECT_GRP__".concat(lt===null?Ot:lt,"__"),label:lt},Fe),{},{options:Pi(me)})}).filter(function(xt){return xt})}function _i(nt,Z,xt,Ot,ge){return yt.useMemo(function(){var te=nt,lt=!nt;lt&&(te=Pi(Z));var Qt=new Map,me=new Map,Fe=function(bi,li,Mi){Mi&&typeof Mi=="string"&&bi.set(li[Mi],li)};function Tt(ce){for(var bi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,li=0;li<ce.length;li+=1){var Mi=ce[li];!Mi[xt.options]||bi?(Qt.set(Mi[xt.value],Mi),Fe(me,Mi,xt.label),Fe(me,Mi,Ot),Fe(me,Mi,ge)):Tt(Mi[xt.options],!0)}}return Tt(te),{options:te,valueOptions:Qt,labelOptions:me}},[nt,Z,xt,Ot,ge])}function hn(nt){var Z=yt.useRef();Z.current=nt;var xt=yt.useCallback(function(){return Z.current.apply(Z,arguments)},[]);return xt}var mn=function(){return null};mn.isSelectOptGroup=!0;var Ln=mn,jn=function(){return null};jn.isSelectOption=!0;var On=jn,rn=G(80547),ir=G(2738),tr=G(6790),hr=yt.createContext(null),Er=hr;function Hn(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var Ir=["disabled","title","children","style","className"];function T(nt){return typeof nt=="string"||typeof nt=="number"}var ur=function(Z,xt){var Ot=Xt(),ge=Ot.prefixCls,te=Ot.id,lt=Ot.open,Qt=Ot.multiple,me=Ot.mode,Fe=Ot.searchValue,Tt=Ot.toggleOpen,ce=Ot.notFoundContent,bi=Ot.onPopupScroll,li=yt.useContext(Er),Mi=li.flattenOptions,Pe=li.onActiveValue,qe=li.defaultActiveFirstOption,Re=li.onSelect,ni=li.menuItemSelectedIcon,Ut=li.rawValues,Wt=li.fieldNames,Dt=li.virtual,ke=li.direction,re=li.listHeight,Ie=li.listItemHeight,mt="".concat(ge,"-item"),Xe=(0,rn.Z)(function(){return Mi},[lt,Mi],function(mi,Ye){return Ye[0]&&mi[1]!==Ye[1]}),pi=yt.useRef(null),ci=function(Ye){Ye.preventDefault()},Ui=function(Ye){pi.current&&pi.current.scrollTo(typeof Ye=="number"?{index:Ye}:Ye)},Ni=function(Ye){for(var Je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Oi=Xe.length,pe=0;pe<Oi;pe+=1){var z=(Ye+pe*Je+Oi)%Oi,fn=Xe[z],vn=fn.group,Qn=fn.data;if(!vn&&!Qn.disabled)return z}return-1},Gi=yt.useState(function(){return Ni(0)}),ki=(0,ut.Z)(Gi,2),di=ki[0],Ki=ki[1],Kt=function(Ye){var Je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;Ki(Ye);var Oi={source:Je?"keyboard":"mouse"},pe=Xe[Ye];if(!pe){Pe(null,-1,Oi);return}Pe(pe.value,Ye,Oi)};(0,yt.useEffect)(function(){Kt(qe!==!1?Ni(0):-1)},[Xe.length,Fe]);var Ri=yt.useCallback(function(mi){return Ut.has(mi)&&me!=="combobox"},[me,(0,kt.Z)(Ut).toString(),Ut.size]);(0,yt.useEffect)(function(){var mi=setTimeout(function(){if(!Qt&&lt&&Ut.size===1){var Je=Array.from(Ut)[0],Oi=Xe.findIndex(function(pe){var z=pe.data;return z.value===Je});Oi!==-1&&(Kt(Oi),Ui(Oi))}});if(lt){var Ye;(Ye=pi.current)===null||Ye===void 0||Ye.scrollTo(void 0)}return function(){return clearTimeout(mi)}},[lt,Fe,Mi.length]);var At=function(Ye){Ye!==void 0&&Re(Ye,{selected:!Ut.has(Ye)}),Qt||Tt(!1)};if(yt.useImperativeHandle(xt,function(){return{onKeyDown:function(Ye){var Je=Ye.which,Oi=Ye.ctrlKey;switch(Je){case jt.Z.N:case jt.Z.P:case jt.Z.UP:case jt.Z.DOWN:{var pe=0;if(Je===jt.Z.UP?pe=-1:Je===jt.Z.DOWN?pe=1:Hn()&&Oi&&(Je===jt.Z.N?pe=1:Je===jt.Z.P&&(pe=-1)),pe!==0){var z=Ni(di+pe,pe);Ui(z),Kt(z,!0)}break}case jt.Z.ENTER:{var fn=Xe[di];fn&&!fn.data.disabled?At(fn.value):At(void 0),lt&&Ye.preventDefault();break}case jt.Z.ESC:Tt(!1),lt&&Ye.stopPropagation()}},onKeyUp:function(){},scrollTo:function(Ye){Ui(Ye)}}}),Xe.length===0)return yt.createElement("div",{role:"listbox",id:"".concat(te,"_list"),className:"".concat(mt,"-empty"),onMouseDown:ci},ce);var vi=Object.keys(Wt).map(function(mi){return Wt[mi]}),Qi=function(Ye){return Ye.label};function Ti(mi,Ye){var Je=mi.group;return{role:Je?"presentation":"option",id:"".concat(te,"_list_").concat(Ye)}}var gn=function(Ye){var Je=Xe[Ye];if(!Je)return null;var Oi=Je.data||{},pe=Oi.value,z=Je.group,fn=(0,Bt.Z)(Oi,!0),vn=Qi(Je);return Je?yt.createElement("div",(0,Mt.Z)({"aria-label":typeof vn=="string"&&!z?vn:null},fn,{key:Ye},Ti(Je,Ye),{"aria-selected":Ri(pe)}),pe):null},Mn={role:"listbox",id:"".concat(te,"_list")};return yt.createElement(yt.Fragment,null,Dt&&yt.createElement("div",(0,Mt.Z)({},Mn,{style:{height:0,width:0,overflow:"hidden"}}),gn(di-1),gn(di),gn(di+1)),yt.createElement(tr.Z,{itemKey:"key",ref:pi,data:Xe,height:re,itemHeight:Ie,fullHeight:!1,onMouseDown:ci,onScroll:bi,virtual:Dt,direction:ke,innerProps:Dt?null:Mn},function(mi,Ye){var Je,Oi=mi.group,pe=mi.groupOption,z=mi.data,fn=mi.label,vn=mi.value,Qn=z.key;if(Oi){var Kn,Ar=(Kn=z.title)!==null&&Kn!==void 0?Kn:T(fn)?fn.toString():void 0;return yt.createElement("div",{className:pt()(mt,"".concat(mt,"-group")),title:Ar},fn!==void 0?fn:Qn)}var tn=z.disabled,Hi=z.title,Sn=z.children,Ji=z.style,Fn=z.className,Xr=(0,ft.Z)(z,Ir),no=(0,ir.Z)(Xr,vi),Jn=Ri(vn),ii="".concat(mt,"-option"),xr=pt()(mt,ii,Fn,(Je={},(0,vt.Z)(Je,"".concat(ii,"-grouped"),pe),(0,vt.Z)(Je,"".concat(ii,"-active"),di===Ye&&!tn),(0,vt.Z)(Je,"".concat(ii,"-disabled"),tn),(0,vt.Z)(Je,"".concat(ii,"-selected"),Jn),Je)),wr=Qi(mi),ko=!ni||typeof ni=="function"||Jn,br=typeof wr=="number"?wr:wr||vn,po=T(br)?br.toString():void 0;return Hi!==void 0&&(po=Hi),yt.createElement("div",(0,Mt.Z)({},(0,Bt.Z)(no),Dt?{}:Ti(mi,Ye),{"aria-selected":Jn,className:xr,title:po,onMouseMove:function(){di===Ye||tn||Kt(Ye)},onClick:function(){tn||At(vn)},style:Ji}),yt.createElement("div",{className:"".concat(ii,"-content")},br),yt.isValidElement(ni)||Jn,ko&&yt.createElement(de,{className:"".concat(mt,"-option-state"),customizeIcon:ni,customizeIconProps:{isSelected:Jn}},Jn?"\u2713":null))}))},$n=yt.forwardRef(ur);$n.displayName="OptionList";var Yn=$n;function Nr(nt){var Z=nt.mode,xt=nt.options,Ot=nt.children,ge=nt.backfill,te=nt.allowClear,lt=nt.placeholder,Qt=nt.getInputElement,me=nt.showSearch,Fe=nt.onSearch,Tt=nt.defaultOpen,ce=nt.autoFocus,bi=nt.labelInValue,li=nt.value,Mi=nt.inputValue,Pe=nt.optionLabelProp,qe=isMultiple(Z),Re=me!==void 0?me:qe||Z==="combobox",ni=xt||convertChildrenToData(Ot);if(warning(Z!=="tags"||ni.every(function(ke){return!ke.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),Z==="tags"||Z==="combobox"){var Ut=ni.some(function(ke){return ke.options?ke.options.some(function(re){return typeof("value"in re?re.value:re.key)=="number"}):typeof("value"in ke?ke.value:ke.key)=="number"});warning(!Ut,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(warning(Z!=="combobox"||!Pe,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),warning(Z==="combobox"||!ge,"`backfill` only works with `combobox` mode."),warning(Z==="combobox"||!Qt,"`getInputElement` only work with `combobox` mode."),noteOnce(Z!=="combobox"||!Qt||!te||!lt,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Fe&&!Re&&Z!=="combobox"&&Z!=="tags"&&warning(!1,"`onSearch` should work with `showSearch` instead of use alone."),noteOnce(!Tt||ce,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),li!=null){var Wt=toArray(li);warning(!bi||Wt.every(function(ke){return _typeof(ke)==="object"&&("key"in ke||"value"in ke)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),warning(!qe||Array.isArray(li),"`value` should be array when `mode` is `multiple` or `tags`")}if(Ot){var Dt=null;toNodeArray(Ot).some(function(ke){if(!React.isValidElement(ke)||!ke.type)return!1;var re=ke,Ie=re.type;if(Ie.isSelectOption)return!1;if(Ie.isSelectOptGroup){var mt=toNodeArray(ke.props.children).every(function(Xe){return!React.isValidElement(Xe)||!ke.type||Xe.type.isSelectOption?!0:(Dt=Xe.type,!1)});return!mt}return Dt=Ie,!0}),Dt&&warning(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Dt.displayName||Dt.name||Dt,"`.")),warning(Mi===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}function Gn(nt,Z){if(nt){var xt=function Ot(ge){for(var te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,lt=0;lt<ge.length;lt++){var Qt=ge[lt];if(Qt[Z==null?void 0:Z.value]===null)return warning(!1,"`value` in Select options should not be `null`."),!0;if(!te&&Array.isArray(Qt[Z==null?void 0:Z.options])&&Ot(Qt[Z==null?void 0:Z.options],!0))break}};xt(nt)}}var uo=null,zo=["id","mode","prefixCls","backfill","fieldNames","inputValue","searchValue","onSearch","autoClearSearchValue","onSelect","onDeselect","dropdownMatchSelectWidth","filterOption","filterSort","optionFilterProp","optionLabelProp","options","children","defaultActiveFirstOption","menuItemSelectedIcon","virtual","direction","listHeight","listItemHeight","value","defaultValue","labelInValue","onChange"],gr=["inputValue"];function pn(nt){return!nt||(0,Pt.Z)(nt)!=="object"}var gi=yt.forwardRef(function(nt,Z){var xt=nt.id,Ot=nt.mode,ge=nt.prefixCls,te=ge===void 0?"rc-select":ge,lt=nt.backfill,Qt=nt.fieldNames,me=nt.inputValue,Fe=nt.searchValue,Tt=nt.onSearch,ce=nt.autoClearSearchValue,bi=ce===void 0?!0:ce,li=nt.onSelect,Mi=nt.onDeselect,Pe=nt.dropdownMatchSelectWidth,qe=Pe===void 0?!0:Pe,Re=nt.filterOption,ni=nt.filterSort,Ut=nt.optionFilterProp,Wt=nt.optionLabelProp,Dt=nt.options,ke=nt.children,re=nt.defaultActiveFirstOption,Ie=nt.menuItemSelectedIcon,mt=nt.virtual,Xe=nt.direction,pi=nt.listHeight,ci=pi===void 0?200:pi,Ui=nt.listItemHeight,Ni=Ui===void 0?20:Ui,Gi=nt.value,ki=nt.defaultValue,di=nt.labelInValue,Ki=nt.onChange,Kt=(0,ft.Z)(nt,zo),Ri=(0,ln.ZP)(xt),At=He(Ot),vi=!!(!Dt&&ke),Qi=yt.useMemo(function(){return Re===void 0&&Ot==="combobox"?!1:Re},[Re,Ot]),Ti=yt.useMemo(function(){return D(Qt,vi)},[JSON.stringify(Qt),vi]),gn=(0,Q.Z)("",{value:Fe!==void 0?Fe:me,postState:function(Xn){return Xn||""}}),Mn=(0,ut.Z)(gn,2),mi=Mn[0],Ye=Mn[1],Je=_i(Dt,ke,Ti,Ut,Wt),Oi=Je.valueOptions,pe=Je.labelOptions,z=Je.options,fn=yt.useCallback(function(yn){var Xn=xe(yn);return Xn.map(function(Pn){var ai,cr,_r,ro,Eo;if(pn(Pn))ai=Pn;else{var Do;_r=Pn.key,cr=Pn.label,ai=(Do=Pn.value)!==null&&Do!==void 0?Do:_r}var Ze=Oi.get(ai);if(Ze){var Nn;if(cr===void 0&&(cr=Ze==null?void 0:Ze[Wt||Ti.label]),_r===void 0&&(_r=(Nn=Ze==null?void 0:Ze.key)!==null&&Nn!==void 0?Nn:ai),ro=Ze==null?void 0:Ze.disabled,Eo=Ze==null?void 0:Ze.title,0)var An}return{label:cr,value:ai,key:_r,disabled:ro,title:Eo}})},[Ti,Wt,Oi]),vn=(0,Q.Z)(ki,{value:Gi}),Qn=(0,ut.Z)(vn,2),Kn=Qn[0],Ar=Qn[1],tn=yt.useMemo(function(){var yn,Xn=fn(Kn);return Ot==="combobox"&&je((yn=Xn[0])===null||yn===void 0?void 0:yn.value)?[]:Xn},[Kn,fn,Ot]),Hi=Ci(tn,Oi),Sn=(0,ut.Z)(Hi,2),Ji=Sn[0],Fn=Sn[1],Xr=yt.useMemo(function(){if(!Ot&&Ji.length===1){var yn=Ji[0];if(yn.value===null&&(yn.label===null||yn.label===void 0))return[]}return Ji.map(function(Xn){var Pn;return(0,le.Z)((0,le.Z)({},Xn),{},{label:(Pn=Xn.label)!==null&&Pn!==void 0?Pn:Xn.value})})},[Ot,Ji]),no=yt.useMemo(function(){return new Set(Ji.map(function(yn){return yn.value}))},[Ji]);yt.useEffect(function(){if(Ot==="combobox"){var yn,Xn=(yn=Ji[0])===null||yn===void 0?void 0:yn.value;Ye(ti(Xn)?String(Xn):"")}},[Ji]);var Jn=hn(function(yn,Xn){var Pn,ai=Xn!=null?Xn:yn;return Pn={},(0,vt.Z)(Pn,Ti.value,yn),(0,vt.Z)(Pn,Ti.label,ai),Pn}),ii=yt.useMemo(function(){if(Ot!=="tags")return z;var yn=(0,kt.Z)(z),Xn=function(ai){return Oi.has(ai)};return(0,kt.Z)(Ji).sort(function(Pn,ai){return Pn.value<ai.value?-1:1}).forEach(function(Pn){var ai=Pn.value;Xn(ai)||yn.push(Jn(ai,Pn.label))}),yn},[Jn,z,Oi,Ji,Ot]),xr=ei(ii,Ti,mi,Qi,Ut),wr=yt.useMemo(function(){return Ot!=="tags"||!mi||xr.some(function(yn){return yn[Ut||"value"]===mi})||xr.some(function(yn){return yn[Ti.value]===mi})?xr:[Jn(mi)].concat((0,kt.Z)(xr))},[Jn,Ut,Ot,xr,mi,Ti]),ko=yt.useMemo(function(){return ni?(0,kt.Z)(wr).sort(function(yn,Xn){return ni(yn,Xn)}):wr},[wr,ni]),br=yt.useMemo(function(){return St(ko,{fieldNames:Ti,childrenAsData:vi})},[ko,Ti,vi]),po=function(Xn){var Pn=fn(Xn);if(Ar(Pn),Ki&&(Pn.length!==Ji.length||Pn.some(function(_r,ro){var Eo;return((Eo=Ji[ro])===null||Eo===void 0?void 0:Eo.value)!==(_r==null?void 0:_r.value)}))){var ai=di?Pn:Pn.map(function(_r){return _r.value}),cr=Pn.map(function(_r){return ae(Fn(_r.value))});Ki(At?ai:ai[0],At?cr:cr[0])}},ds=yt.useState(null),Ps=(0,ut.Z)(ds,2),xs=Ps[0],Ns=Ps[1],ws=yt.useState(0),It=(0,ut.Z)(ws,2),Lo=It[0],Va=It[1],Ia=re!==void 0?re:Ot!=="combobox",Xs=yt.useCallback(function(yn,Xn){var Pn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ai=Pn.source,cr=ai===void 0?"keyboard":ai;Va(Xn),lt&&Ot==="combobox"&&yn!==null&&cr==="keyboard"&&Ns(String(yn))},[lt,Ot]),Ao=function(Xn,Pn,ai){var cr=function(){var Oo,on=Fn(Xn);return[di?{label:on==null?void 0:on[Ti.label],value:Xn,key:(Oo=on==null?void 0:on.key)!==null&&Oo!==void 0?Oo:Xn}:Xn,ae(on)]};if(Pn&&li){var _r=cr(),ro=(0,ut.Z)(_r,2),Eo=ro[0],Do=ro[1];li(Eo,Do)}else if(!Pn&&Mi&&ai!=="clear"){var Ze=cr(),Nn=(0,ut.Z)(Ze,2),An=Nn[0],Rr=Nn[1];Mi(An,Rr)}},al=hn(function(yn,Xn){var Pn,ai=At?Xn.selected:!0;ai?Pn=At?[].concat((0,kt.Z)(Ji),[yn]):[yn]:Pn=Ji.filter(function(cr){return cr.value!==yn}),po(Pn),Ao(yn,ai),Ot==="combobox"?Ns(""):(!He||bi)&&(Ye(""),Ns(""))}),oa=function(Xn,Pn){po(Xn);var ai=Pn.type,cr=Pn.values;(ai==="remove"||ai==="clear")&&cr.forEach(function(_r){Ao(_r.value,!1,ai)})},vr=function(Xn,Pn){if(Ye(Xn),Ns(null),Pn.source==="submit"){var ai=(Xn||"").trim();if(ai){var cr=Array.from(new Set([].concat((0,kt.Z)(no),[ai])));po(cr),Ao(ai,!0),Ye("")}return}Pn.source!=="blur"&&(Ot==="combobox"&&po(Xn),Tt==null||Tt(Xn))},jr=function(Xn){var Pn=Xn;Ot!=="tags"&&(Pn=Xn.map(function(cr){var _r=pe.get(cr);return _r==null?void 0:_r.value}).filter(function(cr){return cr!==void 0}));var ai=Array.from(new Set([].concat((0,kt.Z)(no),(0,kt.Z)(Pn))));po(ai),ai.forEach(function(cr){Ao(cr,!0)})},ya=yt.useMemo(function(){var yn=mt!==!1&&qe!==!1;return(0,le.Z)((0,le.Z)({},Je),{},{flattenOptions:br,onActiveValue:Xs,defaultActiveFirstOption:Ia,onSelect:al,menuItemSelectedIcon:Ie,rawValues:no,fieldNames:Ti,virtual:yn,direction:Xe,listHeight:ci,listItemHeight:Ni,childrenAsData:vi})},[Je,br,Xs,Ia,al,Ie,no,Ti,mt,qe,ci,Ni,vi]);return yt.createElement(Er.Provider,{value:ya},yt.createElement(Ei,(0,Mt.Z)({},Kt,{id:Ri,prefixCls:te,ref:Z,omitDomProps:gr,mode:Ot,displayValues:Xr,onDisplayValuesChange:oa,direction:Xe,searchValue:mi,onSearch:vr,autoClearSearchValue:bi,onSearchSplit:jr,dropdownMatchSelectWidth:qe,OptionList:Yn,emptyOptions:!br.length,activeValue:xs,activeDescendantId:"".concat(Ri,"_list_").concat(Lo)})))}),ct=gi;ct.Option=On,ct.OptGroup=Ln;var J=ct,ot=J},9296:function(qn,Li,G){"use strict";G.r(Li),G.d(Li,{ResizableTextArea:function(){return We},default:function(){return je}});var Mt=G(32855),kt=G(27247),vt=G(74430),le=G(34666),ut=G(11913),ft=G(43079),Pt=G(3300),Q=G(92310),rt=G.n(Q),yt=G(93681),be=G(5643),pt=G(18929),Rt=G(59301),Ce=G(29301),jt=G(34280),Jt=G(16089),Ht=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important;
pointer-events: none !important;
`,de=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],De={},$t;function Xt(Be){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,dt=Be.getAttribute("id")||Be.getAttribute("data-reactid")||Be.getAttribute("name");if(Se&&De[dt])return De[dt];var W=window.getComputedStyle(Be),Zt=W.getPropertyValue("box-sizing")||W.getPropertyValue("-moz-box-sizing")||W.getPropertyValue("-webkit-box-sizing"),ze=parseFloat(W.getPropertyValue("padding-bottom"))+parseFloat(W.getPropertyValue("padding-top")),Me=parseFloat(W.getPropertyValue("border-bottom-width"))+parseFloat(W.getPropertyValue("border-top-width")),ye=de.map(function(Ue){return"".concat(Ue,":").concat(W.getPropertyValue(Ue))}).join(";"),se={sizingStyle:ye,paddingSize:ze,borderSize:Me,boxSizing:Zt};return Se&&dt&&(De[dt]=se),se}function Ct(Be){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,W=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;$t||($t=document.createElement("textarea"),$t.setAttribute("tab-index","-1"),$t.setAttribute("aria-hidden","true"),document.body.appendChild($t)),Be.getAttribute("wrap")?$t.setAttribute("wrap",Be.getAttribute("wrap")):$t.removeAttribute("wrap");var Zt=Xt(Be,Se),ze=Zt.paddingSize,Me=Zt.borderSize,ye=Zt.boxSizing,se=Zt.sizingStyle;$t.setAttribute("style","".concat(se,";").concat(Ht)),$t.value=Be.value||Be.placeholder||"";var Ue=void 0,Fi=void 0,wi,Ai=$t.scrollHeight;if(ye==="border-box"?Ai+=Me:ye==="content-box"&&(Ai-=ze),dt!==null||W!==null){$t.value=" ";var ri=$t.scrollHeight-ze;dt!==null&&(Ue=ri*dt,ye==="border-box"&&(Ue=Ue+ze+Me),Ai=Math.max(Ue,Ai)),W!==null&&(Fi=ri*W,ye==="border-box"&&(Fi=Fi+ze+Me),wi=Ai>Fi?"":"hidden",Ai=Math.min(Fi,Ai))}var sn={height:Ai,overflowY:wi,resize:"none"};return Ue&&(sn.minHeight=Ue),Fi&&(sn.maxHeight=Fi),sn}var q=["prefixCls","onPressEnter","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],Et=0,Bt=1,ve=2,Vt=Rt.forwardRef(function(Be,Se){var dt=Be,W=dt.prefixCls,Zt=dt.onPressEnter,ze=dt.defaultValue,Me=dt.value,ye=dt.autoSize,se=dt.onResize,Ue=dt.className,Fi=dt.style,wi=dt.disabled,Ai=dt.onChange,ri=dt.onInternalAutoSize,sn=(0,ft.Z)(dt,q),Zi=(0,pt.Z)(ze,{value:Me,postState:function(Ln){return Ln!=null?Ln:""}}),j=(0,ut.Z)(Zi,2),P=j[0],E=j[1],B=function(Ln){E(Ln.target.value),Ai==null||Ai(Ln)},U=Rt.useRef();Rt.useImperativeHandle(Se,function(){return{textArea:U.current}});var D=Rt.useMemo(function(){return ye&&(0,le.Z)(ye)==="object"?[ye.minRows,ye.maxRows]:[]},[ye]),St=(0,ut.Z)(D,2),ae=St[0],$e=St[1],Ae=!!ye,Qe=function(){try{if(document.activeElement===U.current){var Ln=U.current,jn=Ln.selectionStart,On=Ln.selectionEnd,rn=Ln.scrollTop;U.current.setSelectionRange(jn,On),U.current.scrollTop=rn}}catch(ir){}},He=Rt.useState(ve),Si=(0,ut.Z)(He,2),Ei=Si[0],Ci=Si[1],qt=Rt.useState(),ei=(0,ut.Z)(qt,2),ln=ei[0],Ft=ei[1],oe=function(){Ci(Et)};(0,jt.Z)(function(){Ae&&oe()},[Me,ae,$e,Ae]),(0,jt.Z)(function(){if(Ei===Et)Ci(Bt);else if(Ei===Bt){var mn=Ct(U.current,!1,ae,$e);Ci(ve),Ft(mn)}else Qe()},[Ei]);var we=Rt.useRef(),Ii=function(){Jt.Z.cancel(we.current)},Pi=function(Ln){Ei===ve&&(se==null||se(Ln),ye&&(Ii(),we.current=(0,Jt.Z)(function(){oe()})))};Rt.useEffect(function(){return Ii},[]);var _i=Ae?ln:null,hn=(0,kt.Z)((0,kt.Z)({},Fi),_i);return(Ei===Et||Ei===Bt)&&(hn.overflowY="hidden",hn.overflowX="hidden"),Rt.createElement(Ce.Z,{onResize:Pi,disabled:!(ye||se)},Rt.createElement("textarea",(0,Mt.Z)({},sn,{ref:U,style:hn,className:rt()(W,Ue,(0,vt.Z)({},"".concat(W,"-disabled"),wi)),disabled:wi,value:P,onChange:B})))}),We=Vt,ee=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","classes","showCount","className","style","disabled","hidden","classNames","styles","onResize"];function xe(Be,Se){return(0,Pt.Z)(Be||"").slice(0,Se).join("")}function Nt(Be,Se,dt,W){var Zt=dt;return Be?Zt=xe(dt,W):(0,Pt.Z)(Se||"").length<dt.length&&(0,Pt.Z)(dt||"").length>W&&(Zt=Se),Zt}var _e=Rt.forwardRef(function(Be,Se){var dt,W=Be.defaultValue,Zt=Be.value,ze=Be.onFocus,Me=Be.onBlur,ye=Be.onChange,se=Be.allowClear,Ue=Be.maxLength,Fi=Be.onCompositionStart,wi=Be.onCompositionEnd,Ai=Be.suffix,ri=Be.prefixCls,sn=ri===void 0?"rc-textarea":ri,Zi=Be.classes,j=Be.showCount,P=Be.className,E=Be.style,B=Be.disabled,U=Be.hidden,D=Be.classNames,St=Be.styles,ae=Be.onResize,$e=(0,ft.Z)(Be,ee),Ae=(0,pt.Z)(W,{value:Zt,defaultValue:W}),Qe=(0,ut.Z)(Ae,2),He=Qe[0],Si=Qe[1],Ei=(0,Rt.useRef)(null),Ci=Rt.useState(!1),qt=(0,ut.Z)(Ci,2),ei=qt[0],ln=qt[1],Ft=Rt.useState(!1),oe=(0,ut.Z)(Ft,2),we=oe[0],Ii=oe[1],Pi=Rt.useRef(),_i=Rt.useRef(0),hn=Rt.useState(null),mn=(0,ut.Z)(hn,2),Ln=mn[0],jn=mn[1],On=function(){var pn;(pn=Ei.current)===null||pn===void 0||pn.textArea.focus()};(0,Rt.useImperativeHandle)(Se,function(){return{resizableTextArea:Ei.current,focus:On,blur:function(){var pn;(pn=Ei.current)===null||pn===void 0||pn.textArea.blur()}}}),(0,Rt.useEffect)(function(){ln(function(gr){return!B&&gr})},[B]);var rn=Number(Ue)>0,ir=function(pn){Ii(!0),Pi.current=He,_i.current=pn.currentTarget.selectionStart,Fi==null||Fi(pn)},tr=function(pn){Ii(!1);var gi=pn.currentTarget.value;if(rn){var ct,J=_i.current>=Ue+1||_i.current===((ct=Pi.current)===null||ct===void 0?void 0:ct.length);gi=Nt(J,Pi.current,gi,Ue)}gi!==He&&(Si(gi),(0,be.rJ)(pn.currentTarget,pn,ye,gi)),wi==null||wi(pn)},hr=function(pn){var gi=pn.target.value;if(!we&&rn){var ct=pn.target.selectionStart>=Ue+1||pn.target.selectionStart===gi.length||!pn.target.selectionStart;gi=Nt(ct,He,gi,Ue)}Si(gi),(0,be.rJ)(pn.currentTarget,pn,ye,gi)},Er=function(pn){var gi=$e.onPressEnter,ct=$e.onKeyDown;pn.key==="Enter"&&gi&&gi(pn),ct==null||ct(pn)},Hn=function(pn){ln(!0),ze==null||ze(pn)},Ir=function(pn){ln(!1),Me==null||Me(pn)},T=function(pn){var gi;Si(""),On(),(0,be.rJ)((gi=Ei.current)===null||gi===void 0?void 0:gi.textArea,pn,ye)},ur=(0,be.D7)(He);!we&&rn&&Zt==null&&(ur=xe(ur,Ue));var $n=Ai,Yn;if(j){var Nr=(0,Pt.Z)(ur).length;(0,le.Z)(j)==="object"?Yn=j.formatter({value:ur,count:Nr,maxLength:Ue}):Yn="".concat(Nr).concat(rn?" / ".concat(Ue):""),$n=Rt.createElement(Rt.Fragment,null,$n,Rt.createElement("span",{className:rt()("".concat(sn,"-data-count"),D==null?void 0:D.count),style:St==null?void 0:St.count},Yn))}var Gn=function(pn){var gi;ae==null||ae(pn),(gi=Ei.current)!==null&&gi!==void 0&&gi.textArea.style.height&&jn(!0)},uo=!$e.autoSize&&!j&&!se,zo=Rt.createElement(yt.BaseInput,{value:ur,allowClear:se,handleReset:T,suffix:$n,prefixCls:sn,classes:{affixWrapper:rt()(Zi==null?void 0:Zi.affixWrapper,(dt={},(0,vt.Z)(dt,"".concat(sn,"-show-count"),j),(0,vt.Z)(dt,"".concat(sn,"-textarea-allow-clear"),se),dt))},disabled:B,focused:ei,className:P,style:(0,kt.Z)((0,kt.Z)({},E),Ln&&!uo?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof Yn=="string"?Yn:void 0}},hidden:U,inputElement:Rt.createElement(We,(0,Mt.Z)({},$e,{onKeyDown:Er,onChange:hr,onFocus:Hn,onBlur:Ir,onCompositionStart:ir,onCompositionEnd:tr,className:D==null?void 0:D.textarea,style:(0,kt.Z)((0,kt.Z)({},St==null?void 0:St.textarea),{},{resize:E==null?void 0:E.resize}),disabled:B,prefixCls:sn,onResize:Gn,ref:Ei}))});return zo}),ti=_e,je=ti},6790:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Zi}});var Mt=G(32855),kt=G(34666),vt=G(27247),le=G(74430),ut=G(11913),ft=G(43079),Pt=G(92310),Q=G.n(Pt),rt=G(29301),yt=G(70425),be=G(34280),pt=G(59301),Rt=G(4676),Ce=pt.forwardRef(function(j,P){var E=j.height,B=j.offsetY,U=j.offsetX,D=j.children,St=j.prefixCls,ae=j.onInnerResize,$e=j.innerProps,Ae=j.rtl,Qe=j.extra,He={},Si={display:"flex",flexDirection:"column"};return B!==void 0&&(He={height:E,position:"relative",overflow:"hidden"},Si=(0,vt.Z)((0,vt.Z)({},Si),{},(0,le.Z)((0,le.Z)((0,le.Z)((0,le.Z)((0,le.Z)({transform:"translateY(".concat(B,"px)")},Ae?"marginRight":"marginLeft",-U),"position","absolute"),"left",0),"right",0),"top",0))),pt.createElement("div",{style:He},pt.createElement(rt.Z,{onResize:function(Ci){var qt=Ci.offsetHeight;qt&&ae&&ae()}},pt.createElement("div",(0,Mt.Z)({style:Si,className:Q()((0,le.Z)({},"".concat(St,"-holder-inner"),St)),ref:P},$e),D,Qe)))});Ce.displayName="Filler";var jt=Ce;function Jt(j){var P=j.children,E=j.setRef,B=pt.useCallback(function(U){E(U)},[]);return pt.cloneElement(P,{ref:B})}function Ht(j,P,E,B,U,D,St,ae){var $e=ae.getKey;return j.slice(P,E+1).map(function(Ae,Qe){var He=P+Qe,Si=St(Ae,He,{style:{width:B},offsetX:U}),Ei=$e(Ae);return pt.createElement(Jt,{key:Ei,setRef:function(qt){return D(Ae,qt)}},Si)})}function de(j,P,E,B){var U=E-j,D=P-E,St=Math.min(U,D)*2;if(B<=St){var ae=Math.floor(B/2);return B%2?E+ae+1:E-ae}return U>D?E-(B-D):E+(B-U)}function De(j,P,E){var B=j.length,U=P.length,D,St;if(B===0&&U===0)return null;B<U?(D=j,St=P):(D=P,St=j);var ae={__EMPTY_ITEM__:!0};function $e(Ci){return Ci!==void 0?E(Ci):ae}for(var Ae=null,Qe=Math.abs(B-U)!==1,He=0;He<St.length;He+=1){var Si=$e(D[He]),Ei=$e(St[He]);if(Si!==Ei){Ae=He,Qe=Qe||Si!==$e(St[He+1]);break}}return Ae===null?null:{index:Ae,multiple:Qe}}function $t(j,P,E){var B=pt.useState(j),U=(0,ut.Z)(B,2),D=U[0],St=U[1],ae=pt.useState(null),$e=(0,ut.Z)(ae,2),Ae=$e[0],Qe=$e[1];return pt.useEffect(function(){var He=De(D||[],j||[],P);(He==null?void 0:He.index)!==void 0&&(E==null||E(He.index),Qe(j[He.index])),St(j)},[j]),[Ae]}var Xt=G(16089),Ct=(typeof navigator=="undefined"?"undefined":(0,kt.Z)(navigator))==="object"&&/Firefox/i.test(navigator.userAgent),q=Ct,Et=function(j,P,E,B){var U=(0,pt.useRef)(!1),D=(0,pt.useRef)(null);function St(){clearTimeout(D.current),U.current=!0,D.current=setTimeout(function(){U.current=!1},50)}var ae=(0,pt.useRef)({top:j,bottom:P,left:E,right:B});return ae.current.top=j,ae.current.bottom=P,ae.current.left=E,ae.current.right=B,function($e,Ae){var Qe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,He=$e?Ae<0&&ae.current.left||Ae>0&&ae.current.right:Ae<0&&ae.current.top||Ae>0&&ae.current.bottom;return Qe&&He?(clearTimeout(D.current),U.current=!1):(!He||U.current)&&St(),!U.current&&He}};function Bt(j,P,E,B,U,D,St){var ae=(0,pt.useRef)(0),$e=(0,pt.useRef)(null),Ae=(0,pt.useRef)(null),Qe=(0,pt.useRef)(!1),He=Et(P,E,B,U);function Si(Ft,oe){if(Xt.Z.cancel($e.current),!He(!1,oe)){var we=Ft;if(!we._virtualHandled)we._virtualHandled=!0;else return;ae.current+=oe,Ae.current=oe,q||we.preventDefault(),$e.current=(0,Xt.Z)(function(){var Ii=Qe.current?10:1;St(ae.current*Ii,!1),ae.current=0})}}function Ei(Ft,oe){St(oe,!0),q||Ft.preventDefault()}var Ci=(0,pt.useRef)(null),qt=(0,pt.useRef)(null);function ei(Ft){if(j){Xt.Z.cancel(qt.current),qt.current=(0,Xt.Z)(function(){Ci.current=null},2);var oe=Ft.deltaX,we=Ft.deltaY,Ii=Ft.shiftKey,Pi=oe,_i=we;(Ci.current==="sx"||!Ci.current&&Ii&&we&&!oe)&&(Pi=we,_i=0,Ci.current="sx");var hn=Math.abs(Pi),mn=Math.abs(_i);Ci.current===null&&(Ci.current=D&&hn>mn?"x":"y"),Ci.current==="y"?Si(Ft,_i):Ei(Ft,Pi)}}function ln(Ft){j&&(Qe.current=Ft.detail===Ae.current)}return[ei,ln]}function ve(j,P,E,B){var U=pt.useMemo(function(){return[new Map,[]]},[j,E.id,B]),D=(0,ut.Z)(U,2),St=D[0],ae=D[1],$e=function(Qe){var He=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Qe,Si=St.get(Qe),Ei=St.get(He);if(Si===void 0||Ei===void 0)for(var Ci=j.length,qt=ae.length;qt<Ci;qt+=1){var ei,ln=j[qt],Ft=P(ln);St.set(Ft,qt);var oe=(ei=E.get(Ft))!==null&&ei!==void 0?ei:B;if(ae[qt]=(ae[qt-1]||0)+oe,Ft===Qe&&(Si=qt),Ft===He&&(Ei=qt),Si!==void 0&&Ei!==void 0)break}return{top:ae[Si-1]||0,bottom:ae[Ei]}};return $e}var Vt=G(33377),We=G(93912),ee=function(){function j(){(0,Vt.Z)(this,j),(0,le.Z)(this,"maps",void 0),(0,le.Z)(this,"id",0),(0,le.Z)(this,"diffRecords",new Map),this.maps=Object.create(null)}return(0,We.Z)(j,[{key:"set",value:function(E,B){this.diffRecords.set(E,this.maps[E]),this.maps[E]=B,this.id+=1}},{key:"get",value:function(E){return this.maps[E]}},{key:"resetRecord",value:function(){this.diffRecords.clear()}},{key:"getRecord",value:function(){return this.diffRecords}}]),j}(),xe=ee;function Nt(j){var P=parseFloat(j);return isNaN(P)?0:P}function _e(j,P,E){var B=pt.useState(0),U=(0,ut.Z)(B,2),D=U[0],St=U[1],ae=(0,pt.useRef)(new Map),$e=(0,pt.useRef)(new xe),Ae=(0,pt.useRef)(0);function Qe(){Ae.current+=1}function He(){var Ei=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;Qe();var Ci=function(){var ln=!1;ae.current.forEach(function(Ft,oe){if(Ft&&Ft.offsetParent){var we=Ft.offsetHeight,Ii=getComputedStyle(Ft),Pi=Ii.marginTop,_i=Ii.marginBottom,hn=Nt(Pi),mn=Nt(_i),Ln=we+hn+mn;$e.current.get(oe)!==Ln&&($e.current.set(oe,Ln),ln=!0)}}),ln&&St(function(Ft){return Ft+1})};if(Ei)Ci();else{Ae.current+=1;var qt=Ae.current;Promise.resolve().then(function(){qt===Ae.current&&Ci()})}}function Si(Ei,Ci){var qt=j(Ei),ei=ae.current.get(qt);Ci?(ae.current.set(qt,Ci),He()):ae.current.delete(qt),!ei!=!Ci&&(Ci?P==null||P(Ei):E==null||E(Ei))}return(0,pt.useEffect)(function(){return Qe},[]),[Si,He,$e.current,D]}var ti=14/15;function je(j,P,E){var B=(0,pt.useRef)(!1),U=(0,pt.useRef)(0),D=(0,pt.useRef)(0),St=(0,pt.useRef)(null),ae=(0,pt.useRef)(null),$e,Ae=function(Ei){if(B.current){var Ci=Math.ceil(Ei.touches[0].pageX),qt=Math.ceil(Ei.touches[0].pageY),ei=U.current-Ci,ln=D.current-qt,Ft=Math.abs(ei)>Math.abs(ln);Ft?U.current=Ci:D.current=qt;var oe=E(Ft,Ft?ei:ln,!1,Ei);oe&&Ei.preventDefault(),clearInterval(ae.current),oe&&(ae.current=setInterval(function(){Ft?ei*=ti:ln*=ti;var we=Math.floor(Ft?ei:ln);(!E(Ft,we,!0)||Math.abs(we)<=.1)&&clearInterval(ae.current)},16))}},Qe=function(){B.current=!1,$e()},He=function(Ei){$e(),Ei.touches.length===1&&!B.current&&(B.current=!0,U.current=Math.ceil(Ei.touches[0].pageX),D.current=Math.ceil(Ei.touches[0].pageY),St.current=Ei.target,St.current.addEventListener("touchmove",Ae,{passive:!1}),St.current.addEventListener("touchend",Qe,{passive:!0}))};$e=function(){St.current&&(St.current.removeEventListener("touchmove",Ae),St.current.removeEventListener("touchend",Qe))},(0,be.Z)(function(){return j&&P.current.addEventListener("touchstart",He,{passive:!0}),function(){var Si;(Si=P.current)===null||Si===void 0||Si.removeEventListener("touchstart",He),$e(),clearInterval(ae.current)}},[j])}function Be(j){return Math.floor(Math.pow(j,.5))}function Se(j,P){var E="touches"in j?j.touches[0]:j;return E[P?"pageX":"pageY"]-window[P?"scrollX":"scrollY"]}function dt(j,P,E){pt.useEffect(function(){var B=P.current;if(j&&B){var U=!1,D,St,ae=function(){Xt.Z.cancel(D)},$e=function Si(){ae(),D=(0,Xt.Z)(function(){E(St),Si()})},Ae=function(Ei){if(!(Ei.target.draggable||Ei.button!==0)){var Ci=Ei;Ci._virtualHandled||(Ci._virtualHandled=!0,U=!0)}},Qe=function(){U=!1,ae()},He=function(Ei){if(U){var Ci=Se(Ei,!1),qt=B.getBoundingClientRect(),ei=qt.top,ln=qt.bottom;if(Ci<=ei){var Ft=ei-Ci;St=-Be(Ft),$e()}else if(Ci>=ln){var oe=Ci-ln;St=Be(oe),$e()}else ae()}};return B.addEventListener("mousedown",Ae),B.ownerDocument.addEventListener("mouseup",Qe),B.ownerDocument.addEventListener("mousemove",He),function(){B.removeEventListener("mousedown",Ae),B.ownerDocument.removeEventListener("mouseup",Qe),B.ownerDocument.removeEventListener("mousemove",He),ae()}}},[j])}var W=10;function Zt(j,P,E,B,U,D,St,ae){var $e=pt.useRef(),Ae=pt.useState(null),Qe=(0,ut.Z)(Ae,2),He=Qe[0],Si=Qe[1];return(0,be.Z)(function(){if(He&&He.times<W){if(!j.current){Si(function(Ir){return(0,vt.Z)({},Ir)});return}D();var Ei=He.targetAlign,Ci=He.originAlign,qt=He.index,ei=He.offset,ln=j.current.clientHeight,Ft=!1,oe=Ei,we=null;if(ln){for(var Ii=Ei||Ci,Pi=0,_i=0,hn=0,mn=Math.min(P.length-1,qt),Ln=0;Ln<=mn;Ln+=1){var jn=U(P[Ln]);_i=Pi;var On=E.get(jn);hn=_i+(On===void 0?B:On),Pi=hn}for(var rn=Ii==="top"?ei:ln-ei,ir=mn;ir>=0;ir-=1){var tr=U(P[ir]),hr=E.get(tr);if(hr===void 0){Ft=!0;break}if(rn-=hr,rn<=0)break}switch(Ii){case"top":we=_i-ei;break;case"bottom":we=hn-ln+ei;break;default:{var Er=j.current.scrollTop,Hn=Er+ln;_i<Er?oe="top":hn>Hn&&(oe="bottom")}}we!==null&&St(we),we!==He.lastTop&&(Ft=!0)}Ft&&Si((0,vt.Z)((0,vt.Z)({},He),{},{times:He.times+1,targetAlign:oe,lastTop:we}))}},[He,j.current]),function(Ei){if(Ei==null){ae();return}if(Xt.Z.cancel($e.current),typeof Ei=="number")St(Ei);else if(Ei&&(0,kt.Z)(Ei)==="object"){var Ci,qt=Ei.align;"index"in Ei?Ci=Ei.index:Ci=P.findIndex(function(Ft){return U(Ft)===Ei.key});var ei=Ei.offset,ln=ei===void 0?0:ei;Si({times:0,index:Ci,offset:ln,originAlign:qt})}}}var ze=pt.forwardRef(function(j,P){var E=j.prefixCls,B=j.rtl,U=j.scrollOffset,D=j.scrollRange,St=j.onStartMove,ae=j.onStopMove,$e=j.onScroll,Ae=j.horizontal,Qe=j.spinSize,He=j.containerSize,Si=j.style,Ei=j.thumbStyle,Ci=j.showScrollBar,qt=pt.useState(!1),ei=(0,ut.Z)(qt,2),ln=ei[0],Ft=ei[1],oe=pt.useState(null),we=(0,ut.Z)(oe,2),Ii=we[0],Pi=we[1],_i=pt.useState(null),hn=(0,ut.Z)(_i,2),mn=hn[0],Ln=hn[1],jn=!B,On=pt.useRef(),rn=pt.useRef(),ir=pt.useState(Ci),tr=(0,ut.Z)(ir,2),hr=tr[0],Er=tr[1],Hn=pt.useRef(),Ir=function(){Ci===!0||Ci===!1||(clearTimeout(Hn.current),Er(!0),Hn.current=setTimeout(function(){Er(!1)},3e3))},T=D-He||0,ur=He-Qe||0,$n=pt.useMemo(function(){if(U===0||T===0)return 0;var ct=U/T;return ct*ur},[U,T,ur]),Yn=function(J){J.stopPropagation(),J.preventDefault()},Nr=pt.useRef({top:$n,dragging:ln,pageY:Ii,startTop:mn});Nr.current={top:$n,dragging:ln,pageY:Ii,startTop:mn};var Gn=function(J){Ft(!0),Pi(Se(J,Ae)),Ln(Nr.current.top),St(),J.stopPropagation(),J.preventDefault()};pt.useEffect(function(){var ct=function(Z){Z.preventDefault()},J=On.current,ot=rn.current;return J.addEventListener("touchstart",ct,{passive:!1}),ot.addEventListener("touchstart",Gn,{passive:!1}),function(){J.removeEventListener("touchstart",ct),ot.removeEventListener("touchstart",Gn)}},[]);var uo=pt.useRef();uo.current=T;var zo=pt.useRef();zo.current=ur,pt.useEffect(function(){if(ln){var ct,J=function(Z){var xt=Nr.current,Ot=xt.dragging,ge=xt.pageY,te=xt.startTop;Xt.Z.cancel(ct);var lt=On.current.getBoundingClientRect(),Qt=He/(Ae?lt.width:lt.height);if(Ot){var me=(Se(Z,Ae)-ge)*Qt,Fe=te;!jn&&Ae?Fe-=me:Fe+=me;var Tt=uo.current,ce=zo.current,bi=ce?Fe/ce:0,li=Math.ceil(bi*Tt);li=Math.max(li,0),li=Math.min(li,Tt),ct=(0,Xt.Z)(function(){$e(li,Ae)})}},ot=function(){Ft(!1),ae()};return window.addEventListener("mousemove",J,{passive:!0}),window.addEventListener("touchmove",J,{passive:!0}),window.addEventListener("mouseup",ot,{passive:!0}),window.addEventListener("touchend",ot,{passive:!0}),function(){window.removeEventListener("mousemove",J),window.removeEventListener("touchmove",J),window.removeEventListener("mouseup",ot),window.removeEventListener("touchend",ot),Xt.Z.cancel(ct)}}},[ln]),pt.useEffect(function(){return Ir(),function(){clearTimeout(Hn.current)}},[U]),pt.useImperativeHandle(P,function(){return{delayHidden:Ir}});var gr="".concat(E,"-scrollbar"),pn={position:"absolute",visibility:hr?null:"hidden"},gi={position:"absolute",borderRadius:99,background:"var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))",cursor:"pointer",userSelect:"none"};return Ae?(Object.assign(pn,{height:8,left:0,right:0,bottom:0}),Object.assign(gi,(0,le.Z)({height:"100%",width:Qe},jn?"left":"right",$n))):(Object.assign(pn,(0,le.Z)({width:8,top:0,bottom:0},jn?"right":"left",0)),Object.assign(gi,{width:"100%",height:Qe,top:$n})),pt.createElement("div",{ref:On,className:Q()(gr,(0,le.Z)((0,le.Z)((0,le.Z)({},"".concat(gr,"-horizontal"),Ae),"".concat(gr,"-vertical"),!Ae),"".concat(gr,"-visible"),hr)),style:(0,vt.Z)((0,vt.Z)({},pn),Si),onMouseDown:Yn,onMouseMove:Ir},pt.createElement("div",{ref:rn,className:Q()("".concat(gr,"-thumb"),(0,le.Z)({},"".concat(gr,"-thumb-moving"),ln)),style:(0,vt.Z)((0,vt.Z)({},gi),Ei),onMouseDown:Gn}))}),Me=ze,ye=20;function se(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,E=j/P*j;return isNaN(E)&&(E=0),E=Math.max(E,ye),Math.floor(E)}var Ue=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],Fi=[],wi={overflowY:"auto",overflowAnchor:"none"};function Ai(j,P){var E=j.prefixCls,B=E===void 0?"rc-virtual-list":E,U=j.className,D=j.height,St=j.itemHeight,ae=j.fullHeight,$e=ae===void 0?!0:ae,Ae=j.style,Qe=j.data,He=j.children,Si=j.itemKey,Ei=j.virtual,Ci=j.direction,qt=j.scrollWidth,ei=j.component,ln=ei===void 0?"div":ei,Ft=j.onScroll,oe=j.onVirtualScroll,we=j.onVisibleChange,Ii=j.innerProps,Pi=j.extraRender,_i=j.styles,hn=j.showScrollBar,mn=hn===void 0?"optional":hn,Ln=(0,ft.Z)(j,Ue),jn=pt.useCallback(function(tn){return typeof Si=="function"?Si(tn):tn==null?void 0:tn[Si]},[Si]),On=_e(jn,null,null),rn=(0,ut.Z)(On,4),ir=rn[0],tr=rn[1],hr=rn[2],Er=rn[3],Hn=!!(Ei!==!1&&D&&St),Ir=pt.useMemo(function(){return Object.values(hr.maps).reduce(function(tn,Hi){return tn+Hi},0)},[hr.id,hr.maps]),T=Hn&&Qe&&(Math.max(St*Qe.length,Ir)>D||!!qt),ur=Ci==="rtl",$n=Q()(B,(0,le.Z)({},"".concat(B,"-rtl"),ur),U),Yn=Qe||Fi,Nr=(0,pt.useRef)(),Gn=(0,pt.useRef)(),uo=(0,pt.useRef)(),zo=(0,pt.useState)(0),gr=(0,ut.Z)(zo,2),pn=gr[0],gi=gr[1],ct=(0,pt.useState)(0),J=(0,ut.Z)(ct,2),ot=J[0],nt=J[1],Z=(0,pt.useState)(!1),xt=(0,ut.Z)(Z,2),Ot=xt[0],ge=xt[1],te=function(){ge(!0)},lt=function(){ge(!1)},Qt={getKey:jn};function me(tn){gi(function(Hi){var Sn;typeof tn=="function"?Sn=tn(Hi):Sn=tn;var Ji=Ni(Sn);return Nr.current.scrollTop=Ji,Ji})}var Fe=(0,pt.useRef)({start:0,end:Yn.length}),Tt=(0,pt.useRef)(),ce=$t(Yn,jn),bi=(0,ut.Z)(ce,1),li=bi[0];Tt.current=li;var Mi=pt.useMemo(function(){if(!Hn)return{scrollHeight:void 0,start:0,end:Yn.length-1,offset:void 0};if(!T){var tn;return{scrollHeight:((tn=Gn.current)===null||tn===void 0?void 0:tn.offsetHeight)||0,start:0,end:Yn.length-1,offset:void 0}}for(var Hi=0,Sn,Ji,Fn,Xr=Yn.length,no=0;no<Xr;no+=1){var Jn=Yn[no],ii=jn(Jn),xr=hr.get(ii),wr=Hi+(xr===void 0?St:xr);wr>=pn&&Sn===void 0&&(Sn=no,Ji=Hi),wr>pn+D&&Fn===void 0&&(Fn=no),Hi=wr}return Sn===void 0&&(Sn=0,Ji=0,Fn=Math.ceil(D/St)),Fn===void 0&&(Fn=Yn.length-1),Fn=Math.min(Fn+1,Yn.length-1),{scrollHeight:Hi,start:Sn,end:Fn,offset:Ji}},[T,Hn,pn,Yn,Er,D]),Pe=Mi.scrollHeight,qe=Mi.start,Re=Mi.end,ni=Mi.offset;Fe.current.start=qe,Fe.current.end=Re,pt.useLayoutEffect(function(){var tn=hr.getRecord();if(tn.size===1){var Hi=Array.from(tn.keys())[0],Sn=tn.get(Hi),Ji=Yn[qe];if(Ji&&Sn===void 0){var Fn=jn(Ji);if(Fn===Hi){var Xr=hr.get(Hi),no=Xr-St;me(function(Jn){return Jn+no})}}}hr.resetRecord()},[Pe]);var Ut=pt.useState({width:0,height:D}),Wt=(0,ut.Z)(Ut,2),Dt=Wt[0],ke=Wt[1],re=function(Hi){ke({width:Hi.offsetWidth,height:Hi.offsetHeight})},Ie=(0,pt.useRef)(),mt=(0,pt.useRef)(),Xe=pt.useMemo(function(){return se(Dt.width,qt)},[Dt.width,qt]),pi=pt.useMemo(function(){return se(Dt.height,Pe)},[Dt.height,Pe]),ci=Pe-D,Ui=(0,pt.useRef)(ci);Ui.current=ci;function Ni(tn){var Hi=tn;return Number.isNaN(Ui.current)||(Hi=Math.min(Hi,Ui.current)),Hi=Math.max(Hi,0),Hi}var Gi=pn<=0,ki=pn>=ci,di=ot<=0,Ki=ot>=qt,Kt=Et(Gi,ki,di,Ki),Ri=function(){return{x:ur?-ot:ot,y:pn}},At=(0,pt.useRef)(Ri()),vi=(0,yt.useEvent)(function(tn){if(oe){var Hi=(0,vt.Z)((0,vt.Z)({},Ri()),tn);(At.current.x!==Hi.x||At.current.y!==Hi.y)&&(oe(Hi),At.current=Hi)}});function Qi(tn,Hi){var Sn=tn;Hi?((0,Rt.flushSync)(function(){nt(Sn)}),vi()):me(Sn)}function Ti(tn){var Hi=tn.currentTarget.scrollTop;Hi!==pn&&me(Hi),Ft==null||Ft(tn),vi()}var gn=function(Hi){var Sn=Hi,Ji=qt?qt-Dt.width:0;return Sn=Math.max(Sn,0),Sn=Math.min(Sn,Ji),Sn},Mn=(0,yt.useEvent)(function(tn,Hi){Hi?((0,Rt.flushSync)(function(){nt(function(Sn){var Ji=Sn+(ur?-tn:tn);return gn(Ji)})}),vi()):me(function(Sn){var Ji=Sn+tn;return Ji})}),mi=Bt(Hn,Gi,ki,di,Ki,!!qt,Mn),Ye=(0,ut.Z)(mi,2),Je=Ye[0],Oi=Ye[1];je(Hn,Nr,function(tn,Hi,Sn,Ji){var Fn=Ji;return Kt(tn,Hi,Sn)?!1:!Fn||!Fn._virtualHandled?(Fn&&(Fn._virtualHandled=!0),Je({preventDefault:function(){},deltaX:tn?Hi:0,deltaY:tn?0:Hi}),!0):!1}),dt(T,Nr,function(tn){me(function(Hi){return Hi+tn})}),(0,be.Z)(function(){function tn(Sn){var Ji=Gi&&Sn.detail<0,Fn=ki&&Sn.detail>0;Hn&&!Ji&&!Fn&&Sn.preventDefault()}var Hi=Nr.current;return Hi.addEventListener("wheel",Je,{passive:!1}),Hi.addEventListener("DOMMouseScroll",Oi,{passive:!0}),Hi.addEventListener("MozMousePixelScroll",tn,{passive:!1}),function(){Hi.removeEventListener("wheel",Je),Hi.removeEventListener("DOMMouseScroll",Oi),Hi.removeEventListener("MozMousePixelScroll",tn)}},[Hn,Gi,ki]),(0,be.Z)(function(){if(qt){var tn=gn(ot);nt(tn),vi({x:tn})}},[Dt.width,qt]);var pe=function(){var Hi,Sn;(Hi=Ie.current)===null||Hi===void 0||Hi.delayHidden(),(Sn=mt.current)===null||Sn===void 0||Sn.delayHidden()},z=Zt(Nr,Yn,hr,St,jn,function(){return tr(!0)},me,pe);pt.useImperativeHandle(P,function(){return{nativeElement:uo.current,getScrollInfo:Ri,scrollTo:function(Hi){function Sn(Ji){return Ji&&(0,kt.Z)(Ji)==="object"&&("left"in Ji||"top"in Ji)}Sn(Hi)?(Hi.left!==void 0&&nt(gn(Hi.left)),z(Hi.top)):z(Hi)}}}),(0,be.Z)(function(){if(we){var tn=Yn.slice(qe,Re+1);we(tn,Yn)}},[qe,Re,Yn]);var fn=ve(Yn,jn,hr,St),vn=Pi==null?void 0:Pi({start:qe,end:Re,virtual:T,offsetX:ot,offsetY:ni,rtl:ur,getSize:fn}),Qn=Ht(Yn,qe,Re,qt,ot,ir,He,Qt),Kn=null;D&&(Kn=(0,vt.Z)((0,le.Z)({},$e?"height":"maxHeight",D),wi),Hn&&(Kn.overflowY="hidden",qt&&(Kn.overflowX="hidden"),Ot&&(Kn.pointerEvents="none")));var Ar={};return ur&&(Ar.dir="rtl"),pt.createElement("div",(0,Mt.Z)({ref:uo,style:(0,vt.Z)((0,vt.Z)({},Ae),{},{position:"relative"}),className:$n},Ar,Ln),pt.createElement(rt.Z,{onResize:re},pt.createElement(ln,{className:"".concat(B,"-holder"),style:Kn,ref:Nr,onScroll:Ti,onMouseEnter:pe},pt.createElement(jt,{prefixCls:B,height:Pe,offsetX:ot,offsetY:ni,scrollWidth:qt,onInnerResize:tr,ref:Gn,innerProps:Ii,rtl:ur,extra:vn},Qn))),T&&Pe>D&&pt.createElement(Me,{ref:Ie,prefixCls:B,scrollOffset:pn,scrollRange:Pe,rtl:ur,onScroll:Qi,onStartMove:te,onStopMove:lt,spinSize:pi,containerSize:Dt.height,style:_i==null?void 0:_i.verticalScrollBar,thumbStyle:_i==null?void 0:_i.verticalScrollBarThumb,showScrollBar:mn}),T&&qt>Dt.width&&pt.createElement(Me,{ref:mt,prefixCls:B,scrollOffset:ot,scrollRange:qt,rtl:ur,onScroll:Qi,onStartMove:te,onStopMove:lt,spinSize:Xe,containerSize:Dt.width,horizontal:!0,style:_i==null?void 0:_i.horizontalScrollBar,thumbStyle:_i==null?void 0:_i.horizontalScrollBarThumb,showScrollBar:mn}))}var ri=pt.forwardRef(Ai);ri.displayName="List";var sn=ri,Zi=sn},48136:function(qn,Li,G){"use strict";var Mt=Object.defineProperty,kt=Object.defineProperties,vt=Object.getOwnPropertyDescriptors,le=Object.getOwnPropertySymbols,ut=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,Pt=(r,o,u)=>o in r?Mt(r,o,{enumerable:!0,configurable:!0,writable:!0,value:u}):r[o]=u,Q=(r,o)=>{for(var u in o||(o={}))ut.call(o,u)&&Pt(r,u,o[u]);if(le)for(var u of le(o))ft.call(o,u)&&Pt(r,u,o[u]);return r},rt=(r,o)=>kt(r,vt(o)),yt=r=>typeof r=="symbol"?r:r+"",be=(r,o)=>{var u={};for(var d in r)ut.call(r,d)&&o.indexOf(d)<0&&(u[d]=r[d]);if(r!=null&&le)for(var d of le(r))o.indexOf(d)<0&&ft.call(r,d)&&(u[d]=r[d]);return u};function pt(r){return Array.isArray(r)}var Rt={en:{"keyboard.tooltip.symbols":"\u7B26\u53F7","keyboard.tooltip.greek":"\u5E0C\u814A\u5B57\u6BCD","keyboard.tooltip.numeric":"\u6570\u5B57","keyboard.tooltip.alphabetic":"\u7F57\u9A6C\u5B57\u6BCD","tooltip.cut to clipboard":"\u526A\u5207\u5230\u526A\u8D34\u677F","tooltip.copy to clipboard":"\u590D\u5236\u5230\u526A\u8D34\u677F","tooltip.paste from clipboard":"\u7C98\u8D34","tooltip.redo":"\u91CD\u505A","tooltip.toggle virtual keyboard":"\u5207\u6362\u865A\u62DF\u952E\u76D8","tooltip.undo":"\u64A4\u6D88","menu.insert matrix":"\u63D2\u5165\u77E9\u9635","menu.borders":"\u77E9\u9635\u5206\u9694\u7B26","menu.array.add row above":"\u5728\u540E\u9762\u6DFB\u52A0\u884C","menu.array.add row below":"\u5728\u524D\u9762\u6DFB\u52A0\u884C","menu.array.add column after":"\u5728\u540E\u9762\u6DFB\u52A0\u5217r","menu.array.add column before":"\u5728\u524D\u9762\u6DFB\u52A0\u5217","menu.array.delete row":"\u5220\u9664\u884C","menu.array.delete rows":"\u5220\u9664\u9009\u5B9A\u884C","menu.array.delete column":"\u5220\u9664\u5217","menu.array.delete columns":"\u5220\u9664\u9009\u5B9A\u7684\u5217","menu.mode":"\u6A21\u5F0F","menu.mode-math":"\u6570\u5B66","menu.mode-text":"\u6587\u672C","menu.mode-latex":"LaTeX","tooltip.blackboard":"\u9ED1\u677F","tooltip.bold":"\u7C97\u4F53","tooltip.italic":"\u659C\u4F53","tooltip.fraktur":"Fraktur","tooltip.script":"\u811A\u672C","tooltip.caligraphic":"\u8349\u4E66","tooltip.typewriter":"\u6253\u5B57\u673A","tooltip.roman-upright":"\u7F57\u9A6C\u76F4\u7ACB","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"\u5B57\u4F53\u6837\u5F0F","menu.accent":"\u91CD\u97F3","menu.decoration":"\u88C5\u9970","menu.color":"\u989C\u8272","menu.background-color":"\u80CC\u666F","menu.evaluate":"\u8BA1\u7B97","menu.simplify":"\u7B80\u5316","menu.solve":"\u6C42\u89E3","menu.solve-for":"\u6C42\u89E3 %@","menu.cut":"\u526A\u5207","menu.copy":"\u590D\u5236","menu.copy-as-latex":"\u590D\u5236\u4E3A LaTeX","menu.copy-as-ascii-math":"\u590D\u5236\u4E3A ASCII Math","menu.copy-as-mathml":"\u590D\u5236\u4E3A MathML","menu.paste":"\u7C98\u8D34","menu.select-all":"\u5168\u9009","color.red":"\u7EA2\u8272","color.orange":"\u6A59\u8272","color.yellow":"\u9EC4\u8272","color.lime":"\u7EFF\u9EC4\u8272","color.green":"\u7EFF\u8272","color.teal":"\u9752\u8272","color.cyan":"\u84DD\u7EFF\u8272","color.blue":"\u84DD\u8272","color.indigo":"\u975B\u84DD\u8272","color.purple":"\u7D2B\u8272","color.magenta":"\u6D0B\u7EA2\u8272","color.black":"\u9ED1\u8272","color.dark-grey":"\u6DF1\u7070\u8272","color.grey":"\u7070\u8272","color.light-grey":"\u6D45\u7070\u8272","color.white":"\u767D\u8272"}};function Ce(){return"window"in globalThis&&"document"in globalThis}function jt(){return"matchMedia"in window?window.matchMedia("(pointer: coarse)").matches:"ontouchstart"in window||navigator.maxTouchPoints>0}function Jt(){return typeof navigator.vibrate=="function"}function Ht(){var r,o;if(!Ce())return"other";const u=(o=(r=navigator.userAgentData)==null?void 0:r.platform)!=null?o:navigator.platform;return/^mac/i.test(u)?navigator.maxTouchPoints===5?"ios":"macos":/^win/i.test(u)?"windows":/android/i.test(navigator.userAgent)?"android":/iphone|ipod|ipad/i.test(navigator.userAgent)?"ios":/\bcros\b/i.test(navigator.userAgent)?"chromeos":"other"}function de(){if(!Ce())return!0;if(/firefox/i.test(navigator.userAgent)){const r=navigator.userAgent.match(/firefox\/(\d+)/i);return r?parseInt(r[1])>=78:!1}if(/trident/i.test(navigator.userAgent))return!1;if(/edge/i.test(navigator.userAgent)){const r=navigator.userAgent.match(/edg\/(\d+)/i);return r?parseInt(r[1])>=79:!1}return!0}function De(){return HTMLElement.prototype.hasOwnProperty("popover")}var $t={strings:Rt,_locale:"",_dirty:!1,_subscribers:[],_numberFormatter:void 0,get locale(){return $t._locale||($t._locale=Ce()?navigator.language.slice(0,5):"en-US"),$t._locale},set locale(r){$t._locale=r,$t._numberFormatter=void 0,$t.dirty=!0},get numberFormatter(){return $t._numberFormatter||($t._numberFormatter=new Intl.NumberFormat($t.locale)),$t._numberFormatter},merge(r,o){if(typeof r=="string"&&o)$t.strings[r]=Q(Q({},$t.strings[r]),o),$t.dirty=!0;else for(const u of Object.keys(r))$t.merge(u,r[u])},get dirty(){return $t._dirty},set dirty(r){$t._dirty||$t._dirty===r||($t._dirty=!0,setTimeout(()=>{$t._dirty=!1,this._subscribers.forEach(o=>o==null?void 0:o())},0))},subscribe(r){return $t._subscribers.push(r),$t._subscribers.length-1},unsubscribe(r){r<0||r>=$t._subscribers.length||($t._subscribers[r]=void 0)},update(r){let o=r.querySelectorAll("[data-l10n-tooltip]");for(const u of o){const d=u.getAttribute("data-l10n-tooltip");if(d){const g=Xt(d);g&&u.setAttribute("data-tooltip",g)}}o=r.querySelectorAll("[data-l10n-arial-label]");for(const u of o){const d=u.getAttribute("data-l10n-arial-label");if(d){const g=Xt(d);g&&u.setAttribute("aria-label",g)}}}};function Xt(r,...o){if(r===void 0)return;let u="";const d=$t.locale;$t.strings[d]&&(u=$t.strings[d][r]);const g=d.slice(0,2);if(!u&&$t.strings[g]&&(u=$t.strings[g][r]),u||(u=$t.strings.en[r]),!u)return;const b=/(%@|%([0-9]+)\$@)/g;let M=b.exec(u),N=0;for(;M;){if(o[N++]){const F=M[2]?parseInt(M[2],10)-1:N-1;let $=o[F];typeof $=="number"&&($=$t.numberFormatter.format($)),u=u.replace(M[1],$)}M=b.exec(u)}return u=u.replace(/%%/g,"%"),u}var Ct={m0:"#3F3D99",m1:"#993D71",m2:"#998B3D",m3:"#3D9956",m4:"#3D5A99",m5:"#993D90",m6:"#996D3D",m7:"#43993D",m8:"#3D7999",m9:"#843D99"},q={blue:"#0072BD",orange:"#D95319",yellow:"#EDB120",purple:"#7E2F8E",green:"#77AC30",cyan:"#4DBEEE",red:"#A2142F"},Et={red:"#fbbbb6",orange:"#ffe0c2",yellow:"#fff1c2",lime:"#d0e8b9",green:"#bceac4",teal:"#b9f1f1",cyan:"#b8e5c9",blue:"#b6d9fb",indigo:"#d1c2f0",purple:"#e3baf8",magenta:"#f9c8e0",black:"#353535","dark-grey":"#8C8C8C",grey:"#D0D0D0","light-grey":"#F0F0F0",white:"#ffffff"},Bt={red:"#d7170b",orange:"#fe8a2b",yellow:"#ffc02b",lime:"#63b215",green:"#21ba3a",teal:"#17cfcf",cyan:"#13a7ec",blue:"#0d80f2",indigo:"#63c",purple:"#a219e6",magenta:"#eb4799",black:"#000","dark-grey":"#666",grey:"#A6A6A6","light-grey":"#d4d5d2",white:"#ffffff"},ve={Red:"red",Orange:"orange",Yellow:"yellow",LimeGreen:"lime",Green:"green",TealBlue:"teal",Blue:"blue",Violet:"indigo",Purple:"purple",Magenta:"magenta",Black:"black",Gray:"grey",White:"white"},Vt={Apricot:"#FBB982",Aquamarine:"#00B5BE",Bittersweet:"#C04F17",Black:"#221E1F",Blue:"#2D2F92",BlueGreen:"#00B3B8",BlueViolet:"#473992",BrickRed:"#B6321C",Brown:"#792500",BurntOrange:"#F7921D",CadetBlue:"#74729A",CarnationPink:"#F282B4",Cerulean:"#00A2E3",CornflowerBlue:"#41B0E4",Cyan:"#00AEEF",Dandelion:"#FDBC42",DarkOrchid:"#A4538A",Emerald:"#00A99D",ForestGreen:"#009B55",Fuchsia:"#8C368C",Goldenrod:"#FFDF42",Gray:"#949698",Green:"#00A64F",GreenYellow:"#DFE674",JungleGreen:"#00A99A",Lavender:"#F49EC4",Limegreen:"#8DC73E",Magenta:"#EC008C",Mahogany:"#A9341F",Maroon:"#AF3235",Melon:"#F89E7B",MidnightBlue:"#006795",Mulberry:"#A93C93",NavyBlue:"#006EB8",OliveGreen:"#3C8031",Orange:"#F58137",OrangeRed:"#ED135A",Orchid:"#AF72B0",Peach:"#F7965A",Periwinkle:"#7977B8",PineGreen:"#008B72",Plum:"#92268F",ProcessBlue:"#00B0F0",Purple:"#99479B",RawSienna:"#974006",Red:"#ED1B23",RedOrange:"#F26035",RedViolet:"#A1246B",Rhodamine:"#EF559F",RoyalBlue:"#0071BC",RoyalPurple:"#613F99",RubineRed:"#ED017D",Salmon:"#F69289",SeaGreen:"#3FBC9D",Sepia:"#671800",SkyBlue:"#46C5DD",SpringGreen:"#C6DC67",Tan:"#DA9D76",TealBlue:"#00AEB3",Thistle:"#D883B7",Turquoise:"#00B4CE",Violet:"#58429B",VioletRed:"#EF58A0",White:"#FFFFFF",WildStrawberry:"#EE2967",Yellow:"#FFF200",YellowGreen:"#98CC70",YellowOrange:"#FAA21A"};function We(r){var o,u,d,g,b,M;const N=r.split("!");let I,F,$,it=255,gt=255,_t=255,zt=-1;const Ne=N.length>0&&N[0].startsWith("-");Ne&&(N[0]=N[0].slice(1));for(let Bi=0;Bi<N.length;Bi++){I=it,F=gt,$=_t;const Ee=(o=N[Bi].trim().match(/^([A-Za-z\d-]+)/))==null?void 0:o[1],hi=Ee==null?void 0:Ee.toLowerCase(),$i=Ee&&(M=(b=(g=(d=(u=Bt[hi])!=null?u:Bt[ve[Ee]])!=null?d:q[Ee])!=null?g:Vt[Ee])!=null?b:Ct[Ee])!=null?M:N[Bi].trim();let xi=$i.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);if(xi!=null&&xi[1]&&xi[2]&&xi[3])it=Math.max(0,Math.min(255,Number.parseInt(xi[1],16))),gt=Math.max(0,Math.min(255,Number.parseInt(xi[2],16))),_t=Math.max(0,Math.min(255,Number.parseInt(xi[3],16)));else if(xi=$i.match(/^#([\da-f]{3})$/i),xi!=null&&xi[1]){const bn=Number.parseInt(xi[1][0],16),Rn=Number.parseInt(xi[1][1],16),En=Number.parseInt(xi[1][2],16);it=Math.max(0,Math.min(255,bn*16+bn)),gt=Math.max(0,Math.min(255,Rn*16+Rn)),_t=Math.max(0,Math.min(255,En*16+En))}else if(xi=$i.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i),xi!=null&&xi[1]&&xi[2]&&xi[3])it=Math.max(0,Math.min(255,Number.parseInt(xi[1]))),gt=Math.max(0,Math.min(255,Number.parseInt(xi[2]))),_t=Math.max(0,Math.min(255,Number.parseInt(xi[3])));else return;zt>=0&&(it=(1-zt)*it+zt*I,gt=(1-zt)*gt+zt*F,_t=(1-zt)*_t+zt*$,zt=-1),Bi+1<N.length&&(zt=Math.max(0,Math.min(100,Number.parseInt(N[++Bi])))/100)}return zt>=0&&(it=zt*it+(1-zt)*I,gt=zt*gt+(1-zt)*F,_t=zt*_t+(1-zt)*$),Ne&&(it=255-it,gt=255-gt,_t=255-_t),"#"+("00"+Math.round(it).toString(16)).slice(-2)+("00"+Math.round(gt).toString(16)).slice(-2)+("00"+Math.round(_t).toString(16)).slice(-2)}function ee(r){var o,u;return r=r.trim(),(u=(o=Et[r.toLowerCase()])!=null?o:Et[ve[r]])!=null?u:We(r)}function xe(r){if(!r||r[0]!=="#")return;r=r.slice(1);let o;return r.length<=4?(o={r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16)},r.length===4&&(o.a=parseInt(r[3]+r[3],16)/255)):(o={r:parseInt(r[0]+r[1],16),g:parseInt(r[2]+r[3],16),b:parseInt(r[4]+r[5],16)},r.length===8&&(o.a=parseInt(r[6]+r[7],16)/255)),o&&o.a===void 0&&(o.a=1),o}function Nt(r,o,u){return u<0&&(u+=6),u>=6&&(u-=6),u<1?(o-r)*u+r:u<3?o:u<4?(o-r)*(4-u)+r:r}function _e(r){let[o,u,d]=[r.h,r.s,r.l];o=(o+360)%360/60,d=Math.max(0,Math.min(d,1)),u=Math.max(0,Math.min(u,1));const g=d<=.5?d*(u+1):d+u-d*u,b=d*2-g;return{r:Math.round(255*Nt(b,g,o+2)),g:Math.round(255*Nt(b,g,o)),b:Math.round(255*Nt(b,g,o-2))}}function ti(r){return r<0?0:r>255?255:Math.round(r)}function je(r){const{r:o,g:u,b:d}=r;let g=((1<<24)+(ti(o)<<16)+(ti(u)<<8)+ti(d)).toString(16).slice(1);return g[0]===g[1]&&g[2]===g[3]&&g[4]===g[5]&&g[6]===g[7]&&(g=g[0]+g[2]+g[4]),"#"+g}function Be(r){let{r:o,g:u,b:d}=r;o=o/255,u=u/255,d=d/255;const g=Math.min(o,u,d),b=Math.max(o,u,d),M=b-g;let N,I;b===g?N=0:o===b?N=(u-d)/M:u===b?N=2+(d-o)/M:d===b&&(N=4+(o-u)/M),N=Math.min(N*60,360),N<0&&(N+=360);const F=(g+b)/2;return b===g?I=0:F<=.5?I=M/(b+g):I=M/(2-b-g),{h:N,s:I,l:F}}function Se(r){let o=xe(r);if(!o)return r;let{h:u,s:d,l:g}=Be(o);return d+=.1,g-=.1,je(_e({h:u,s:d,l:g}))}var dt={60:"\\lt",62:"\\gt",111:"o",38:"\\&",123:"\\lbrace",125:"\\rbrace",91:"\\lbrack",93:"\\rbrack",58:"\\colon",160:"~",172:"\\neg",183:"\\cdot",188:"\\frac{1}{4}",189:"\\frac{1}{2}",190:"\\frac{3}{4}",8304:"^{0}",8305:"^{i}",185:"^{1}",178:"^{2}",179:"^{3}",8224:"\\dagger",8225:"\\ddagger",8230:"\\ldots",8308:"^{4}",8309:"^{5}",8310:"^{6}",8311:"^{7}",8312:"^{8}",8313:"^{9}",8314:"^{+}",8315:"^{-}",8316:"^{=}",8319:"^{n}",8320:"_{0}",8321:"_{1}",8322:"_{2}",8323:"_{3}",8324:"_{4}",8325:"_{5}",8326:"_{6}",8327:"_{7}",8328:"_{8}",8329:"_{9}",8330:"_{+}",8331:"_{-}",8332:"_{=}",8336:"_{a}",8337:"_{e}",8338:"_{o}",8339:"_{x}",8242:"\\prime",39:"\\prime",8592:"\\gets",8594:"\\to",9651:"\\triangle",9661:"\\triangledown",8715:"\\owns",8727:"\\ast",8739:"\\vert",8741:"\\Vert",8743:"\\land",8744:"\\lor",8901:"\\cdot",8904:"\\bowtie",8800:"\\ne",8804:"\\le",8805:"\\ge",8869:"\\bot",10231:"\\biconditional",10232:"\\impliedby",10233:"\\implies",10234:"\\iff",8450:"\\mathbb{C}",8469:"\\mathbb{N}",8473:"\\mathbb{P}",8474:"\\mathbb{Q}",8477:"\\mathbb{R}",8484:"\\mathbb{Z}",8461:"\\mathbb{H}",8476:"\\Re",8465:"\\Im",42:"\\ast",11036:"\\square",9633:"\\square",8720:"\\coprod",8716:"\\not\\ni",9671:"\\diamond",8846:"\\uplus",8851:"\\sqcap",8852:"\\sqcup",8768:"\\wr",8750:"\\oint",8226:"\\textbullet",8722:"-",978:"\\Upsilon"},W={119893:8462,119965:8492,119968:8496,119969:8497,119971:8459,119972:8464,119975:8466,119976:8499,119981:8475,119994:8495,119996:8458,120004:8500,120070:8493,120075:8460,120076:8465,120085:8476,120093:8488,120122:8450,120127:8461,120133:8469,120135:8473,120136:8474,120137:8477,120145:8484},Zt=[{start:119808,len:26,offset:65,style:"bold"},{start:119834,len:26,offset:97,style:"bold"},{start:119860,len:26,offset:65,style:"italic"},{start:119886,len:26,offset:97,style:"italic"},{start:119912,len:26,offset:65,style:"bolditalic"},{start:119938,len:26,offset:97,style:"bolditalic"},{start:119964,len:26,offset:65,variant:"script"},{start:119990,len:26,offset:97,variant:"script"},{start:120016,len:26,offset:65,variant:"script",style:"bold"},{start:120042,len:26,offset:97,variant:"script",style:"bold"},{start:120068,len:26,offset:65,variant:"fraktur"},{start:120094,len:26,offset:97,variant:"fraktur"},{start:120172,len:26,offset:65,variant:"fraktur",style:"bold"},{start:120198,len:26,offset:97,variant:"fraktur",style:"bold"},{start:120120,len:26,offset:65,variant:"double-struck"},{start:120146,len:26,offset:97,variant:"double-struck"},{start:120224,len:26,offset:65,variant:"sans-serif"},{start:120250,len:26,offset:97,variant:"sans-serif"},{start:120276,len:26,offset:65,variant:"sans-serif",style:"bold"},{start:120302,len:26,offset:97,variant:"sans-serif",style:"bold"},{start:120328,len:26,offset:65,variant:"sans-serif",style:"italic"},{start:120354,len:26,offset:97,variant:"sans-serif",style:"italic"},{start:120380,len:26,offset:65,variant:"sans-serif",style:"bolditalic"},{start:120406,len:26,offset:97,variant:"sans-serif",style:"bolditalic"},{start:120432,len:26,offset:65,variant:"monospace"},{start:120458,len:26,offset:97,variant:"monospace"},{start:120488,len:25,offset:913,style:"bold"},{start:120514,len:25,offset:945,style:"bold"},{start:120546,len:25,offset:913,style:"italic"},{start:120572,len:25,offset:945,style:"italic"},{start:120604,len:25,offset:913,style:"bolditalic"},{start:120630,len:25,offset:945,style:"bolditalic"},{start:120662,len:25,offset:913,variant:"sans-serif",style:"bold"},{start:120688,len:25,offset:945,variant:"sans-serif",style:"bold"},{start:120720,len:25,offset:913,variant:"sans-serif",style:"bolditalic"},{start:120746,len:25,offset:945,variant:"sans-serif",style:"bolditalic"},{start:120782,len:10,offset:48,variant:"main",style:"bold"},{start:120792,len:10,offset:48,variant:"double-struck"},{start:120803,len:10,offset:48,variant:"sans-serif"},{start:120812,len:10,offset:48,variant:"sans-serif",style:"bold"},{start:120822,len:10,offset:48,variant:"monospace"}];function ze(r,o,u){if(!/[A-Za-z\d]/.test(r)||(u==="up"&&(u=void 0),!o&&!u))return r;const d=r.codePointAt(0);if(d===void 0)return r;for(const g of Zt)if((!o||g.variant===o)&&(!u||g.style===u)&&d>=g.offset&&d<g.offset+g.len){const b=g.start+d-g.offset;return String.fromCodePoint(W[b]||b)}return r}function Me(r){var o;if((r<119808||r>120831)&&(r<8448||r>8527))return{char:String.fromCodePoint(r)};for(const u in W)if(W[u]===r){r=(o=u.codePointAt(0))!=null?o:0;break}for(const u of Zt)if(r>=u.start&&r<u.start+u.len)return{char:String.fromCodePoint(r-u.start+u.offset),variant:u.variant,style:u.style};return{char:String.fromCodePoint(r)}}function ye(r){var o;let u="";for(const d of r){if("{}<>[]$&#^_%:'\u02DC".includes(d)){u+=d;continue}const g=(o=d.codePointAt(0))!=null?o:0;let b=dt[g];if(b)b.startsWith("\\")?u+=b+" ":u+=b;else{const{char:M,variant:N,style:I}=Me(g);switch(b=M,N){case"double-struck":b=`\\mathbb{${b}}`;break;case"fraktur":b=`\\mathfrak{${b}}`;break;case"script":b=`\\mathscr{${b}}`;break;case"sans-serif":b=`\\mathsf{${b}}`;break;case"monospace":b=`\\mathtt{${b}}`;break;case"calligraphic":b=`\\mathcal{${b}}`;break}switch(I){case"bold":b=`\\mathbf{${b}}`;break;case"italic":b=`\\mathit{${b}}`;break;case"bolditalic":b=`\\mathbfit{${b}}`;break}u+=b}}return u}function se(r){return r?Array.isArray(r)?r:typeof r=="object"&&"group"in r?r.group:[]:[]}var Ue={},Fi=Q({},dt),wi={},Ai={},ri={darr:"\\downarrow",dArr:"\\Downarrow",Darr:"\\Downarrow",lang:"\\langle",rang:"\\rangle",uarr:"\\uparrow",uArr:"\\Uparrow",Uarr:"\\Uparrow",N:"\\mathbb{N}",R:"\\mathbb{R}",Z:"\\mathbb{Z}",alef:"\\aleph",alefsym:"\\aleph",Alpha:"\\mathrm{A}",Beta:"\\mathrm{B}",bull:"\\bullet",Chi:"\\mathrm{X}",clubs:"\\clubsuit",cnums:"\\mathbb{C}",Complex:"\\mathbb{C}",Dagger:"\\ddagger",diamonds:"\\diamondsuit",empty:"\\emptyset",Epsilon:"\\mathrm{E}",Eta:"\\mathrm{H}",exist:"\\exists",harr:"\\leftrightarrow",hArr:"\\Leftrightarrow",Harr:"\\Leftrightarrow",hearts:"\\heartsuit",image:"\\Im",infin:"\\infty",Iota:"\\mathrm{I}",isin:"\\in",Kappa:"\\mathrm{K}",larr:"\\leftarrow",lArr:"\\Leftarrow",Larr:"\\Leftarrow",lrarr:"\\leftrightarrow",lrArr:"\\Leftrightarrow",Lrarr:"\\Leftrightarrow",Mu:"\\mathrm{M}",natnums:"\\mathbb{N}",Nu:"\\mathrm{N}",Omicron:"\\mathrm{O}",plusmn:"\\pm",rarr:"\\rightarrow",rArr:"\\Rightarrow",Rarr:"\\Rightarrow",real:"\\Re",reals:"\\mathbb{R}",Reals:"\\mathbb{R}",Rho:"\\mathrm{P}",sdot:"\\cdot",sect:"\\S",spades:"\\spadesuit",sub:"\\subset",sube:"\\subseteq",supe:"\\supseteq",Tau:"\\mathrm{T}",thetasym:"\\vartheta",weierp:"\\wp",Zeta:"\\mathrm{Z}"},sn={varGamma:"\\mathit{\\Gamma}",varDelta:"\\mathit{\\Delta}",varTheta:"\\mathit{\\Theta}",varLambda:"\\mathit{\\Lambda}",varXi:"\\mathit{\\Xi}",varPi:"\\mathit{\\Pi}",varSigma:"\\mathit{\\Sigma}",varUpsilon:"\\mathit{\\Upsilon}",varPhi:"\\mathit{\\Phi}",varPsi:"\\mathit{\\Psi}",varOmega:"\\mathit{\\Omega}",pmod:{def:"\\quad(\\operatorname{mod}\\ #1)",args:1,expand:!1,captureSelection:!1},mod:{def:"\\quad\\operatorname{mod}\\,\\,#1",args:1,expand:!1},bmod:{def:"\\;\\mathbin{\\operatorname{mod }}",expand:!1}},Zi={bra:{def:"\\mathinner{\\langle{#1}|}",args:1,captureSelection:!1},ket:{def:"\\mathinner{|{#1}\\rangle}",args:1,captureSelection:!1},braket:{def:"\\mathinner{\\langle{#1}\\rangle}",args:1,captureSelection:!1},set:{def:"\\mathinner{\\lbrace #1 \\rbrace}",args:1,captureSelection:!1},Bra:{def:"\\left\\langle #1\\right|",args:1,captureSelection:!1},Ket:{def:"\\left|#1\\right\\rangle",args:1,captureSelection:!1},Braket:{def:"\\left\\langle{#1}\\right\\rangle",args:1,captureSelection:!1},Set:{def:"\\left\\lbrace #1 \\right\\rbrace",args:1,captureSelection:!1}},j={iff:{primitive:!0,captureSelection:!0,def:"\\;\u27FA\\;"},nicefrac:"^{#1}\\!\\!/\\!_{#2}",phase:{def:"\\enclose{phasorangle}{#1}",args:1,captureSelection:!1},rd:"\\mathrm{d}",rD:"\\mathrm{D}",doubleStruckCapitalN:"\\mathbb{N}",doubleStruckCapitalR:"\\mathbb{R}",doubleStruckCapitalQ:"\\mathbb{Q}",doubleStruckCapitalZ:"\\mathbb{Z}",doubleStruckCapitalP:"\\mathbb{P}",scriptCapitalE:"\\mathscr{E}",scriptCapitalH:"\\mathscr{H}",scriptCapitalL:"\\mathscr{L}",gothicCapitalC:"\\mathfrak{C}",gothicCapitalH:"\\mathfrak{H}",gothicCapitalI:"\\mathfrak{I}",gothicCapitalR:"\\mathfrak{R}",imaginaryI:"\\mathrm{i}",imaginaryJ:"\\mathrm{j}",exponentialE:"\\mathrm{e}",differentialD:"\\mathrm{d}",capitalDifferentialD:"\\mathrm{D}",mathstrut:{def:"\\vphantom{(}",primitive:!0},angl:"\\enclose{actuarial}{#1}",angln:"\\enclose{actuarial}{n}",anglr:"\\enclose{actuarial}{r}",anglk:"\\enclose{actuarial}{k}",mathtools:{primitive:!0,package:{ordinarycolon:":",vcentcolon:"\\mathrel{\\mathop\\ordinarycolon}",dblcolon:'{\\mathop{\\char"2237}}',coloneqq:'{\\mathop{\\char"2254}}',Coloneqq:'{\\mathop{\\char"2237\\char"3D}}',coloneq:'{\\mathop{\\char"3A\\char"2212}}',Coloneq:'{\\mathop{\\char"2237\\char"2212}}',eqqcolon:'{\\mathop{\\char"2255}}',Eqqcolon:'{\\mathop{\\char"3D\\char"2237}}',eqcolon:'{\\mathop{\\char"2239}}',Eqcolon:'{\\mathop{\\char"2212\\char"2237}}',colonapprox:'{\\mathop{\\char"003A\\char"2248}}',Colonapprox:'{\\mathop{\\char"2237\\char"2248}}',colonsim:'{\\mathop{\\char"3A\\char"223C}}',Colonsim:'{\\mathop{\\char"2237\\char"223C}}',colondash:"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}",Colondash:"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}",dashcolon:"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Dashcolon:"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}"}},ratio:"\\vcentcolon",coloncolon:"\\dblcolon",colonequals:"\\coloneq",coloncolonequals:"\\Coloneq",equalscolon:"\\eqcolon",equalscoloncolon:"\\Eqcolon",colonminus:"\\colondash",coloncolonminus:"\\Colondash",minuscolon:"\\dashcolon",minuscoloncolon:"\\Dashcolon",coloncolonapprox:"\\Colonapprox",coloncolonsim:"\\Colonsim",simcolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Simcolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}",simcoloncolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}",approxcolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Approxcolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}",approxcoloncolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}",notni:"\\mathrel{\\char`\u220C}",limsup:"\\operatorname*{lim\\,sup}",liminf:"\\operatorname*{lim\\,inf}",injlim:"\\operatorname*{inj\\,lim}",projlim:"\\operatorname*{proj\\,lim}",varlimsup:"\\operatorname*{\\overline{lim}}",varliminf:"\\operatorname*{\\underline{lim}}",varinjlim:"\\operatorname*{\\underrightarrow{lim}}",varprojlim:"\\operatorname*{\\underleftarrow{lim}}",argmin:"\\operatorname*{arg\\,min}",argmax:"\\operatorname*{arg\\,max}",plim:"\\mathop{\\operatorname{plim}}\\limits",tripledash:{def:"\\vphantom{-}\\raise{4mu}{\\mkern1.5mu\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2mu}}",expand:!0},"braket.sty":{package:Zi},"amsmath.sty":{package:sn,primitive:!0},"texvc.sty":{package:ri,primitive:!1}},P={" ":32,"\\!":33,"\\#":35,"\\$":36,"\\%":37,"\\&":38,"-":45,"\\textunderscore":95,"\\euro":8364,"\\maltese":10016,"\\{":123,"\\}":125,"\\textbraceleft":123,"\\textbraceright":125,"\\lbrace":123,"\\rbrace":125,"\\lbrack":91,"\\rbrack":93,"\\nobreakspace":160,"\\ldots":8230,"\\textellipsis":8230,"\\backslash":92,"`":8216,"'":8217,"``":8220,"''":8221,"\\degree":176,"\\textasciicircum":94,"\\textasciitilde":126,"\\textasteriskcentered":42,"\\textbackslash":92,"\\textbullet":8226,"\\textdollar":36,"\\textsterling":163,"\\textdagger":8224,"\\textdaggerdbl":8225,"\u2013":8211,"\u2014":8212,"\u2018":8216,"\u2019":8217,"\u201C":8220,"\u201D":8221,'"':8221,"\\ss":223,"\\ae":230,"\\oe":339,"\\AE":198,"\\OE":338,"\\O":216,"\\i":305,"\\j":567,"\\aa":229,"\\AA":197},E=/[\w!@*()-=+{}\[\]\\';:?/.,~<>`|$%#&^" ]/,B,U;de()?(B=new RegExp("\\p{Letter}","u"),U=new RegExp("[0-9\\p{Letter}]","u")):(B=/[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/,U=/[\da-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/);function D(r,o,u="mord",d){o!==void 0&&(Ue[r]={definitionType:"symbol",type:u,variant:d,codepoint:o},Fi[o]||(Fi[o]=r))}function St(r,o,u){if(typeof r=="string"){for(let d=0;d<r.length;d++){const g=r.charAt(d);D(g,g.codePointAt(0))}return}for(const[d,g,b,M]of r)D(d,g,b!=null?b:o,M!=null?M:u)}function ae(r,o){for(let u=r;u<=o;u++)D(String.fromCodePoint(u),u)}function $e(r){var o;return(o=Ai[r])!=null?o:null}function Ae(r,o){var u,d;if(o.length===0||o==="\\"||!o.startsWith("\\"))return[];const g=[];for(const M in wi)M.startsWith(o)&&!wi[M].infix&&g.push({match:M,frequency:(u=wi[M].frequency)!=null?u:0});for(const M in Ue)M.startsWith(o)&&g.push({match:M,frequency:(d=Ue[M].frequency)!=null?d:0});const b=o.substring(1);for(const M of Object.keys(r.options.macros))M.startsWith(b)&&g.push({match:"\\"+M,frequency:0});return g.sort((M,N)=>{var I,F;return M.frequency===N.frequency?M.match.length===N.match.length?M.match<N.match?-1:1:M.match.length-N.match.length:((I=N.frequency)!=null?I:0)-((F=M.frequency)!=null?F:0)}),g.map(M=>M.match)}function Qe(r){let o="auto";const u=r.match(/:([^=]+)/);return u&&(o=u[1].trim()),o}function He(r){if(!r)return[];const o=[];let u=r.split("]");if(u[0].startsWith("[")){o.push({isOptional:!0,type:Qe(u[0].slice(1))});for(let d=1;d<=u.length;d++)o.push(...He(u[d]))}else if(u=r.split("}"),u[0].startsWith("{")){o.push({isOptional:!1,type:Qe(u[0].slice(1))});for(let d=1;d<=u.length;d++)o.push(...He(u[d]))}return o}function Si(r){if(!r)return"";let o="",u=!0;for(const d of r)typeof d.value=="string"?o+=d.value:u=!1;return u?o:""}function Ei(r,o){typeof r=="string"&&(r=[r]);const u={tabular:!1,params:[],createAtom:o};for(const d of r)Ai[d]=u}function Ci(r,o,u){typeof r=="string"&&(r=[r]);const g={tabular:!0,params:He(o),createAtom:u};for(const b of r)Ai[b]=g}function qt(r,o,u){var d,g;u||(u={});const b={definitionType:"function",params:He(o),ifMode:u.ifMode,isFunction:(d=u.isFunction)!=null?d:!1,applyMode:u.applyMode,infix:(g=u.infix)!=null?g:!1,parse:u.parse,createAtom:u.createAtom,applyStyle:u.applyStyle,serialize:u.serialize,render:u.render};if(typeof r=="string")wi["\\"+r]=b;else for(const M of r)wi["\\"+M]=b}var ei;function ln(r){return ei||(ei=oe(j)),r?oe(Q(Q({},ei),r)):ei}function Ft(r,o){var u,d,g,b;if(typeof r=="string"){let M=0;const N=r;return/(^|[^\\])#1/.test(N)&&(M=1),/(^|[^\\])#2/.test(N)&&(M=2),/(^|[^\\])#3/.test(N)&&(M=3),/(^|[^\\])#4/.test(N)&&(M=4),/(^|[^\\])#5/.test(N)&&(M=5),/(^|[^\\])#6/.test(N)&&(M=6),/(^|[^\\])#7/.test(N)&&(M=7),/(^|[^\\])#8/.test(N)&&(M=8),/(^|[^\\])#9/.test(N)&&(M=9),{expand:(u=o==null?void 0:o.expand)!=null?u:!0,captureSelection:(d=o==null?void 0:o.captureSelection)!=null?d:!0,args:M,def:N}}return Q({expand:(g=o==null?void 0:o.expand)!=null?g:!0,captureSelection:(b=o==null?void 0:o.captureSelection)!=null?b:!0,args:0},r)}function oe(r){if(!r)return{};const o={};for(const u of Object.keys(r)){const d=r[u];if(d==null)delete o[u];else if(typeof d=="object"&&"package"in d)for(const g of Object.keys(d.package))o[g]=Ft(d.package[g],{expand:!d.primitive,captureSelection:d.captureSelection});else o[u]=Ft(d)}return o}function we(r,o="math"){if(!r||r.length===0)return null;let u=null;if(r.startsWith("\\")){if(u=wi[r],u)return!u.ifMode||u.ifMode===o?u:null;o==="math"?u=Ue[r]:P[r]&&(u={definitionType:"symbol",type:"mord",codepoint:P[r]})}else if(o==="math"){if(u=Ue[r],!u&&r.length===1){const d=Pi("math",r.codePointAt(0));return d.startsWith("\\")?rt(Q({},we(d,"math")),{command:d}):null}}else P[r]?u={definitionType:"symbol",type:"mord",codepoint:P[r]}:o==="text"&&(u={definitionType:"symbol",type:"mord",codepoint:r.codePointAt(0)});return u!=null?u:null}function Ii(r,o){if(!r.startsWith("\\"))return null;const u=r.slice(1);return o[u]}function Pi(r,o){if(o===void 0)return"";if(r==="math"&&Fi[o])return Fi[o];if(r==="text"){const u=Object.keys(P).find(d=>P[d]===o);return u||String.fromCodePoint(o)}return String.fromCodePoint(o)}var _i=[0,.68889,0,0,.72222],hn=[0,.68889,0,0,.66667],mn=[0,.68889,0,0,.77778],Ln=[0,.68889,0,0,.61111],jn=[.16667,.68889,0,0,.77778],On=[0,.68889,0,0,.55556],rn=[0,0,0,0,.25],ir=[0,.825,0,0,2.33334],tr=[0,.9,0,0,2.33334],hr=[0,.68889,0,0,.54028],Er=[-.03598,.46402,0,0,.5],Hn=[-.13313,.36687,0,0,1],Ir=[.01354,.52239,0,0,1],T=[.01354,.52239,0,0,1.11111],ur=[0,.54986,0,0,1],$n=[0,.69224,0,0,.5],Yn=[0,.43056,0,0,1],Nr=[.08198,.58198,0,0,.77778],Gn=[.19444,.69224,0,0,.41667],uo=[.1808,.675,0,0,1],zo=[.19444,.69224,0,0,.83334],gr=[.13667,.63667,0,0,1],pn=[-.064,.437,0,0,1.334],gi=[.08167,.58167,0,0,.77778],ct=[0,.69224,0,0,.72222],J=[0,.69224,0,0,.66667],ot=[-.13313,.36687,0,0,.77778],nt=[.06062,.54986,0,0,.77778],Z=[0,.69224,0,0,.77778],xt=[.25583,.75583,0,0,.77778],Ot=[.25142,.75726,0,0,.77778],ge=[.20576,.70576,0,0,.77778],te=[.30274,.79383,0,0,.77778],lt=[.22958,.72958,0,0,.77778],Qt=[.1808,.675,0,0,.77778],me=[.13667,.63667,0,0,.77778],Fe=[.13597,.63597,0,0,.77778],Tt=[.03517,.54986,0,0,.77778],ce=[0,.675,0,0,.77778],bi=[.19444,.69224,0,0,.61111],li=[0,.54986,0,0,.76042],Mi=[0,.54986,0,0,.66667],Pe=[.0391,.5391,0,0,.77778],qe=[.03517,.54986,0,0,1.33334],Re=[.38569,.88569,0,0,.77778],ni=[.23222,.74111,0,0,.77778],Ut=[.19444,.69224,0,0,.77778],Wt=[0,.37788,0,0,.5],Dt=[0,.54986,0,0,.72222],ke=[0,.69224,0,0,.83334],re=[.11111,.69224,0,0,.66667],Ie=[.26167,.75726,0,0,.77778],mt=[.48256,.98256,0,0,.77778],Xe=[.28481,.79383,0,0,.77778],pi=[.08167,.58167,0,0,.22222],ci=[.08167,.58167,0,0,.38889],Ui=[0,.43056,.04028,0,.66667],Ni=[.41951,.91951,0,0,.77778],Gi=[.24982,.74947,0,0,.38865],ki=[.08319,.58283,0,0,.75623],di=[0,.10803,0,0,.27764],Ki=[0,.47534,0,0,.50181],Kt=[.18906,.47534,0,0,.50181],Ri=[0,.69141,0,0,.50181],At=[.24982,.74947,0,0,.27764],vi=[0,.69141,0,0,.21471],Qi=[.25,.75,0,0,.44722],Ti=[0,.64444,0,0,.575],gn=[.08556,.58556,0,0,.89444],Mn=[0,.69444,0,0,.89444],mi=[0,.68611,0,0,.9],Ye=[0,.68611,0,0,.86944],Je=[.25,.75,0,0,.575],Oi=[.25,.75,0,0,.31944],pe=[0,.69444,0,0,.63889],z=[0,.69444,0,0,.31944],fn=[0,.44444,0,0,.63889],vn=[0,.44444,0,0,.51111],Qn=[0,.69444,0,0,.575],Kn=[.13333,.63333,0,0,.89444],Ar=[0,.44444,0,0,.31944],tn=[0,.69444,0,0,.86944],Hi=[0,.68611,0,0,.69166],Sn=[0,.68611,0,0,.83055],Ji=[0,.68611,0,0,.89444],Fn=[0,.69444,0,0,.60278],Xr=[.19444,.69444,0,0,.51111],no=[0,.69444,0,0,.83055],Jn=[-.10889,.39111,0,0,1.14999],ii=[.19444,.69444,0,0,.575],xr=[.19444,.69444,0,0,1.14999],wr=[.19444,.69444,0,0,.70277],ko=[.05556,.75,0,0,.575],br=[0,.68611,0,0,.95833],po=[.08556,.58556,0,0,.76666],ds=[-.02639,.47361,0,0,.575],Ps=[0,.44444,0,0,.89444],xs=[0,.55556,0,0,.76666],Ns=[-.10889,.39111,0,0,.89444],ws=[.00222,.50222,0,0,.89444],It=[.19667,.69667,0,0,.89444],Lo=[.08556,.58556,0,0,1.14999],Va=[0,.69444,0,0,.70277],Ia=[-.02778,.47222,0,0,.575],Xs=[.25,.75,0,0,.51111],Ao=[-.13889,.36111,0,0,1.14999],al=[.19444,.69444,0,0,1.02222],oa=[.12963,.69444,0,0,.89444],vr=[.19444,.69444,0,0,.44722],jr=[0,.64444,.13167,0,.59111],ya=[.19444,.64444,.13167,0,.59111],yn=[0,.68611,.17208,0,.8961],Xn=[.19444,.44444,.105,0,.53222],Pn=[0,.44444,.085,0,.82666],ai=[0,.69444,.06709,0,.59111],cr=[0,.69444,.12945,0,.35555],_r=[0,.69444,0,0,.94888],ro=[0,.69444,.11472,0,.59111],Eo=[0,.68611,.10778,0,.88555],Do=[0,.69444,.07939,0,.62055],Ze=[0,.69444,.12417,0,.30667],Nn=[0,.64444,.13556,0,.51111],An=[.19444,.64444,.13556,0,.51111],Rr=[0,.68333,.16389,0,.74333],Io=[.19444,.43056,.08847,0,.46],Oo=[0,.43056,.07514,0,.71555],on=[0,.69444,.06646,0,.51111],Il=[0,.69444,0,0,.83129],Ys=[0,.69444,.1225,0,.51111],Rs=[0,.68333,.09403,0,.76666],Go=[0,.68333,.11111,0,.76666],Ol=[0,.69444,.06961,0,.51444],sa=[0,.69444,0,0,.27778],fs=[.25,.75,0,0,.38889],jo=[0,.64444,0,0,.5],ll=[0,.69444,0,0,.77778],Ml=[0,.68333,0,0,.75],Cl=[0,.68333,0,0,.77778],yu=[0,.68333,0,0,.68056],Bl=[0,.68333,0,0,.72222],aa=[.25,.75,0,0,.5],zs=[.25,.75,0,0,.27778],Wr=[0,.69444,0,0,.5],kl=[0,.69444,0,0,.55556],xu=[0,.43056,0,0,.44445],Ll=[0,.43056,0,0,.5],zn=[.19444,.43056,0,0,.55556],dr=[0,.43056,0,0,.55556],ho=[.08333,.58333,0,0,.77778],Ms=[0,.43056,0,0,.27778],_o=[0,.66786,0,0,.27778],oo=[0,.69444,0,0,.75],co=[0,.66786,0,0,.5],so=[0,.68333,0,0,.625],ao=[.19444,.69444,0,0,.44445],Oa=[0,.69444,0,0,.72222],Ba=[.19444,.69444,0,0,.5],Ur=[.19444,.69444,0,0,1],tc=[.011,.511,0,0,1.126],wu=[.19444,.69444,0,0,.61111],ec=[.05556,.75,0,0,.5],nn=[0,.68333,0,0,.83334],kd=[.0391,.5391,0,0,.66667],ht=[-.05555,.44445,0,0,.5],fe=[0,.43056,0,0,.77778],ju=[0,.55556,0,0,.66667],Rc=[-.03625,.46375,0,0,.77778],eu=[-.01688,.48312,0,0,.77778],iu=[.0391,.5391,0,0,1],$r=[0,.69444,0,0,.61111],Zr=[-.03472,.46528,0,0,.5],fo=[.25,.75,0,0,.44445],Mr=[-.14236,.35764,0,0,1],an=[.244,.744,0,0,.412],Cs=[.19444,.69444,0,0,.88889],js=[.12963,.69444,0,0,.77778],mo=[.19444,.69444,0,0,.38889],er=[.011,.511,0,0,1.638],$o=[.19444,.69444,0,0,0],ps=[0,.44444,0,0,.575],Or=[.19444,.44444,0,0,.575],xa=[0,.68611,0,0,.75555],As=[0,.69444,0,0,.66759],Sh=[0,.68611,0,0,.80555],Cr=[0,.68611,.08229,0,.98229],wa=[0,.68611,0,0,.76666],Sr=[0,.44444,0,0,.58472],Yr=[.19444,.44444,0,0,.6118],Jr=[.19444,.43056,0,0,.5],Bo=[0,.68333,.02778,.08334,.76278],Tr=[0,.68333,.08125,.05556,.83125],ic=[0,.43056,0,.05556,.48472],kn=[.19444,.43056,0,.08334,.51702],K0=[.25,.75,0,0,.42778],Vn=[0,.69444,0,0,.55],$u=[0,.69444,0,0,.73334],Fl=[0,.69444,0,0,.79445],Ld=[0,.69444,0,0,.51945],_f=[0,.69444,0,0,.70278],Tf=[0,.69444,0,0,.76389],Ku=[.25,.75,0,0,.34306],Mh=[0,.69444,0,0,.56111],Pr=[0,.69444,0,0,.25556],bu=[.19444,.45833,0,0,.56111],Pf=[0,.45833,0,0,.56111],Hu=[0,.69444,0,0,.30556],Ip=[0,.69444,0,0,.58056],Vu=[0,.69444,0,0,.67223],ul=[0,.69444,0,0,.85556],Wu=[0,.69444,0,0,.55834],Js=[0,.65556,.11156,0,.5],Uu=[0,.69444,.08094,0,.70834],Ed=[.17014,0,0,0,.44445],Op=[0,.69444,.0799,0,.5],Bp=[0,.69444,0,0,.73752],H0=[0,.69444,.09205,0,.5],Ch=[0,.69444,.09031,0,.77778],Zu=[0,.69444,.07816,0,.27778],dg=[0,.69444,.00316,0,.5],fg=[.19444,.69444,0,0,.83334],pg=[.05556,.75,0,0,.83334],V0=[0,.75,0,0,.5],Xo=[.125,.08333,0,0,.27778],kh=[0,.08333,0,0,.27778],yr=[0,.65556,0,0,.5],ks=[0,.69444,0,0,.47222],Ko=[0,.69444,0,0,.66667],$s=[0,.69444,0,0,.59722],nc=[0,.69444,0,0,.54167],Ds=[0,.69444,0,0,.70834],rc=[.25,.75,0,0,.28889],Fp=[0,.69444,0,0,.51667],W0=[0,.44444,0,0,.44445],Fa=[.19444,.44444,0,0,.51667],Nf=[0,.44444,0,0,.38333],qr=[0,.44444,0,0,.51667],Lh=[0,.69444,0,0,.83334],Rp=[.35001,.85,0,0,.45834],Eh=[.35001,.85,0,0,.57778],_h=[.35001,.85,0,0,.41667],Af=[.35001,.85,0,0,.58334],rs=[0,.72222,0,0,.55556],Ks=[1e-5,.6,0,0,.66667],oc=[1e-5,.6,0,0,.77778],hl=[.25001,.75,0,0,.94445],Th=[.306,.805,.19445,0,.47222],Wa=[.30612,.805,.19445,0,.47222],Fo=[.25001,.75,0,0,.83334],Ua=[.35001,.85,0,0,.47222],Za=[.25001,.75,0,0,1.11111],Hs=[.65002,1.15,0,0,.59722],El=[.65002,1.15,0,0,.81111],Qr=[.65002,1.15,0,0,.47222],Rl=[.65002,1.15,0,0,.66667],nu=[0,.75,0,0,1],Ph=[.55001,1.05,0,0,1.27778],sc=[.862,1.36,.44445,0,.55556],_d=[.86225,1.36,.44445,0,.55556],Su=[.55001,1.05,0,0,1.11111],ac=[.65002,1.15,0,0,.52778],ar=[.65002,1.15,0,0,.61111],zc=[.55001,1.05,0,0,1.51112],zp=[.95003,1.45,0,0,.73611],Df=[.95003,1.45,0,0,1.04445],ru=[.95003,1.45,0,0,.52778],jc=[.95003,1.45,0,0,.75],lc=[0,.75,0,0,1.44445],jp=[.95003,1.45,0,0,.58334],$c=[1.25003,1.75,0,0,.79167],If=[1.25003,1.75,0,0,1.27778],Kc=[1.25003,1.75,0,0,.58334],uc=[1.25003,1.75,0,0,.80556],hc=[0,.825,0,0,1.8889],Td=[1.25003,1.75,0,0,.63889],cc=[.64502,1.155,0,0,.875],Hc=[1e-5,.6,0,0,.875],Gu=[-99e-5,.601,0,0,.66667],qs=[.64502,1.155,0,0,.66667],Mu=[1e-5,.9,0,0,.88889],Of=[.65002,1.15,0,0,.88889],Xu=[.90001,0,0,0,.88889],Bf=[-.00499,.605,0,0,1.05556],Vc=[0,.12,0,0,.45],wn=[0,.61111,0,0,.525],ba=[.08333,.69444,0,0,.525],dc=[-.08056,.53055,0,0,.525],U0=[-.05556,.55556,0,0,.525],Sa=[0,.43056,0,0,.525],Is=[.22222,.43056,0,0,.525],fc=[0,0,0,0,.525],Z0={"AMS-Regular":{32:rn,65:_i,66:hn,67:_i,68:_i,69:hn,70:Ln,71:mn,72:mn,73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:mn,76:hn,77:[0,.68889,0,0,.94445],78:_i,79:jn,80:Ln,81:jn,82:_i,83:On,84:hn,85:_i,86:_i,87:[0,.68889,0,0,1],88:_i,89:_i,90:hn,107:On,160:rn,165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:On,295:hr,710:ir,732:tr,770:ir,771:tr,989:gi,1008:Ui,8245:[0,.54986,0,0,.275],8463:hr,8487:_i,8498:On,8502:hn,8503:[0,.68889,0,0,.44445],8504:hn,8513:[0,.68889,0,0,.63889],8592:Er,8594:Er,8602:Hn,8603:Hn,8606:Ir,8608:Ir,8610:T,8611:T,8619:ur,8620:ur,8621:[-.13313,.37788,0,0,1.38889],8622:Hn,8624:$n,8625:$n,8630:Yn,8631:Yn,8634:Nr,8635:Nr,8638:Gn,8639:Gn,8642:Gn,8643:Gn,8644:uo,8646:uo,8647:uo,8648:zo,8649:uo,8650:zo,8651:Ir,8652:Ir,8653:Hn,8654:Hn,8655:Hn,8666:gr,8667:gr,8669:[-.13313,.37788,0,0,1],8672:pn,8674:pn,8705:[0,.825,0,0,.5],8708:On,8709:gi,8717:[0,.43056,0,0,.42917],8722:Er,8724:[.08198,.69224,0,0,.77778],8726:gi,8733:Z,8736:ct,8737:ct,8738:[.03517,.52239,0,0,.72222],8739:pi,8740:[.25142,.74111,0,0,.27778],8741:ci,8742:[.25142,.74111,0,0,.5],8756:J,8757:J,8764:ot,8765:[-.13313,.37788,0,0,.77778],8769:ot,8770:Rc,8774:te,8776:eu,8778:gi,8782:nt,8783:nt,8785:Nr,8786:Nr,8787:Nr,8790:Z,8791:lt,8796:[.08198,.91667,0,0,.77778],8806:xt,8807:xt,8808:Ot,8809:Ot,8812:[.25583,.75583,0,0,.5],8814:ge,8815:ge,8816:te,8817:te,8818:lt,8819:lt,8822:Qt,8823:Qt,8828:me,8829:me,8830:lt,8831:lt,8832:ge,8833:ge,8840:te,8841:te,8842:Fe,8843:Fe,8847:Tt,8848:Tt,8858:Nr,8859:Nr,8861:Nr,8862:ce,8863:ce,8864:ce,8865:ce,8872:[0,.69224,0,0,.61111],8873:ct,8874:[0,.69224,0,0,.88889],8876:Ln,8877:Ln,8878:_i,8879:_i,8882:Tt,8883:Tt,8884:me,8885:me,8888:[0,.54986,0,0,1.11111],8890:zn,8891:bi,8892:bi,8901:[0,.54986,0,0,.27778],8903:gi,8905:gi,8906:gi,8907:Z,8908:Z,8909:[-.03598,.46402,0,0,.77778],8910:li,8911:li,8912:Tt,8913:Tt,8914:Mi,8915:Mi,8916:J,8918:Pe,8919:Pe,8920:qe,8921:qe,8922:Re,8923:Re,8926:me,8927:me,8928:te,8929:te,8934:ni,8935:ni,8936:ni,8937:ni,8938:ge,8939:ge,8940:te,8941:te,8994:Ut,8995:Ut,9416:[.15559,.69224,0,0,.90222],9484:$n,9488:$n,9492:Wt,9496:Wt,9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:ce,9633:ce,9650:Dt,9651:Dt,9654:Tt,9660:Dt,9661:Dt,9664:Tt,9674:re,9733:[.19444,.69224,0,0,.94445],10003:ke,10016:ke,10731:re,10846:[.19444,.75583,0,0,.61111],10877:me,10878:me,10885:xt,10886:xt,10887:Fe,10888:Fe,10889:Ie,10890:Ie,10891:mt,10892:mt,10901:me,10902:me,10933:Ot,10934:Ot,10935:Ie,10936:Ie,10937:Ie,10938:Ie,10949:xt,10950:xt,10955:Xe,10956:Xe,57350:pi,57351:ci,57352:gi,57353:Ui,57356:Ot,57357:Ot,57358:Ni,57359:te,57360:te,57361:Ni,57366:Ot,57367:Ot,57368:Ot,57369:Ot,57370:Fe,57371:Fe},"Caligraphic-Regular":{32:rn,65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:rn},"Fraktur-Regular":{32:rn,33:[0,.69141,0,0,.29574],34:vi,38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:Gi,41:Gi,42:[0,.62119,0,0,.27764],43:ki,44:di,45:ki,46:di,47:[.24982,.74947,0,0,.50181],48:Ki,49:Ki,50:Ki,51:Kt,52:Kt,53:Kt,54:Ri,55:Kt,56:Ri,57:Kt,58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:At,93:At,94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:rn,8216:vi,8217:vi,58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:rn,33:[0,.69444,0,0,.35],34:Fn,35:[.19444,.69444,0,0,.95833],36:ko,37:[.05556,.75,0,0,.95833],38:Mn,39:z,40:Qi,41:Qi,42:[0,.75,0,0,.575],43:Kn,44:[.19444,.15556,0,0,.31944],45:Nf,46:[0,.15556,0,0,.31944],47:Je,48:Ti,49:Ti,50:Ti,51:Ti,52:Ti,53:Ti,54:Ti,55:Ti,56:Ti,57:Ti,58:Ar,59:[.19444,.44444,0,0,.31944],60:gn,61:Ns,62:gn,63:[0,.69444,0,0,.54305],64:Mn,65:Ye,66:[0,.68611,0,0,.81805],67:Sn,68:[0,.68611,0,0,.88194],69:xa,70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:mi,73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:Hi,77:[0,.68611,0,0,1.09166],78:mi,79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:Ye,89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:Oi,92:Je,93:Oi,94:Qn,95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:pe,99:vn,100:pe,101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:pe,105:z,106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:z,109:[0,.44444,0,0,.95833],110:fn,111:ps,112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:fn,118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:vn,123:Je,124:Oi,125:Je,126:[.35,.34444,0,0,.575],160:rn,163:[0,.69444,0,0,.86853],168:Qn,172:[0,.44444,0,0,.76666],176:tn,177:Kn,184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:Kn,216:[.04861,.73472,0,0,.89444],223:$s,230:[0,.44444,0,0,.83055],247:Kn,248:[.09722,.54167,0,0,.575],305:Ar,338:[0,.68611,0,0,1.16944],339:Ps,567:[.19444,.44444,0,0,.35139],710:Qn,711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:Qn,715:Qn,728:Qn,729:z,730:tn,732:Qn,733:Qn,915:Hi,916:br,920:Ji,923:Sh,926:wa,928:mi,931:Sn,933:Ji,934:Sn,936:Ji,937:Sn,8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:z,8217:z,8220:Fn,8221:Fn,8224:Xr,8225:Xr,8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:As,8465:no,8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:no,8501:Va,8592:Jn,8593:ii,8594:Jn,8595:ii,8596:Jn,8597:Je,8598:xr,8599:xr,8600:xr,8601:xr,8636:Jn,8637:Jn,8640:Jn,8641:Jn,8656:Jn,8657:wr,8658:Jn,8659:wr,8660:Jn,8661:[.25,.75,0,0,.70277],8704:pe,8706:[0,.69444,.06389,0,.62847],8707:pe,8709:ko,8711:br,8712:po,8715:po,8722:Kn,8723:Kn,8725:Je,8726:Je,8727:Ia,8728:ds,8729:ds,8730:[.18,.82,0,0,.95833],8733:Ps,8734:[0,.44444,0,0,1.14999],8736:ct,8739:Oi,8741:Je,8743:xs,8744:xs,8745:xs,8746:xs,8747:[.19444,.69444,.12778,0,.56875],8764:Ns,8768:[.19444,.69444,0,0,.31944],8771:ws,8776:[.02444,.52444,0,0,.89444],8781:ws,8801:ws,8804:It,8805:It,8810:Lo,8811:Lo,8826:gn,8827:gn,8834:gn,8835:gn,8838:It,8839:It,8846:xs,8849:It,8850:It,8851:xs,8852:xs,8853:Kn,8854:Kn,8855:Kn,8856:Kn,8857:Kn,8866:Va,8867:Va,8868:Mn,8869:Mn,8900:ds,8901:[-.02639,.47361,0,0,.31944],8902:Ia,8968:Xs,8969:Xs,8970:Xs,8971:Xs,8994:Ao,8995:Ao,9651:al,9657:Ia,9661:al,9667:Ia,9711:xr,9824:oa,9825:oa,9826:oa,9827:oa,9837:[0,.75,0,0,.44722],9838:vr,9839:vr,10216:Qi,10217:Qi,10815:mi,10927:It,10928:It,57376:$o},"Main-BoldItalic":{32:rn,33:[0,.69444,.11417,0,.38611],34:Do,35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:cr,40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:jr,49:jr,50:jr,51:jr,52:ya,53:jr,54:jr,55:ya,56:jr,57:jr,58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:ro,64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:yn,73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:yn,79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:ai,95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:Xn,104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:Xn,114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:rn,168:[0,.69444,.11473,0,.59111],176:_r,184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:Pn,248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:Pn,567:[.19444,.44444,.04611,0,.385],710:ai,711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:cr,730:_r,732:ro,733:ro,915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:yn,931:[0,.68611,.11431,0,.82666],933:Eo,934:[0,.68611,.05632,0,.82666],936:Eo,937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:cr,8217:cr,8220:[0,.69444,.16772,0,.62055],8221:Do},"Main-Italic":{32:rn,33:Ze,34:Ol,35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:Ze,40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:Nn,49:Nn,50:Nn,51:Nn,52:An,53:Nn,54:Nn,55:An,56:Nn,57:Nn,58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:Ys,64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:Rr,73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:Rr,79:Rs,80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:Rr,86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:on,95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:Io,104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:Io,114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:rn,168:[0,.66786,.10474,0,.51111],176:Il,184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:Oo,248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:Oo,710:on,711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:Il,732:[0,.66786,.11585,0,.51111],733:Ys,915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:Rs,923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:Rr,931:[0,.68333,.12028,0,.71555],933:Go,934:[0,.68333,.05986,0,.71555],936:Go,937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:Ze,8217:Ze,8220:[0,.69444,.1685,0,.51444],8221:Ol,8463:hr},"Main-Regular":{32:rn,33:sa,34:Wr,35:fg,36:ec,37:pg,38:ll,39:sa,40:fs,41:fs,42:V0,43:ho,44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:aa,48:jo,49:jo,50:jo,51:jo,52:jo,53:jo,54:jo,55:jo,56:jo,57:jo,58:Ms,59:[.19444,.43056,0,0,.27778],60:Pe,61:ot,62:Pe,63:ks,64:ll,65:Ml,66:[0,.68333,0,0,.70834],67:Bl,68:[0,.68333,0,0,.76389],69:yu,70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:Ml,73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:Cl,76:so,77:[0,.68333,0,0,.91667],78:Ml,79:Cl,80:yu,81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:Bl,85:Ml,86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:Ml,89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:zs,92:aa,93:zs,94:Wr,95:[.31,.12056,.02778,0,.5],97:Ll,98:kl,99:xu,100:kl,101:xu,102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:kl,105:_o,106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:sa,109:[0,.43056,0,0,.83334],110:dr,111:Ll,112:zn,113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:dr,118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:xu,123:aa,124:zs,125:aa,126:[.35,.31786,0,0,.5],160:rn,163:[0,.69444,0,0,.76909],167:ao,168:co,172:[0,.43056,0,0,.66667],176:oo,177:ho,182:wu,184:Ed,198:[0,.68333,0,0,.90278],215:ho,216:[.04861,.73194,0,0,.77778],223:Wr,230:[0,.43056,0,0,.72222],247:ho,248:[.09722,.52778,0,0,.5],305:Ms,338:[0,.68333,0,0,1.01389],339:fe,567:[.19444,.43056,0,0,.30556],710:Wr,711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:Wr,715:Wr,728:Wr,729:_o,730:oo,732:co,733:Wr,915:so,916:nn,920:Cl,923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:Ml,931:Bl,933:Cl,934:Bl,936:Cl,937:Bl,8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:sa,8217:sa,8220:Wr,8221:Wr,8224:ao,8225:ao,8230:[0,.12,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:hr,8465:Oa,8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:Oa,8501:$r,8592:Hn,8593:Ba,8594:Hn,8595:Ba,8596:Hn,8597:aa,8598:Ur,8599:Ur,8600:Ur,8601:Ur,8614:[.011,.511,0,0,1],8617:tc,8618:tc,8636:Hn,8637:Hn,8640:Hn,8641:Hn,8652:[.011,.671,0,0,1],8656:Hn,8657:wu,8658:Hn,8659:wu,8660:Hn,8661:[.25,.75,0,0,.61111],8704:kl,8706:[0,.69444,.05556,.08334,.5309],8707:kl,8709:ec,8711:nn,8712:kd,8715:kd,8722:ho,8723:ho,8725:aa,8726:aa,8727:Zr,8728:ht,8729:ht,8730:[.2,.8,0,0,.83334],8733:fe,8734:Yn,8736:ct,8739:zs,8741:aa,8743:ju,8744:ju,8745:ju,8746:ju,8747:[.19444,.69444,.11111,0,.41667],8764:ot,8768:[.19444,.69444,0,0,.27778],8771:Rc,8773:[-.022,.589,0,0,1],8776:eu,8781:Rc,8784:[-.133,.67,0,0,.778],8801:Rc,8804:Fe,8805:Fe,8810:iu,8811:iu,8826:Pe,8827:Pe,8834:Pe,8835:Pe,8838:Fe,8839:Fe,8846:ju,8849:Fe,8850:Fe,8851:ju,8852:ju,8853:ho,8854:ho,8855:ho,8856:ho,8857:ho,8866:$r,8867:$r,8868:ll,8869:ll,8872:[.249,.75,0,0,.867],8900:ht,8901:[-.05555,.44445,0,0,.27778],8902:Zr,8904:[.005,.505,0,0,.9],8942:[.03,.9,0,0,.278],8943:[-.19,.31,0,0,1.172],8945:[-.1,.82,0,0,1.282],8968:fo,8969:fo,8970:fo,8971:fo,8994:Mr,8995:Mr,9136:an,9137:an,9651:Cs,9657:Zr,9661:Cs,9667:Zr,9711:Ur,9824:js,9825:js,9826:js,9827:js,9837:[0,.75,0,0,.38889],9838:mo,9839:mo,10216:fs,10217:fs,10222:an,10223:an,10229:[.011,.511,0,0,1.609],10230:er,10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:er,10815:Ml,10927:Fe,10928:Fe,57376:$o},"Math-BoldItalic":{32:rn,48:ps,49:ps,50:ps,51:Or,52:Or,53:Or,54:Ti,55:Or,56:Ti,57:Or,65:Ye,66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:Cr,73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:xa,77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:As,105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:Sr,112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:rn,915:[0,.68611,.15972,0,.65694],916:br,920:[0,.68611,.03194,0,.86722],923:Sh,926:[0,.68611,.07458,0,.84125],928:Cr,931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:wa,936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:Sr,960:[0,.44444,.03704,0,.68241],961:Yr,962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:Yr,1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:rn,48:Ll,49:Ll,50:Ll,51:Jr,52:Jr,53:Jr,54:jo,55:Jr,56:jo,57:Jr,65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:Tr,73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:Bo,80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:ic,112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:rn,915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:Bo,923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:Tr,931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:ic,960:[0,.43056,.03588,0,.57003],961:kn,962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:kn,1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:rn,33:[0,.69444,0,0,.36667],34:Wu,35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:Hu,40:K0,41:K0,42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:Vn,49:Vn,50:Vn,51:Vn,52:Vn,53:Vn,54:Vn,55:Vn,56:Vn,57:Vn,58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:Ld,64:$u,65:$u,66:$u,67:_f,68:Fl,69:[0,.69444,0,0,.64167],70:$r,71:$u,72:Fl,73:[0,.69444,0,0,.33056],74:Ld,75:Tf,76:Ip,77:[0,.69444,0,0,.97778],78:Fl,79:Fl,80:_f,81:[.10556,.69444,0,0,.79445],82:_f,83:$r,84:$u,85:Tf,86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:$u,89:[0,.69444,.0275,0,.73334],90:Vu,91:Ku,93:Ku,94:Vn,95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:Mh,99:[0,.45833,0,0,.48889],100:Mh,101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:Mh,105:Pr,106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:Pr,109:[0,.45833,0,0,.86667],110:Pf,111:[0,.45833,0,0,.55],112:bu,113:bu,114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:Pf,118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:rn,168:Vn,176:$u,180:Vn,184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:Vn,711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:Vn,729:Hu,730:$u,732:Vn,733:Vn,915:Ip,916:[0,.69444,0,0,.91667],920:ul,923:Vu,926:$u,928:Fl,931:Fl,933:ul,934:Fl,936:ul,937:Fl,8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:Hu,8217:Hu,8220:Wu,8221:Wu},"SansSerif-Italic":{32:rn,33:[0,.69444,.05733,0,.31945],34:dg,35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:Zu,40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:Xo,45:[0,.44444,.01946,0,.33333],46:kh,47:[.25,.75,.13164,0,.5],48:Js,49:Js,50:Js,51:Js,52:Js,53:Js,54:Js,55:Js,56:Js,57:Js,58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:Ko,66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:Uu,73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:nc,77:[0,.69444,.08094,0,.875],78:Uu,79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:Op,95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:rn,168:[0,.67937,.06385,0,.5],176:Bp,184:Ed,305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:Op,711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:H0,715:Wr,728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:Bp,732:[0,.67659,.08826,0,.5],733:H0,915:[0,.69444,.13372,0,.54167],916:Lh,920:[0,.69444,.07555,0,.77778],923:$r,926:[0,.69444,.12816,0,.66667],928:Uu,931:[0,.69444,.11983,0,.72222],933:Ch,934:[0,.69444,.04603,0,.72222],936:Ch,937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:Zu,8217:Zu,8220:[0,.69444,.14205,0,.5],8221:dg},"SansSerif-Regular":{32:rn,33:[0,.69444,0,0,.31945],34:Wr,35:fg,36:ec,37:pg,38:[0,.69444,0,0,.75834],39:sa,40:fs,41:fs,42:V0,43:ho,44:Xo,45:[0,.44444,0,0,.33333],46:kh,47:aa,48:yr,49:yr,50:yr,51:yr,52:yr,53:yr,54:yr,55:yr,56:yr,57:yr,58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:ks,64:Ko,65:Ko,66:Ko,67:pe,68:[0,.69444,0,0,.72223],69:$s,70:[0,.69444,0,0,.56945],71:Ko,72:Ds,73:sa,74:ks,75:[0,.69444,0,0,.69445],76:nc,77:[0,.69444,0,0,.875],78:Ds,79:[0,.69444,0,0,.73611],80:pe,81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:kl,84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:Ko,89:[0,.69444,.025,0,.66667],90:$r,91:rc,93:rc,94:Wr,95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:Fp,99:W0,100:Fp,101:W0,102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:Fp,105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:qr,111:[0,.44444,0,0,.5],112:Fa,113:Fa,114:[0,.44444,.01389,0,.34167],115:Nf,116:[0,.57143,0,0,.36111],117:qr,118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:rn,168:[0,.67937,0,0,.5],176:Ko,184:Ed,305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:Wr,711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:Wr,715:Wr,728:Wr,729:[0,.67937,0,0,.27778],730:Ko,732:[0,.67659,0,0,.5],733:Wr,915:nc,916:Lh,920:ll,923:$r,926:Ko,928:Ds,931:Oa,933:ll,934:Oa,936:ll,937:Oa,8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:sa,8217:sa,8220:Wr,8221:Wr},"Script-Regular":{32:rn,65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:rn},"Size1-Regular":{32:rn,40:Rp,41:Rp,47:Eh,91:_h,92:Eh,93:_h,123:Af,125:Af,160:rn,710:rs,732:rs,770:rs,771:rs,8214:[-99e-5,.601,0,0,.77778],8593:Ks,8595:Ks,8657:oc,8659:oc,8719:hl,8720:hl,8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:Wa,8748:Th,8749:Th,8750:Wa,8896:Fo,8897:Fo,8898:Fo,8899:Fo,8968:Ua,8969:Ua,8970:Ua,8971:Ua,9168:Gu,10216:Ua,10217:Ua,10752:Za,10753:Za,10754:Za,10756:Fo,10758:Fo},"Size2-Regular":{32:rn,40:Hs,41:Hs,47:El,91:Qr,92:El,93:Qr,123:Rl,125:Rl,160:rn,710:nu,732:nu,770:nu,771:nu,8719:Ph,8720:Ph,8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:_d,8748:sc,8749:sc,8750:_d,8896:Su,8897:Su,8898:Su,8899:Su,8968:ac,8969:ac,8970:ac,8971:ac,10216:ar,10217:ar,10752:zc,10753:zc,10754:zc,10756:Su,10758:Su},"Size3-Regular":{32:rn,40:zp,41:zp,47:Df,91:ru,92:Df,93:ru,123:jc,125:jc,160:rn,710:lc,732:lc,770:lc,771:lc,8730:[.95003,1.45,0,0,1],8968:jp,8969:jp,8970:jp,8971:jp,10216:jc,10217:jc},"Size4-Regular":{32:rn,40:$c,41:$c,47:If,91:Kc,92:If,93:Kc,123:uc,125:uc,160:rn,710:hc,732:hc,770:hc,771:hc,8730:[1.25003,1.75,0,0,1],8968:Td,8969:Td,8970:Td,8971:Td,9115:cc,9116:Hc,9117:cc,9118:cc,9119:Hc,9120:cc,9121:qs,9122:Gu,9123:qs,9124:qs,9125:Gu,9126:qs,9127:Mu,9128:Of,9129:Xu,9130:[0,.3,0,0,.88889],9131:Mu,9132:Of,9133:Xu,9143:[.88502,.915,0,0,1.05556],10216:uc,10217:uc,57344:Bf,57345:Bf,57680:Vc,57681:Vc,57682:Vc,57683:Vc},"Typewriter-Regular":{32:fc,33:wn,34:wn,35:wn,36:ba,37:ba,38:wn,39:wn,40:ba,41:ba,42:[0,.52083,0,0,.525],43:dc,44:[.13889,.125,0,0,.525],45:dc,46:[0,.125,0,0,.525],47:ba,48:wn,49:wn,50:wn,51:wn,52:wn,53:wn,54:wn,55:wn,56:wn,57:wn,58:Sa,59:[.13889,.43056,0,0,.525],60:U0,61:[-.19549,.41562,0,0,.525],62:U0,63:wn,64:wn,65:wn,66:wn,67:wn,68:wn,69:wn,70:wn,71:wn,72:wn,73:wn,74:wn,75:wn,76:wn,77:wn,78:wn,79:wn,80:wn,81:[.13889,.61111,0,0,.525],82:wn,83:wn,84:wn,85:wn,86:wn,87:wn,88:wn,89:wn,90:wn,91:ba,92:ba,93:ba,94:wn,95:[.09514,0,0,0,.525],96:wn,97:Sa,98:wn,99:Sa,100:wn,101:Sa,102:wn,103:Is,104:wn,105:wn,106:[.22222,.61111,0,0,.525],107:wn,108:wn,109:Sa,110:Sa,111:Sa,112:Is,113:Is,114:Sa,115:Sa,116:[0,.55358,0,0,.525],117:Sa,118:Sa,119:Sa,120:Sa,121:Is,122:Sa,123:ba,124:ba,125:ba,126:wn,127:wn,160:fc,176:wn,184:[.19445,0,0,0,.525],305:Sa,567:Is,711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:wn,715:wn,728:wn,730:wn,770:wn,771:wn,776:wn,915:wn,916:wn,920:wn,923:wn,926:wn,928:wn,931:wn,933:wn,934:wn,936:wn,937:wn,8216:wn,8217:wn,8242:wn,9251:[.11111,.21944,0,0,.525]}},Ff=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/,Yu=10,la=.25,Rf=1.2,Ju=.431,ms={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[Ju,Ju,Ju],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.5,.732,.925],num2:[.394,.384,.5],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[la,la,la],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04]},Wc=[0,.5,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],qu=5,pc={"\xA0":" ","\u200B":" ",\u00C5:"A",\u00C7:"C",\u00D0:"D",\u00DE:"o",\u00E5:"a",\u00E7:"c",\u00F0:"d",\u00FE:"o",\u0410:"A",\u0411:"B",\u0412:"B",\u0413:"F",\u0414:"A",\u0415:"E",\u0416:"K",\u0417:"3",\u0418:"N",\u0419:"N",\u041A:"K",\u041B:"N",\u041C:"M",\u041D:"H",\u041E:"O",\u041F:"N",\u0420:"P",\u0421:"C",\u0422:"T",\u0423:"y",\u0424:"O",\u0425:"X",\u0426:"U",\u0427:"h",\u0428:"W",\u0429:"W",\u042A:"B",\u042B:"X",\u042C:"B",\u042D:"3",\u042E:"X",\u042F:"R",\u0430:"a",\u0431:"b",\u0432:"a",\u0433:"r",\u0434:"y",\u0435:"e",\u0436:"m",\u0437:"e",\u0438:"n",\u0439:"n",\u043A:"n",\u043B:"n",\u043C:"m",\u043D:"n",\u043E:"o",\u043F:"n",\u0440:"p",\u0441:"c",\u0442:"o",\u0443:"y",\u0444:"b",\u0445:"x",\u0446:"n",\u0447:"n",\u0448:"w",\u0449:"w",\u044A:"a",\u044B:"m",\u044C:"a",\u044D:"e",\u044E:"m",\u044F:"r"};function Qu(r,o){r===void 0&&(r=77);const u=Z0[o][r];if(u)return{defaultMetrics:!1,depth:u[0],height:u[1],italic:u[2],skew:u[3],width:u[4]};if(r===11034)return{defaultMetrics:!0,depth:.2,height:.8,italic:0,skew:0,width:.8};const d=String.fromCodePoint(r);if(d in pc)r=pc[d].codePointAt(0);else if(Ff.test(d))return r=77,{defaultMetrics:!0,depth:.2,height:.9,italic:0,skew:0,width:1};return{defaultMetrics:!0,depth:.2,height:.7,italic:0,skew:0,width:.8}}var zf={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],longrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],longleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],longleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],longrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],longleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xleftrightarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],longleftrightarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xRightleftharpoons:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],longRightleftharpoons:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xLeftrightharpoons:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716],longLeftrightharpoons:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},mc={widehat1:[1062,239,.24],widehat2:[2364,300,.3],widehat3:[2364,360,.36],widehat4:[2364,420,.42],widecheck1:[1062,239,.24],widecheck2:[2364,300,.3],widecheck3:[2364,360,.36],widecheck4:[2364,420,.42],widetilde1:[600,260,.26],widetilde2:[1033,286,.286],widetilde3:[2339,306,.306],widetilde4:[2340,312,.34],overarc:[1061,159,.3],underarc:[1061,159,.3]},G0={doubleleftarrow:`M262 157
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,overarc:"M529 0c179 0 524 115 524 115 5 1 9 5 9 10 0 1-1 2-1 3l-4 22c-1 5-5 9-11 9h-2s-338-93-512-92c-174 0-513 92-513 92h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13 0 0 342-115 520-115z",underarc:`m 529 160
c -179 0 -524 -115 -524 -115
c -5 -1 -9 -5 -9 -10
c 0 -1 1 -2 1 -3
l 4 -22
c 1 -5 5 -9 11 -9
h 2
s 338 93 512 92
c 174 0 513 -92 513 -92
h 2
c 5 0 9 4 11 9
l 5 22
c 1 6 -2 12 -8 13
c 0 0 -342 115 -520 115
z
`,leftgroup:`M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
435 0h399565z`,leftgroupunder:`M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z
M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z
M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z
M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,widetilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
-68.267.847-113-73.952-191-73.952z`,widetilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
181.476 676 181.476c-149 0-189-126.21-332-126.21z`,widetilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
-338 0-409-156.573-744-156.573z`,widetilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
-175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`};function Uc(r){if(mc[r]){const[F,$,it]=mc[r],gt=`<span class="stretchy" style="height:${it}em"><svg width="100%" height="${it}em" viewBox="0 0 ${F} ${$}" preserveAspectRatio="none" ><path fill="currentcolor" d="${G0[r]}"></path></svg></span>`;return`<span style="display:inline-block;height:${Math.floor(100*it/2)/100}em;min-width:0">${gt}</span>`}const[o,u,d,g]=zf[r];let b,M;const N=d/1e3;o.length===3?(b=["slice-1-of-3","slice-2-of-3","slice-3-of-3"],M=["xMinYMin","xMidYMin","xMaxYMin"]):o.length===2?(b=["slice-1-of-2","slice-2-of-2"],M=["xMinYMin","xMaxYMin"]):(b=["slice-1-of-1"],M=[g]);const I=o.map((F,$)=>`<span class="${b[$]}" style=height:${N}em><svg width=400em height=${N}em viewBox="0 0 400000 ${d}" preserveAspectRatio="${M[$]} slice"><path fill="currentcolor" d="${G0[F]}"></path></svg></span>`).join("");return`<span style="display:inline-block;height:${N}em;min-width:${u}em;">${I}</span>`}function zl(r){return zf[r]?zf[r][2]/1e3:mc[r][2]}function mg(r){const o=[];for(let u=0;u<r.length;u++){let d=r.charCodeAt(u);if(d===13&&r.charCodeAt(u+1)===10&&(d=10,u++),(d===13||d===12)&&(d=10),d===0&&(d=65533),d>=55296&&d<=56319){const g=r.charCodeAt(u+1);if(g>=56320&&g<=57343){const b=d-55296,M=g-56320;d=Ef(2,16)+b*Ef(2,10)+M,u++}}o.push(d)}return o}var Pd=8205,Zc=[[Pd,1],[65038,2],[127995,5],[129456,4],[917536,96]],Nh,Ho=[127462,127487];function th(r){var o;if(Nh===void 0){Nh={};for(const u of Zc)for(let d=u[0];d<=u[0]+u[1]-1;d++)Nh[d]=!0}return(o=Nh[r])!=null?o:!1}function gg(r){return r>=Ho[0]&&r<=Ho[1]}function jf(r){if(/^[\u0020-\u00FF]*$/.test(r))return r;const o=[],u=mg(r);let d=0;for(;d<u.length;){const g=u[d++],b=u[d];if(b===Pd){const M=d-1;for(d+=2;u[d]===Pd;)d+=2;o.push(String.fromCodePoint(...u.slice(M,d-M+1)))}else if(th(b)){const M=d-1;for(;th(u[d]);)d+=u[d]===Pd?2:1;o.push(String.fromCodePoint(...u.slice(M,2*d-M-1)))}else gg(g)?(d+=1,o.push(String.fromCodePoint(...u.slice(d-2,2)))):o.push(String.fromCodePoint(g))}return o}var vg=class{constructor(r){this.obeyspaces=!1,this.pos=0,this.s=jf(r)}end(){return this.pos>=this.s.length}get(){return this.pos<this.s.length?this.s[this.pos++]:""}peek(){return this.s[this.pos]}match(r){const o=typeof this.s=="string"?r.exec(this.s.slice(this.pos)):r.exec(this.s.slice(this.pos).join(""));return o!=null&&o[0]?(this.pos+=o[0].length,o[0]):""}next(){if(this.end())return null;if(!this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]+/)||this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]/))return"<space>";const r=this.get();if(r==="\\"){if(!this.end()){let o=this.match(/^[a-zA-Z\*]+/);return o?this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]*/):o=this.get(),"\\"+o}}else{if(r==="{")return"<{>";if(r==="}")return"<}>";if(r==="^"){if(this.peek()==="^"){this.get();const o=this.match(/^(\^(\^(\^(\^[\da-f])?[\da-f])?[\da-f])?[\da-f])?[\da-f]{2}/);if(o)return String.fromCodePoint(Number.parseInt(o.slice(o.lastIndexOf("^")+1),16))}return r}else if(r==="#"){if(!this.end()){let o=!1;if(/[\d?@]/.test(this.peek())&&(o=!0,this.pos+1<this.s.length)){const u=this.s[this.pos+1];o=/[^\dA-Za-z]/.test(u)}return o?"#"+this.get():"#"}}else if(r==="$")return this.peek()==="$"?(this.get(),"<$$>"):"<$>"}return r}};function wt(r,o){var u,d,g,b;const M=[];let N=r.next();if(N&&N!=="\\relax"){if(N==="\\noexpand")N=r.next(),N&&M.push(N);else if(N==="\\obeyspaces")r.obeyspaces=!0;else if(N==="\\bgroup")M.push("<{>");else if(N==="\\egroup")M.push("<}>");else if(N==="\\string"){if(N=r.next(),N)if(N.startsWith("\\"))for(const I of N)M.push(I==="\\"?"\\backslash":I);else N==="<{>"?M.push("\\{"):N==="<space>"?M.push("~"):N==="<}>"&&M.push("\\}")}else if(N==="\\csname"){for(;r.peek()==="<space>";)r.next();let I="",F=!1,$=[];do{if($.length===0)if(/^#[\d?@]$/.test(r.peek())){const it=r.get().slice(1);$=eh((d=(u=o==null?void 0:o(it))!=null?u:o==null?void 0:o("?"))!=null?d:"\\placeholder{}",o),N=$[0]}else N=r.next(),$=N?[N]:[];F=$.length===0,!F&&N==="\\endcsname"&&(F=!0,$.shift()),F||(F=N==="<$>"||N==="<$$>"||N==="<{>"||N==="<}>"||typeof N=="string"&&N.length>1&&N.startsWith("\\")),F||(I+=$.shift())}while(!F);I&&M.push("\\"+I),M.push(...$)}else if(N!=="\\endcsname")if(N.length>1&&N.startsWith("#")){const I=N.slice(1);M.push(...eh((b=(g=o==null?void 0:o(I))!=null?g:o==null?void 0:o("?"))!=null?b:"\\placeholder{}",o))}else M.push(N)}return M}function eh(r,o=null){const u=[];let d="";for(const M of r.toString().split(/\r?\n/)){d&&u.push(d),d=" ";const N=M.match(/((?:\\%)|[^%])*/);N!==null&&u.push(N[0])}const g=new vg(ye(u.join(""))),b=[];do b.push(...wt(g,o));while(!g.end());return b}function fr(r){let o="";const u=[];for(const d of r)d&&(o&&/^[a-zA-Z\*]/.test(d)&&u.push(o),u.push(d),/^\\[a-zA-Z]+\*?[\"\'][^\ ]+$/.test(d)&&u.push(" "),o=/\\[a-zA-Z]+\*?$/.test(d)?" ":"");return u.join("")}function Vo(r,...o){return console.assert(r.startsWith("\\")),o.length===0?r:fr([r,...o.map(u=>`{${u}}`)])}function Ah(r){return fr(r.map(o=>{var u;return(u={"<space>":" ","<$$>":"$$","<$>":"$","<{>":"{","<}>":"}"}[o])!=null?u:o}))}var X0=class Gy{constructor(o){Gy._registry[o]=this}static createAtom(o,u,d){return Gy._registry[o].createAtom(u,we(u,o),d)}static serialize(o,u){var d;if(!o||o.length===0)return"";if((d=u.skipStyles)!=null&&d){const g=[];for(const b of yg(o)){const M=Gy._registry[b[0].mode];g.push(...M.serialize(b,u))}return fr(g)}return fr(xg(o,u))}static getFont(o,u,d){return Gy._registry[o].getFont(u,d)}};X0._registry={};var cl=X0;function yg(r){const o=[];let u=[],d="NONE";for(const g of r)g.type!=="first"&&(g.mode!==d?(u.length>0&&o.push(u),u=[g],d=g.mode):u.push(g));return u.length>0&&o.push(u),o}function os(r,o){const u=[];let d=[],g;for(const b of r)if(b.type!=="first"&&b.style){let M;o==="variant"?(M=b.style.variant,b.style.variantStyle&&b.style.variantStyle!=="up"&&(M+="-"+b.style.variantStyle)):M=b.style[o],M===g?d.push(b):(d.length>0&&u.push(d),d=[b],g=M)}return d.length>0&&u.push(d),u}function Nd(r,o){var u;const{parent:d}=r[0],g=d==null?void 0:d.computedStyle.color,b=[];for(const M of yg(r)){const N=o.defaultMode;for(const I of os(M,"color")){const F=I[0].computedStyle,$=cl._registry[I[0].mode].serialize(I,rt(Q({},o),{defaultMode:N==="text"?"text":"math"}));!o.skipStyles&&F.color&&F.color!=="none"&&(!d||g!==F.color)?b.push(Vo("\\textcolor",(u=F.verbatimColor)!=null?u:F.color,fr($))):b.push(fr($))}}return b}function Y0(r,o){const{parent:u}=r[0],d=u==null?void 0:u.computedStyle.backgroundColor;return os(r,"backgroundColor").map(g=>{var b;if(g.length>0||g[0].type!=="box"){const M=g[0].computedStyle;if(M.backgroundColor&&M.backgroundColor!=="none"&&(!u||d!==M.backgroundColor))return Vo("\\colorbox",(b=M.verbatimBackgroundColor)!=null?b:M.backgroundColor,fr(Nd(g,rt(Q({},o),{defaultMode:"text"}))))}return fr(Nd(g,o))})}function xg(r,o){if(r.length===0)return[];const{parent:u}=r[0],d=u==null?void 0:u.computedStyle.fontSize,g=[];for(const b of os(r,"fontSize")){const M=b[0].computedStyle.fontSize,N=Y0(b,o);N&&(M&&M!=="auto"&&(!u||d!==M)?g.push(["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][M],...N):g.push(...N))}return g}function $p(r){return r?{mord:"ord",mbin:"bin",mop:"op",mrel:"rel",mopen:"open",mclose:"close",mpunct:"punct",minner:"inner",spacing:"ignore",latex:"latex",composition:"inner",error:"inner",placeholder:"ord",supsub:"ignore"}[r]:void 0}function Ad(r){if(r.length===0)return"ord";const o=$p(r[0].type),u=$p(r[r.length-1].type);return o&&o===u?o:"ord"}function Dd(r,o){if(typeof r=="string")return r;if(typeof r=="number"){console.assert(Number.isFinite(r));const u=Math.ceil(100*r)/100;return u===0?"0":u.toString()+(o!=null?o:"")}return""}var zi=class s2{constructor(o,u){var d,g,b,M,N;if(typeof o=="number"?this.value=String.fromCodePoint(o):typeof o=="string"?this.value=o:pt(o)?this.children=o.filter(F=>F!==null):o&&o instanceof s2&&(this.children=[o]),this.children)for(const F of this.children)F.parent=this;this.type=(d=u==null?void 0:u.type)!=null?d:"ignore",this.isSelected=(u==null?void 0:u.isSelected)===!0,u!=null&&u.caret&&(this.caret=u.caret),this.classes=(g=u==null?void 0:u.classes)!=null?g:"",this.isTight=(b=u==null?void 0:u.isTight)!=null?b:!1,u!=null&&u.attributes&&(this.attributes=u.attributes);let I=u==null?void 0:u.fontFamily;u!=null&&u.style&&this.value&&(I=(N=cl.getFont((M=u.mode)!=null?M:"math",this,rt(Q({variant:"normal"},u.style),{letterShapeStyle:u.letterShapeStyle})))!=null?N:void 0),I||(I="Main-Regular"),this._height=0,this._depth=0,this._width=0,this.hasExplicitWidth=!1,this.skew=0,this.italic=0,this.maxFontSize=0,this.scale=1,(u==null?void 0:u.maxFontSize)!==void 0&&(this.maxFontSize=u.maxFontSize),$f(this,I)}set atomID(o){o===void 0||o.length===0||(this.id=o)}selected(o){if(this.isSelected!==o&&(this.isSelected=o,this.children))for(const u of this.children)u.selected(o)}setStyle(o,u,d){if(u===void 0)return;const g=Dd(u,d);g.length>0&&(this.cssProperties||(this.cssProperties={}),this.cssProperties[o]=g)}setTop(o){Number.isFinite(o)&&Math.abs(o)>.01&&(this.cssProperties||(this.cssProperties={}),this.cssProperties.top=Dd(o,"em"),this.height-=o,this.depth+=o)}get left(){var o;return(o=this.cssProperties)!=null&&o["margin-left"]?Number.parseFloat(this.cssProperties["margin-left"]):0}set left(o){Number.isFinite(o)&&(o===0?this.cssProperties&&delete this.cssProperties["margin-left"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-left"]=Dd(o,"em")))}set right(o){Number.isFinite(o)&&(o===0?this.cssProperties&&delete this.cssProperties["margin-right"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-right"]=Dd(o,"em")))}set bottom(o){Number.isFinite(o)&&(o===0?this.cssProperties&&delete this.cssProperties["margin-bottom"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-bottom"]=Dd(o,"em")))}get width(){return this._width*this.scale}set width(o){this._width=o,this.hasExplicitWidth=!0}set softWidth(o){}get height(){return this._height*this.scale}set height(o){this._height=o}get depth(){return this._depth*this.scale}set depth(o){this._depth=o}wrap(o){const u=o.parent;if(!u)return this;o.isPhantom&&this.setStyle("opacity",0);const d=o.color;d&&d!==u.color&&this.setStyle("color",d);let g=o.backgroundColor;this.isSelected&&(g=Se(g)),g&&g!==u.backgroundColor&&(this.setStyle("background-color",g),this.setStyle("display","inline-block"));const b=o.scalingFactor;return this.scale=b,this.skew*=b,this.italic*=b,this}toMarkup(){var o,u,d,g;let b=(o=this.value)!=null?o:"";if(this.children)for(const _t of this.children)b+=_t.toMarkup();let M="";if(this.svgBody)M=Uc(this.svgBody);else if(this.svgOverlay){M='<span style="',M+="display: inline-block;",M+=`height:${Math.floor(100*(this.height+this.depth))/100}em;`,M+=`vertical-align:${Math.floor(100*this.depth)/100}em;`,M+='">',M+=b,M+="</span>",M+='<svg style="position:absolute;overflow:visible;',M+=`height:${Math.floor(100*(this.height+this.depth))/100}em;`;const _t=(u=this.cssProperties)==null?void 0:u.padding;_t?(M+=`top:${_t};`,M+=`left:${_t};`,M+=`width:calc(100% - 2 * ${_t} );`):M+="top:0;left:0;width:100%;",M+="z-index:2;",M+='"',this.svgStyle&&(M+=this.svgStyle),M+=` viewBox="0 0 ${Math.floor(100*this.width)/100} ${Math.floor(100*(this.height+this.depth))/100}"`,M+=`>${this.svgOverlay}</svg>`}let N="";const I=this.classes.split(" ");I.push((d={latex:"ML__raw-latex",placeholder:"ML__placeholder",error:"ML__error"}[this.type])!=null?d:""),this.caret==="latex"&&I.push("ML__latex-caret"),this.isSelected&&I.push("ML__selected");const F=I.length===1?I[0]:I.filter((_t,zt,Ne)=>_t.length>0&&Ne.indexOf(_t)===zt).join(" ");if(F.length>0&&(N+=` class="${F}"`),this.id&&(N+=` data-atom-id=${this.id}`),this.cssId&&(N+=` id="${this.cssId.replace(/ /g,"-")}" `),this.attributes&&(N+=" "+Object.keys(this.attributes).map(_t=>`${_t}="${this.attributes[_t]}"`).join(" ")),this.htmlData){const _t=this.htmlData.split(",");for(const zt of _t){const Ne=zt.match(/([^=]+)=(.+$)/);if(Ne){const Bi=Ne[1].trim().replace(/ /g,"-");Bi&&(N+=` data-${Bi}="${Ne[2]}" `)}else{const Bi=zt.trim().replace(/ /g,"-");Bi&&(N+=` data-${Bi} `)}}}const $=(g=this.cssProperties)!=null?g:{};this.hasExplicitWidth&&$.width===void 0&&($.width=`${Math.ceil(this._width*100)/100}em`);const it=Object.keys($).map(_t=>`${_t}:${$[_t]}`);if(this.scale!==void 0&&this.scale!==1&&(b.length>0||M.length>0)&&it.push(`font-size: ${Math.ceil(this.scale*1e4)/100}%`),this.htmlStyle){const _t=this.htmlStyle.split(";");let zt="";for(const Ne of _t){const Bi=Ne.match(/([^=]+):(.+$)/);if(Bi){const Ee=Bi[1].trim().replace(/ /g,"-");Ee&&(zt+=`${Ee}:${Bi[2]};`)}}zt&&(N+=` style="${zt}"`)}it.length>0&&(N+=` style="${it.join(";")}"`);let gt="";return N.length>0||M.length>0?gt=`<span${N}>${b}${M}</span>`:gt=b,this.caret==="text"?gt+='<span class="ML__text-caret"></span>':this.caret==="math"&&(gt+='<span class="ML__caret"></span>'),gt}tryCoalesceWith(o){if(this.svgBody||!this.value||o.svgBody||!o.value)return!1;const u=this.children&&this.children.length>0,d=o.children&&o.children.length>0;if(u||d)return!1;if(o.cssProperties||this.cssProperties){for(const I of["border","border-left","border-right","border-right-width","left","margin","margin-left","margin-right","padding","position","width"])if(o.cssProperties&&I in o.cssProperties||this.cssProperties&&I in this.cssProperties)return!1}const g=this.cssProperties?Object.keys(this.cssProperties).length:0,b=o.cssProperties?Object.keys(o.cssProperties).length:0;if(g!==b)return!1;if(g>0){for(const I of Object.keys(this.cssProperties))if(this.cssProperties[I]!==o.cssProperties[I])return!1}const M=this.classes.trim().replace(/\s+/g," ").split(" "),N=o.classes.trim().replace(/\s+/g," ").split(" ");if(M.length!==N.length)return!1;M.sort(),N.sort();for(const[I,F]of M.entries())if(F==="vertical-separator"||F!==N[I])return!1;return this.value+=o.value,this.height=Math.max(this.height,o.height),this.depth=Math.max(this.depth,o.depth),this._width=this._width+o._width,this.maxFontSize=Math.max(this.maxFontSize,o.maxFontSize),this.italic=o.italic,!0}};function Ga(r){if(!r||r.length===0)return[];r[0].children=Ga(r[0].children);const o=[r[0]];for(let u=1;u<r.length;u++)o[o.length-1].tryCoalesceWith(r[u])||(r[u].children=Ga(r[u].children),o.push(r[u]));return o}function Dh(r){return r.children&&(r.children=Ga(r.children)),r}function Id(r,o){if(!r)return new zi(null,o);const u=new zi(null,{classes:"ML__strut",type:"ignore"});u.setStyle("height",Math.max(0,r.height),"em");const d=[u];if(r.depth!==0){const g=new zi(null,{classes:"ML__strut--bottom",type:"ignore"});g.setStyle("height",r.height+r.depth,"em"),g.setStyle("vertical-align",-r.depth,"em"),d.push(g)}return d.push(r),new zi(d,rt(Q({},o),{type:"lift"}))}function jl(r){const o=zl(r)/2,u=new zi(null,{maxFontSize:0});return u.height=o+.166,u.depth=o-.166,u.svgBody=r,u}function $f(r,o){var u;if(r.type==="latex"){r.height=.9,r.depth=.2,r._width=1;return}if(r.value){r.height=-1/0,r.depth=-1/0,r._width=0,r.skew=-1/0,r.italic=-1/0;for(let d=0;d<r.value.length;d++){const g=Qu(r.value.codePointAt(d),o);r.height=Math.max(r.height,g.height),r.depth=Math.max(r.depth,g.depth),r._width+=g.width,r.skew=g.skew,r.italic=g.italic}return}if(r.children&&r.children.length>0){let d=-1/0,g=-1/0,b=0;for(const M of r.children)M.height>d&&(d=M.height),M.depth>g&&(g=M.depth),b=Math.max(b,(u=M.maxFontSize)!=null?u:0);r.height=d,r.depth=g,r._width=r.children.reduce((M,N)=>M+N.width,0),r.maxFontSize=b}}function Kp(r){if("individualShift"in r){const o=r.individualShift;let u=o[0];const d=[u],g=-u.shift-u.box.depth;let b=g;for(let M=1;M<o.length;M++){const N=o[M],I=-N.shift-b-N.box.depth,F=I-(u.box.height+u.box.depth);b=b+I,d.push(F),d.push(N),u=N}return[d,g]}if("top"in r){let o=r.top;for(const u of r.children)o-=typeof u=="number"?u:u.box.height+u.box.depth;return[r.children,o]}else{if("bottom"in r)return[r.children,-r.bottom];if("firstBaseline"in r){const o=r.firstBaseline[0];if(typeof o=="number")throw new Error("First child must be an element.");return[r.firstBaseline,-o.box.depth]}else if("shift"in r){const o=r.children[0];if(typeof o=="number")throw new Error("First child must be an element.");return[r.children,-o.box.depth-r.shift]}}return[null,0]}function Kf(r){var o;const[u,d]=Kp(r);if(!u)return[[],0,0];const g=new zi(null,{classes:"pstrut"});let b=0;for(const zt of u)if(typeof zt!="number"){const Ne=zt.box;b=Math.max(b,Ne.maxFontSize,Ne.height)}b+=2,g.height=b,g.setStyle("height",b,"em");const M=[];let N=d,I=d,F=d,$=0;for(const zt of u){if(typeof zt=="number")F+=zt;else{const Ne=zt.box,Bi=(o=zt.classes)!=null?o:[],Ee=new zi([g,Ne],{classes:Bi.join(" "),style:zt.style});Ne.setStyle("height",Ne.height+Ne.depth,"em"),Ne.setStyle("display","inline-block"),Ee.setStyle("top",-b-F-Ne.depth,"em"),zt.marginLeft&&Ee.setStyle("margin-left",zt.marginLeft,"em"),zt.marginRight&&Ee.setStyle("margin-right",zt.marginRight,"em"),M.push(Ee),F+=Ne.height+Ne.depth,$=Math.max($,Ee.width)}N=Math.min(N,F),I=Math.max(I,F)}M.forEach(zt=>{zt.softWidth=$});const it=new zi(M,{classes:"vlist"});if(it.softWidth=$,it.height=I,it.setStyle("height",I,"em"),N>=0)return[[new zi(it,{classes:"vlist-r"})],I,-N];const gt=new zi(new zi(null),{classes:"vlist"});gt.height=-N,gt.setStyle("height",-N,"em");const _t=new zi(8203,{classes:"vlist-s",maxFontSize:0});return _t.softWidth=0,_t.height=0,_t.depth=0,[[new zi([it,_t],{classes:"vlist-r"}),new zi(gt,{classes:"vlist-r"})],I,-N]}var to=class extends zi{constructor(r,o){var u;const[d,g,b]=Kf(r);super(d.length===1?d[0]:d,{type:o==null?void 0:o.type,classes:((u=o==null?void 0:o.classes)!=null?u:"")+" vlist-t"+(d.length===2?" vlist-t2":"")}),this.height=g,this.depth=b,this.softWidth=d.reduce((M,N)=>Math.max(M,N.width),0)}};function J0(r,o){var u,d,g,b,M;const N=r.metrics,I=new zi(o.base),F=(u=o.baseShift)!=null?u:0,$=(d=o.slant)!=null?d:0;let it=0,gt=0;o.above&&(it=(g=o.aboveShift)!=null?g:Math.max(N.bigOpSpacing1,N.bigOpSpacing3-o.above.depth)),o.below&&(gt=(b=o.belowShift)!=null?b:Math.max(N.bigOpSpacing2,N.bigOpSpacing4-o.below.height));let _t=null;if(o.below&&o.above){const zt=N.bigOpSpacing5+o.below.height+o.below.depth+gt+I.depth+F;_t=new to({bottom:zt,children:[N.bigOpSpacing5,{box:o.below,marginLeft:-$,classes:["ML__center"]},gt,{box:I,classes:["ML__center"]},it,{box:o.above,marginLeft:$,classes:["ML__center"]},N.bigOpSpacing5]}).wrap(r)}else if(o.below&&!o.above)_t=new to({top:I.height-F,children:[N.bigOpSpacing5,{box:o.below,marginLeft:-$,classes:["ML__center"]},gt,{box:I,classes:["ML__center"]}]}).wrap(r);else if(!o.below&&o.above){const zt=I.depth+F;_t=new to({bottom:zt,children:[{box:I,classes:["ML__center"]},it,{box:o.above,marginLeft:$,classes:["ML__center"]},N.bigOpSpacing5]}).wrap(r)}else{const zt=I.depth+F;_t=new to({bottom:zt,children:[{box:I},N.bigOpSpacing5]}).wrap(r)}return new zi(_t,{type:(M=o.type)!=null?M:"op"})}var Hf=7,Xa=6,Ih=5,Oh=4,Gc=3,ua=2,Vs=1,Ma=0,bo=class{constructor(r,o,u){this.id=r,this.sizeDelta=o,this.cramped=u;const d={"-4":2,"-3":1,0:0}[o];this.metrics=Object.keys(ms).reduce((g,b)=>rt(Q({},g),{[b]:ms[b][d]}),{})}getFontSize(r){return Math.max(1,r+this.sizeDelta)}get sup(){return $l[[Ma,Vs,Ma,Vs,ua,Gc,ua,Gc][this.id]]}get sub(){return $l[[Ma,Ma,Ma,Ma,ua,ua,ua,ua][this.id]]}get fracNum(){return $l[[Ma,Vs,Ma,Vs,ua,Gc,Oh,Ih][this.id]]}get fracDen(){return $l[[Ma,Ma,Ma,Ma,ua,ua,Oh,Oh][this.id]]}get cramp(){return $l[[Ma,Ma,ua,ua,Oh,Oh,Xa,Xa][this.id]]}get isTight(){return this.sizeDelta<0}},Bh={7:new bo(Hf,0,!1),6:new bo(Xa,0,!0),5:new bo(Ih,0,!1),4:new bo(Oh,0,!0),3:new bo(Gc,-3,!1),2:new bo(ua,-3,!0),1:new bo(Vs,-4,!1),0:new bo(Ma,-4,!0)},$l=rt(Q({},Bh),{displaystyle:Bh[Hf],textstyle:Bh[Ih],scriptstyle:Bh[Gc],scriptscriptstyle:Bh[Vs]});function Fh(r,o){var u;if(!r)return 0;const d={pt:1,mm:7227/2540,cm:7227/254,ex:35271/8192,px:3/4,em:Yu,bp:803/800,dd:1238/1157,pc:12,in:72.27,mu:10/18}[(u=r.unit)!=null?u:"pt"];if(Number.isFinite(o)){const g=Ef(10,o);return Math.round(r.dimension/Yu*d*g)/g}return r.dimension*d}function Xc(r,o){if(r===null)return 0;const u=Fh(r)/Yu;if(Number.isFinite(o)){const d=Ef(10,o);return Math.round(u*d)/d}return u}function gc(r){var o;return`${r.dimension}${(o=r.unit)!=null?o:"pt"}`}function q0(r){let o=gc(r.glue);return r.grow&&r.grow.dimension!==0&&(o+=` plus ${gc(r.grow)}`),r.shrink&&r.shrink.dimension!==0&&(o+=` minus ${gc(r.shrink)}`),o}function Ls(r){var o,u;if(r==null)return null;let d="";if("dimension"in r&&(d=`${r.dimension}${(o=r.unit)!=null?o:"pt"}`),"glue"in r&&(d=q0(r)),"number"in r)if(!("base"in r)||r.base==="decimal")d=Number(r.number).toString();else if(r.base==="alpha")d=`\`${String.fromCodePoint(r.number)}`;else{const g=Math.round(r.number)>>>0;r.base==="hexadecimal"?(d=Number(g).toString(16).toUpperCase(),g<=255?d=d.padStart(2,"0"):g<=65535?d=d.padStart(4,"0"):g<=16777215?d=d.padStart(6,"0"):d=d.padStart(8,"0"),d=`"${d}`):r.base==="octal"&&(d=Number(g).toString(8),g<=63?d=d.padStart(2,"0"):g<=30583?d=d.padStart(4,"0"):d=d.padStart(8,"0"),d=`'${d}`)}return"register"in r&&("factor"in r&&(r.factor===-1?d="-":r.factor!==1&&(d=Number(r.factor).toString())),"global"in r&&r.global&&(d+="\\global"),d+=`\\${r.register}`),"string"in r&&(d=r.string),(u=r.relax)!=null&&u&&(d+="\\relax"),d}function ou(r,o){return r==null?null:"number"in r?rt(Q({},r),{number:r.number*o}):"register"in r?"factor"in r&&r.factor?rt(Q({},r),{factor:r.factor*o}):rt(Q({},r),{factor:o}):"dimension"in r?rt(Q({},r),{dimension:r.dimension*o}):"glue"in r?r.shrink&&r.grow?{glue:ou(r.glue,o),shrink:ou(r.shrink,o),grow:ou(r.grow,o)}:r.shrink?{glue:ou(r.glue,o),shrink:ou(r.shrink,o)}:r.grow?{glue:ou(r.glue,o),grow:ou(r.grow,o)}:{glue:ou(r.glue,o)}:null}var ih={"p@":{dimension:1},"z@":{dimension:0},maxdimen:{dimension:16383.99999},hfuzz:{dimension:.1},vfuzz:{dimension:.1},overfullrule:{dimension:5},hsize:{dimension:6.5,unit:"in"},vsize:{dimension:8.9,unit:"in"},parindent:{dimension:20},maxdepth:{dimension:4},splitmaxdepth:{register:"maxdimen"},boxmaxdepth:{register:"maxdimen"},delimitershortfall:{dimension:5},nulldelimiterspace:{dimension:1.2,unit:"pt"},scriptspace:{dimension:.5},topskip:{dimension:10},splittopskip:{dimension:10},normalbaselineskip:{dimension:12},normallineskip:{dimension:1},normallineskiplimit:{dimension:0},jot:{dimension:3},doublerulesep:{dimension:2},arrayrulewidth:{dimension:.4},arraycolsep:{dimension:5},fboxsep:{dimension:3},fboxrule:{dimension:.4},"z@skip":{glue:{dimension:0},shrink:{dimension:0},grow:{dimension:0}},hideskip:{glue:{dimension:-1e3},grow:{dimension:1,unit:"fill"}},"@flushglue":{glue:{dimension:0},grow:{dimension:1,unit:"fill"}},parskip:{glue:{dimension:0},grow:{dimension:1}},abovedisplayskip:{glue:{dimension:12},grow:{dimension:3},shrink:{dimension:9}},abovedisplayshortskip:{glue:{dimension:0},grow:{dimension:3}},belowdisplayskip:{glue:{dimension:12},grow:{dimension:3},shrink:{dimension:9}},belowdisplayshortskip:{glue:{dimension:7},grow:{dimension:3},shrink:{dimension:4}},parfillskip:{glue:{dimension:0},grow:{dimension:1,unit:"fil"}},thinmuskip:{glue:{dimension:3,unit:"mu"}},medmuskip:{glue:{dimension:4,unit:"mu"},grow:{dimension:2,unit:"mu"},shrink:{dimension:4,unit:"mu"}},thickmuskip:{glue:{dimension:5,unit:"mu"},grow:{dimension:5,unit:"mu"}},smallskipamount:{glue:{dimension:3},grow:{dimension:1},shrink:{dimension:1}},medskipamount:{glue:{dimension:6},grow:{dimension:2},shrink:{dimension:3}},bigskipamount:{glue:{dimension:12},grow:{dimension:2},shrink:{dimension:4}},pretolerance:100,tolerance:200,hbadness:1e3,vbadness:1e3,linepenalty:10,hyphenpenalty:50,exhyphenpenalty:50,binoppenalty:700,relpenalty:500,clubpenalty:150,widowpenalty:150,displaywidowpenalty:50,brokenpenalty:100,predisplaypenalty:1e4,doublehyphendemerits:1e4,finalhyphendemerits:5e3,adjdemerits:1e4,tracinglostchars:1,uchyph:1,delimiterfactor:901,defaulthyphenchar:"\\-",defaultskewchar:-1,newlinechar:-1,showboxbreadth:5,showboxdepth:3,errorcontextlines:5,interdisplaylinepenalty:100,interfootnotelinepenalty:100,baselineSkip:1.2,arraystretch:1,month:new Date().getMonth()+1,day:new Date().getDate(),year:new Date().getFullYear()};function vc(){return Q({},ih)}function Od(){return{registers:vc(),smartFence:!1,renderPlaceholder:void 0,placeholderSymbol:"\u25A2",letterShapeStyle:$t.locale.startsWith("fr")?"french":"tex",minFontScale:0,colorMap:We,backgroundColorMap:ee,getMacro:r=>Ii(r,ln())}}var Dr=class a2{constructor(o,u){var d,g,b,M,N,I,F,$,it,gt,_t,zt,Ne,Bi,Ee;let hi;o!=null&&o.parent?(this.parent=o.parent,hi=o.parent,this.registers={}):(hi=Q(Q({},Od()),(d=o==null?void 0:o.from)!=null?d:{}),this.registers=hi.registers),hi.atomIdsSettings&&(this.atomIdsSettings=Q({},hi.atomIdsSettings)),this.renderPlaceholder=hi.renderPlaceholder,this.isPhantom=(M=(b=o==null?void 0:o.isPhantom)!=null?b:(g=this.parent)==null?void 0:g.isPhantom)!=null?M:!1,this.letterShapeStyle=hi.letterShapeStyle,this.minFontScale=hi.minFontScale,u!=null&&u.color&&u.color!=="none"?this.color=u.color:this.color=(I=(N=this.parent)==null?void 0:N.color)!=null?I:"",u!=null&&u.backgroundColor&&u.backgroundColor!=="none"?this.backgroundColor=u.backgroundColor:this.backgroundColor=($=(F=this.parent)==null?void 0:F.backgroundColor)!=null?$:"",u!=null&&u.fontSize&&u.fontSize!=="auto"&&u.fontSize!==((it=this.parent)==null?void 0:it.size)?this.size=u.fontSize:this.size=(_t=(gt=this.parent)==null?void 0:gt.size)!=null?_t:qu;let $i=(Ne=(zt=this.parent)==null?void 0:zt.mathstyle)!=null?Ne:$l.displaystyle;if(typeof(o==null?void 0:o.mathstyle)=="string"){if(hi instanceof a2)switch(o.mathstyle){case"cramp":$i=$i.cramp;break;case"superscript":$i=$i.sup;break;case"subscript":$i=$i.sub;break;case"numerator":$i=$i.fracNum;break;case"denominator":$i=$i.fracDen;break}switch(o.mathstyle){case"textstyle":$i=$l.textstyle;break;case"displaystyle":$i=$l.displaystyle;break;case"scriptstyle":$i=$l.scriptstyle;break;case"scriptscriptstyle":$i=$l.scriptscriptstyle;break;case"":case"auto":break}}this.mathstyle=$i,this.smartFence=hi.smartFence,this.placeholderSymbol=hi.placeholderSymbol,this.colorMap=(Bi=hi.colorMap)!=null?Bi:xi=>xi,this.backgroundColorMap=(Ee=hi.backgroundColorMap)!=null?Ee:xi=>xi,this.getMacro=hi.getMacro,console.assert(this.parent!==void 0||this.registers!==void 0)}makeID(){if(!this.atomIdsSettings)return;if(this.atomIdsSettings.overrideID)return this.atomIdsSettings.overrideID;if(typeof this.atomIdsSettings.seed!="number")return`${Date.now().toString(36).slice(-2)}${Math.floor(Math.random()*1e5).toString(36)}`;const o=this.atomIdsSettings.seed.toString(36);return this.atomIdsSettings.seed+=1,o}scale(o){return o*this.effectiveFontSize}get scalingFactor(){return this.parent?this.effectiveFontSize/this.parent.effectiveFontSize:1}get isDisplayStyle(){return this.mathstyle.id===Hf||this.mathstyle.id===Xa}get isCramped(){return this.mathstyle.cramped}get isTight(){return this.mathstyle.isTight}get metrics(){return this.mathstyle.metrics}get effectiveFontSize(){return Math.max(Wc[Math.max(1,this.size+this.mathstyle.sizeDelta)],this.minFontScale)}getRegister(o){var u;if((u=this.registers)!=null&&u[o])return this.registers[o];if(this.parent)return this.parent.getRegister(o)}getRegisterAsNumber(o){const u=this.getRegister(o);if(typeof u=="number")return u;if(typeof u=="string")return Number(u)}getRegisterAsGlue(o){var u;if((u=this.registers)!=null&&u[o]){const d=this.registers[o];return typeof d=="object"&&"glue"in d?d:typeof d=="object"&&"dimension"in d?{glue:{dimension:d.dimension}}:typeof d=="number"?{glue:{dimension:d}}:void 0}if(this.parent)return this.parent.getRegisterAsGlue(o)}getRegisterAsEm(o,u){return Xc(this.getRegisterAsDimension(o),u)}getRegisterAsDimension(o){var u;if((u=this.registers)!=null&&u[o]){const d=this.registers[o];return typeof d=="object"&&"glue"in d?d.glue:typeof d=="object"&&"dimension"in d?d:typeof d=="number"?{dimension:d}:void 0}if(this.parent)return this.parent.getRegisterAsDimension(o)}setRegister(o,u){if(u===void 0){delete this.registers[o];return}this.registers[o]=u}evaluate(o){if(!o||!("register"in o))return o;let u=this;if("global"in o&&o.global)for(;u.parent;)u=u.parent;let d=1;"factor"in o&&o.factor!==1&&o.factor!==void 0&&(d=o.factor);const g=u.getRegister(o.register);if(g===void 0)return;if(typeof g=="string")return{string:Number(g).toString()+g};if(typeof g=="number")return{number:d*g};const b=u.evaluate(g);if(b!==void 0)return"string"in b?{string:Number(g).toString()+b.string}:"number"in b?{number:d*b.number}:"dimension"in b?rt(Q({},b),{dimension:d*b.dimension}):"glue"in b?rt(Q({},b),{glue:rt(Q({},b.glue),{dimension:d*b.glue.dimension}),shrink:b.shrink?rt(Q({},b.shrink),{dimension:d*b.shrink.dimension}):void 0,grow:b.grow?rt(Q({},b.grow),{dimension:d*b.grow.dimension}):void 0}):o}toDimension(o){const u=this.evaluate(o);return u===void 0?null:"dimension"in u?u:"glue"in u?u.glue:"number"in u?{dimension:u.number}:null}toEm(o,u){if(o===null)return 0;const d=this.toDimension(o);return d===null?0:Fh(d,u)/Yu}toNumber(o){if(o===null)return null;const u=this.evaluate(o);return u===void 0?null:"number"in u?u.number:"dimension"in u?u.dimension:"glue"in u?u.glue.dimension:"string"in u?Number(u.string):null}toColor(o){var u,d;if(o===null)return null;const g=this.evaluate(o);return g===void 0?null:"string"in g?(d=(u=this.colorMap)==null?void 0:u.call(this,g.string))!=null?d:g.string:null}toBackgroundColor(o){var u,d;if(o===null)return null;const g=this.evaluate(o);return g===void 0?null:"string"in g?(d=(u=this.backgroundColorMap)==null?void 0:u.call(this,g.string))!=null?d:g.string:null}},Rh=["body","above","below","superscript","subscript"];function Kl(r){return typeof r=="string"&&Rh.includes(r)}function Bd(r){return r!==void 0&&Array.isArray(r)&&r.length===2}var oi=class Ap{constructor(o){var u,d,g,b,M,N;this.type=o.type,typeof o.value=="string"&&(this.value=o.value),this.command=(d=(u=o.command)!=null?u:this.value)!=null?d:"",this.mode=(g=o.mode)!=null?g:"math",o.isFunction&&(this.isFunction=!0),o.limits&&(this.subsupPlacement=o.limits),this.style=Q({},o.style),this.displayContainsHighlight=(b=o.displayContainsHighlight)!=null?b:!1,this.captureSelection=(M=o.captureSelection)!=null?M:!1,this.skipBoundary=(N=o.skipBoundary)!=null?N:!1,o.verbatimLatex!==void 0&&o.verbatimLatex!==null&&(this.verbatimLatex=o.verbatimLatex),o.args&&(this.args=o.args),o.body&&(this.body=o.body),this._changeCounter=0}static createBox(o,u,d){var g;if(!u)return null;const b=Q0(u),M=[];for(const I of b){const F=I[0].style,$=Cu(o,I,{style:{color:F.color,backgroundColor:F.backgroundColor,fontSize:F.fontSize}});$&&M.push($)}if(M.length===0)return null;const N=((g=d==null?void 0:d.classes)!=null?g:"").trim();return M.length===1&&!N&&!(d!=null&&d.type)?M[0].wrap(o):new zi(M,{classes:N,type:d==null?void 0:d.type}).wrap(o)}static serialize(o,u){return cl.serialize(o,u)}static commonAncestor(o,u){if(o===u||o.parent===u.parent)return o.parent;const d=new WeakSet;let{parent:g}=o;for(;g;)d.add(g),g=g.parent;for(g=u.parent;g;){if(d.has(g))return g;g=g.parent}console.assert(!!g)}static fromJson(o){return typeof o=="string"?new Ap({type:"mord",value:o,mode:"math"}):new Ap(o)}get latexMode(){return this.mode==="math"?"math":"text"}toJson(){const o={};if(this.type&&(o.type=this.type),this.mode!=="math"&&(o.mode=this.mode),this.command&&this.command!==this.value&&(o.command=this.command),this.value!==void 0&&(o.value=this.value),this.style&&Object.keys(this.style).length>0&&(o.style=Q({},this.style)),this.verbatimLatex!==void 0&&(o.verbatimLatex=this.verbatimLatex),this.subsupPlacement&&(o.subsupPlacement=this.subsupPlacement),this.explicitSubsupPlacement&&(o.explicitSubsupPlacement=!0),this.isFunction&&(o.isFunction=!0),this.displayContainsHighlight&&(o.displayContainsHighlight=!0),this.isExtensibleSymbol&&(o.isExtensibleSymbol=!0),this.skipBoundary&&(o.skipBoundary=!0),this.captureSelection&&(o.captureSelection=!0),this.args&&(o.args=tm(this.args)),this._branches)for(const u of Object.keys(this._branches))this._branches[u]&&(o[u]=this._branches[u].filter(d=>d.type!=="first").map(d=>d.toJson()));return o.type==="mord"&&Object.keys(o).length===2&&"value"in o?o.value:o}get changeCounter(){return this.parent?this.parent.changeCounter:this._changeCounter}set isDirty(o){if(o){this.parent||this._changeCounter++,"verbatimLatex"in this&&(this.verbatimLatex=void 0),this._children=void 0;let{parent:u}=this;for(;u;)u.parent||u._changeCounter++,"verbatimLatex"in u&&(u.verbatimLatex=void 0),u._children=void 0,u=u.parent}}_serialize(o){if(!(o.expandMacro||o.skipStyles||o.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const u=we(this.command,this.mode);return u!=null&&u.serialize?u.serialize(this,o):this.body&&this.command?fr([Vo(this.command,this.bodyToLatex(o)),this.supsubToLatex(o)]):this.body?fr([this.bodyToLatex(o),this.supsubToLatex(o)]):!this.value||this.value==="\u200B"?"":this.command}bodyToLatex(o){var u;return cl.serialize(this.body,rt(Q({},o),{defaultMode:(u=o.defaultMode)!=null?u:this.latexMode}))}aboveToLatex(o){return cl.serialize(this.above,o)}belowToLatex(o){return cl.serialize(this.below,o)}supsubToLatex(o){let u="";if(o=rt(Q({},o),{defaultMode:"math"}),this.branch("subscript")!==void 0){const d=cl.serialize(this.subscript,o);d.length===0?u+="_{}":d.length===1?/^[0-9]$/.test(d)?u+=`_${d}`:u+=`_{${d}}`:u+=`_{${d}}`}if(this.branch("superscript")!==void 0){const d=cl.serialize(this.superscript,o);d.length===0?u+="^{}":d.length===1?d==="\u2032"?u+="^\\prime ":d==="\u2033"?u+="^\\doubleprime ":/^[0-9]$/.test(d)?u+=`^${d}`:u+=`^{${d}}`:u+=`^{${d}}`}return u}get treeDepth(){let o=1,u=this.parent;for(;u;)u=u.parent,o+=1;return o}get inCaptureSelection(){let o=this;for(;o;){if(o.captureSelection)return!0;o=o.parent}return!1}get parentPrompt(){let o=this.parent;for(;o;){if(o.type==="prompt"&&!o.captureSelection)return o;o=o.parent}return null}branch(o){if(Kl(o)&&this._branches)return this._branches[o]}get branches(){if(!this._branches)return[];const o=[];for(const u of Rh)this._branches[u]&&o.push(u);return o}createBranch(o){return console.assert(Kl(o)),Kl(o)?(this._branches?this._branches[o]||(this._branches[o]=[this.makeFirstAtom(o)]):this._branches={[o]:[this.makeFirstAtom(o)]},this.isDirty=!0,this._branches[o]):[]}get row(){return Bd(this.parentBranch)?this.parentBranch[0]:-1}get col(){return Bd(this.parentBranch)?this.parentBranch[1]:-1}get body(){var o;return(o=this._branches)==null?void 0:o.body}set body(o){this.setChildren(o,"body")}get superscript(){var o;return(o=this._branches)==null?void 0:o.superscript}set superscript(o){this.setChildren(o,"superscript")}get subscript(){var o;return(o=this._branches)==null?void 0:o.subscript}set subscript(o){this.setChildren(o,"subscript")}get above(){var o;return(o=this._branches)==null?void 0:o.above}set above(o){this.setChildren(o,"above")}get below(){var o;return(o=this._branches)==null?void 0:o.below}set below(o){this.setChildren(o,"below")}get computedStyle(){var o,u;const d=typeof this.style.verbatimColor=="string",g=typeof this.style.verbatimBackgroundColor=="string",b=Q(Q({},(u=(o=this.parent)==null?void 0:o.computedStyle)!=null?u:{}),this.style);return delete b.variant,delete b.variantStyle,g||delete b.verbatimBackgroundColor,d||delete b.verbatimColor,b}applyStyle(o){this.isDirty=!0,this.style=Q(Q({},this.style),o),this.style.fontFamily==="none"&&delete this.style.fontFamily,this.style.fontShape==="auto"&&delete this.style.fontShape,this.style.fontSeries==="auto"&&delete this.style.fontSeries,this.style.color==="none"&&(delete this.style.color,delete this.style.verbatimColor),this.style.backgroundColor==="none"&&(delete this.style.backgroundColor,delete this.style.verbatimBackgroundColor),this.style.fontSize==="auto"&&delete this.style.fontSize;for(const u of this.children)u.applyStyle(o)}getInitialBaseElement(){var o,u,d;return this.hasEmptyBranch("body")?this:(console.assert(((o=this.body)==null?void 0:o[0].type)==="first"),(d=(u=this.body[1])==null?void 0:u.getInitialBaseElement())!=null?d:this)}getFinalBaseElement(){return this.hasEmptyBranch("body")?this:this.body[this.body.length-1].getFinalBaseElement()}isCharacterBox(){return this.type==="leftright"||this.type==="genfrac"||this.type==="subsup"||this.type==="delim"||this.type==="array"||this.type==="surd"?!1:this.getFinalBaseElement().type==="mord"}hasEmptyBranch(o){const u=this.branch(o);return u?(console.assert(u.length>0),console.assert(u[0].type==="first"),u.length===1):!0}setChildren(o,u){var d;if(!o||(console.assert(Kl(u)),!Kl(u)))return;console.assert(((d=o[0])==null?void 0:d.type)!=="first");const g=[this.makeFirstAtom(u),...o];this._branches?this._branches[u]=g:this._branches={[u]:g};for(const b of o)b.parent=this,b.parentBranch=u;this.isDirty=!0}makeFirstAtom(o){const u=new Ap({type:"first",mode:this.mode});return u.parent=this,u.parentBranch=o,u}addChild(o,u){console.assert(o.type!=="first"),this.createBranch(u).push(o),this.isDirty=!0,o.parent=this,o.parentBranch=u}addChildBefore(o,u){console.assert(u.parentBranch!==void 0);const d=this.createBranch(u.parentBranch);d.splice(d.indexOf(u),0,o),this.isDirty=!0,o.parent=this,o.parentBranch=u.parentBranch}addChildAfter(o,u){console.assert(u.parentBranch!==void 0);const d=this.createBranch(u.parentBranch);d.splice(d.indexOf(u)+1,0,o),this.isDirty=!0,o.parent=this,o.parentBranch=u.parentBranch}addChildren(o,u){const d=this.createBranch(u);for(const g of o)g.parent=this,g.parentBranch=u,d.push(g);this.isDirty=!0}addChildrenAfter(o,u){console.assert(o.length===0||o[0].type!=="first"),console.assert(u.parentBranch!==void 0);const d=this.createBranch(u.parentBranch);d.splice(d.indexOf(u)+1,0,...o),this.isDirty=!0;for(const g of o)g.parent=this,g.parentBranch=u.parentBranch;return o[o.length-1]}removeBranch(o){const u=this.branch(o);if(Kl(o)&&(this._branches[o]=void 0),!u)return[];for(const d of u)d.parent=void 0,d.parentBranch=void 0;return console.assert(u[0].type==="first"),u.shift(),this.isDirty=!0,u}removeChild(o){if(console.assert(o.parent===this),o.type==="first")return;const u=this.branch(o.parentBranch),d=u.indexOf(o);console.assert(d>=0),u.splice(d,1),this.isDirty=!0,o.parent=void 0,o.parentBranch=void 0}get siblings(){return this.parent?this.parent.branch(this.parentBranch):[]}get firstSibling(){return this.siblings[0]}get lastSibling(){const{siblings:o}=this;return o[o.length-1]}get isFirstSibling(){return this===this.firstSibling}get isLastSibling(){return this===this.lastSibling}get hasNoSiblings(){return this.siblings.length===1}get leftSibling(){console.assert(this.parent!==void 0);const o=this.parent.branch(this.parentBranch);return o[o.indexOf(this)-1]}get rightSibling(){console.assert(this.parent!==void 0);const o=this.parent.branch(this.parentBranch);return o[o.indexOf(this)+1]}get hasChildren(){return!!(this._branches&&this.children.length>0)}get firstChild(){return console.assert(this.hasChildren),this.children[0]}get lastChild(){console.assert(this.hasChildren);const{children:o}=this;return o[o.length-1]}get children(){if(this._children)return this._children;if(!this._branches)return[];const o=[];for(const u of Rh)if(this._branches[u])for(const d of this._branches[u])o.push(...d.children),o.push(d);return this._children=o,o}render(o){if(this.type==="first"&&!o.atomIdsSettings)return null;const u=we(this.command,this.mode);if(u!=null&&u.render)return u.render(this,o);const d=new Dr({parent:o},this.style);let g=this.createBox(d,{classes:this.parent?"":"ML__base"});return g?(!this.subsupPlacement&&(this.superscript||this.subscript)&&(g=this.attachSupsub(d,{base:g})),g.wrap(d)):null}attachSupsub(o,u){var d;const g=u.base,b=this.superscript,M=this.subscript;if(!b&&!M)return g;let N=null,I=null;const F=(d=u.isCharacterBox)!=null?d:this.isCharacterBox();let $=0;if(b){const Ne=new Dr({parent:o,mathstyle:"superscript"});N=Ap.createBox(Ne,b),F||($=g.height-o.metrics.supDrop*Ne.scalingFactor)}let it=0;if(M){const Ne=new Dr({parent:o,mathstyle:"subscript"});I=Ap.createBox(Ne,M),F||(it=g.depth+o.metrics.subDrop*Ne.scalingFactor)}let gt;o.isDisplayStyle?gt=o.metrics.sup1:o.isCramped?gt=o.metrics.sup3:gt=o.metrics.sup2;const _t=.5/Yu/o.scalingFactor;let zt=null;if(I&&N){$=Math.max($,gt,N.depth+.25*o.metrics.xHeight),it=Math.max(it,o.metrics.sub2);const Ne=o.metrics.defaultRuleThickness;if($-N.depth-(I.height-it)<4*Ne){it=4*Ne-($-N.depth)+I.height;const Ee=.8*o.metrics.xHeight-($-N.depth);Ee>0&&($+=Ee,it-=Ee)}const Bi=this.isExtensibleSymbol&&g.italic?-g.italic:0;zt=new to({individualShift:[{box:I,shift:it,marginLeft:Bi},{box:N,shift:-$}]}).wrap(o)}else I&&!N?(it=Math.max(it,o.metrics.sub1,I.height-.8*Ju),zt=new to({shift:it,children:[{box:I,marginRight:_t,marginLeft:this.isCharacterBox()?-g.italic:0}]})):!I&&N&&($=Math.max($,gt,N.depth+.25*Ju),zt=new to({shift:-$,children:[{box:N,marginRight:_t}]}));return new zi([g,new zi(zt,{caret:this.caret,isSelected:this.isSelected,classes:"msubsup"})],{type:u.type})}attachLimits(o,u){const d=this.superscript?Ap.createBox(new Dr({parent:o,mathstyle:"superscript"},this.style),this.superscript):null,g=this.subscript?Ap.createBox(new Dr({parent:o,mathstyle:"subscript"},this.style),this.subscript):null;return!d&&!g?u.base.wrap(o):J0(o,rt(Q({},u),{above:d,below:g}))}bind(o,u){if(!u||o.isPhantom||this.value==="\u200B")return u;let d=this.parent;for(;d&&!d.captureSelection;)d=d.parent;return d!=null&&d.captureSelection||(this.id||(this.id=o.makeID()),u.atomID=this.id),u}createBox(o,u){var d,g,b,M;const N=(d=this.value)!=null?d:this.body,I=(g=u==null?void 0:u.boxType)!=null?g:$p(this.type);let F=(b=u==null?void 0:u.classes)!=null?b:"";this.mode==="text"&&(F+=" ML__text");const $=typeof N=="string"||N===void 0?new zi(N!=null?N:null,{type:I,isSelected:this.isSelected,mode:this.mode,maxFontSize:o.scalingFactor,style:rt(Q({variant:"normal"},this.style),{fontSize:Math.max(1,o.size+o.mathstyle.sizeDelta)}),letterShapeStyle:o.letterShapeStyle,classes:F}):(M=Ap.createBox(o,N,{type:I,classes:F}))!=null?M:new zi(null);return o.isTight&&($.isTight=!0),(this.mode!=="math"||this.style.variant==="main")&&($.italic=0),$.right=$.italic,this.bind(o,$),this.caret&&!this.superscript&&!this.subscript&&($.caret=this.caret),$}isDigit(){var o;return this.type==="mord"&&this.value?/^[\d,\.]$/.test(this.value):this.type==="group"&&((o=this.body)==null?void 0:o.length)===2?this.body[0].type==="first"&&this.body[1].value===",":!1}asDigit(){var o;return this.type==="mord"&&this.value&&/^[\d,\.]$/.test(this.value)?this.value:this.type==="group"&&((o=this.body)==null?void 0:o.length)===2&&this.body[0].type==="first"&&this.body[1].value===","?".":""}};function Q0(r){let o;const u=[];let d=[];for(const g of r)if(!o&&!g.style)d.push(g);else{const b=g.computedStyle;o&&b.color===o.color&&b.backgroundColor===o.backgroundColor&&b.fontSize===o.fontSize?d.push(g):(d.length>0&&u.push(d),d=[g],o=b)}return d.length>0&&u.push(d),u}function Cu(r,o,u){var d,g,b,M,N;if(!o||o.length===0)return null;const I=new Dr({parent:r},u.style),F=!((d=I.atomIdsSettings)!=null&&d.groupNumbers);let $=[];if(o.length===1){const gt=o[0],_t=gt.render(I);_t&&(F&&gt.isSelected&&_t.selected(!0),$=[_t])}else{let gt="",_t=!0;for(const zt of o){(g=I.atomIdsSettings)!=null&&g.groupNumbers&&gt&&(_t&&zt.isDigit()||!_t&&Hp(zt))&&(I.atomIdsSettings.overrideID=gt);const Ne=zt.render(I);I.atomIdsSettings&&(I.atomIdsSettings.overrideID=void 0),Ne&&((b=I.atomIdsSettings)!=null&&b.groupNumbers&&((zt.isDigit()||Hp(zt))&&(!gt||_t!==zt.isDigit())&&(_t=zt.isDigit(),gt=(M=zt.id)!=null?M:""),gt&&(!(zt.isDigit()||Hp(zt))||!zt.hasEmptyBranch("superscript")||!zt.hasEmptyBranch("subscript"))&&(gt="")),F&&zt.isSelected&&Ne.selected(!0),$.push(Ne))}}if($.length===0)return null;const it=new zi($,rt(Q({isTight:I.isTight},u),{type:(N=u.type)!=null?N:"lift"}));return it.isSelected=$.every(gt=>gt.isSelected),it.wrap(I)}function Hp(r){return r.mode==="text"}function tm(r){return r.map(o=>o===null?"<null>":Array.isArray(o)&&o[0]instanceof oi?{atoms:o.map(u=>u.toJson())}:typeof o=="object"&&"group"in o?{group:o.group.map(u=>u.toJson())}:o)}var nh=class l2 extends oi{constructor(o,u,d){super({type:"text",command:o,mode:"text",displayContainsHighlight:!0}),this.value=u,this.verbatimLatex=u,this.applyStyle(d)}static fromJson(o){return new l2(o.command,o.value,o.style)}render(o){const u=this.createBox(o);return this.caret&&(u.caret=this.caret),u}_serialize(o){var u;return(u=this.verbatimLatex)!=null?u:Pi("text",this.value.codePointAt(0))}};function Yc(r,o){if(r.direction===o.direction){const u=r.ranges.length;if(o.ranges.length===u){let d=0;for(;d<u&&em(r.ranges[d],o.ranges[d])==="equal";)d++;return d===u?"equal":"different"}}return"different"}function em(r,o){return r[0]===o[0]&&r[1]===o[1]?"equal":"different"}function Yo(r){let o=1/0,u=-1/0;for(const d of r.ranges)o=Math.min(o,d[0],d[1]),u=Math.max(u,d[0],d[1]);return[o,u]}function rh(r){return typeof r=="number"&&!Number.isNaN(r)}function Jc(r){return Array.isArray(r)&&r.length===2}function Vf(r){return r!=null&&typeof r=="object"&&"ranges"in r&&Array.isArray(r.ranges)}function im(r,o){const u=r.at(o);let d;if(u){d=u.mode;let g=u.parent;for(;!d&&g;)g&&(d=g.mode),g=g.parent}return d}function nm(r,o){if(!o)return"";if(typeof o=="string")return o;if(!r||o.after===void 0)return o.value;let u=!1,d=!1,g=!1,b=!1,M=!1,N=!1,I=!1,F=!1,$=!1,it=!1,gt=!1,_t=!1,zt=!1,Ne=!1,Bi=!1,Ee=r[0],hi=0;for(;Ee!=null&&Ee.type&&/^(subsup|placeholder)$/.test(Ee.type);)hi+=1,Ee=r[hi];return u=!Ee||Ee.type==="first",Ee&&(Ne=Ee.mode==="text",d=!Ne&&Ee.type==="mord"&&B.test(Ee.value),g=!Ne&&Ee.type==="mord"&&/\d+$/.test(Ee.value),b=!Ne&&Ee.isFunction,M=Ee.type==="genfrac",N=Ee.type==="surd",I=Ee.type==="mbin",F=Ee.type==="mrel",$=Ee.type==="mop"||Ee.type==="operator"||Ee.type==="extensible-symbol",it=Ee.type==="mpunct"||Ee.type==="minner",gt=Ee.type==="array",_t=Ee.type==="mopen",zt=Ee.type==="mclose"||Ee.type==="leftright",Bi=Ee.type==="space"),o.after.includes("nothing")&&u||o.after.includes("letter")&&d||o.after.includes("digit")&&g||o.after.includes("function")&&b||o.after.includes("frac")&&M||o.after.includes("surd")&&N||o.after.includes("binop")&&I||o.after.includes("relop")&&F||o.after.includes("operator")&&$||o.after.includes("punct")&&it||o.after.includes("array")&&gt||o.after.includes("openfence")&&_t||o.after.includes("closefence")&&zt||o.after.includes("text")&&Ne||o.after.includes("space")&&Bi?o.value:""}function rm(r,o,u){return u?nm(r,u[o]):""}var om={"&":"\\&","%":"\\%",$:"\\$","''":"^{\\doubleprime}","'''":"^{\\prime\\prime\\prime}","''''":"^{\\prime\\prime\\prime\\prime}",alpha:"\\alpha",delta:"\\delta",Delta:"\\Delta",pi:"\\pi",Pi:"\\Pi",theta:"\\theta",Theta:"\\Theta",ii:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryI"},jj:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryJ"},ee:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\exponentialE"},nabla:"\\nabla",grad:"\\nabla",del:"\\partial",deg:{after:"digit+space",value:"\\degree"},infty:"\\infty","\u221E":"\\infty",oo:{after:"nothing+digit+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\infty"},"\u2211":"\\sum",sum:"\\sum_{#?}^{#?}",int:"\\int_{#?}^{#?}",prod:"\\prod_{#?}^{#?}",sqrt:"\\sqrt{#?}","\u2206":"\\differentialD","\u2202":"\\differentialD",arcsin:"\\arcsin",arccos:"\\arccos",arctan:"\\arctan",arcsec:"\\arcsec",arccsc:"\\arccsc",arsinh:"\\arsinh",arcosh:"\\arcosh",artanh:"\\artanh",arcsech:"\\arcsech",arccsch:"\\arccsch",arg:"\\arg",ch:"\\ch",cosec:"\\cosec",cosh:"\\cosh",cot:"\\cot",cotg:"\\cotg",coth:"\\coth",csc:"\\csc",ctg:"\\ctg",cth:"\\cth",sec:"\\sec",sinh:"\\sinh",sh:"\\sh",tanh:"\\tanh",tg:"\\tg",th:"\\th",sin:"\\sin",cos:"\\cos",tan:"\\tan",lg:"\\lg",lb:"\\lb",log:"\\log",ln:"\\ln",exp:"\\exp",lim:"\\lim_{#?}",dx:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD x"},dy:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD y"},dt:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD t"},AA:"\\forall",EE:"\\exists","!EE":"\\nexists","&&":"\\land",xin:{after:"nothing+text+relop+punct+openfence+space",value:"x \\in"},sint:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\sin t"},in:{after:"nothing+letter+closefence",value:"\\in"},"!in":"\\notin",NN:"\\mathbb{N}",ZZ:"\\Z",QQ:"\\Q",RR:"\\R",CC:"\\C",xx:"\\times","+-":"\\pm","\u2260":"\\ne","!=":"\\ne","\u2265":"\\ge",">=":"\\ge","\u2264":"\\le","<=":"\\le","<<":"\\ll",">>":"\\gg","~~":"\\approx","\u2248":"\\approx","?=":"\\questeq","\xF7":"\\div","\xAC":"\\neg",":=":"\\coloneq","::":"\\Colon","(:":"\\langle",":)":"\\rangle",beta:"\\beta",chi:"\\chi",epsilon:"\\epsilon",varepsilon:"\\varepsilon",eta:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\eta"},gamma:"\\gamma",Gamma:"\\Gamma",iota:"\\iota",kappa:"\\kappa",lambda:"\\lambda",Lambda:"\\Lambda",mu:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\mu"},nu:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\nu"},\u00B5:"\\mu",phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\phi"},Phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Phi"},varphi:"\\varphi",psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\psi"},Psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Psi"},rho:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\rho"},sigma:"\\sigma",Sigma:"\\Sigma",tau:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\tau"},vartheta:"\\vartheta",upsilon:"\\upsilon",xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\xi"},Xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Xi"},zeta:"\\zeta",omega:"\\omega",Omega:"\\Omega",\u03A9:"\\omega",forall:"\\forall",exists:"\\exists","!exists":"\\nexists",":.":"\\therefore",liminf:"\\liminf_{#?}",limsup:"\\limsup_{#?}",argmin:"\\operatorname*{arg~min}_{#?}",argmax:"\\operatorname*{arg~max}_{#?}",det:"\\det",mod:"\\bmod{#?}","(mod":"\\pmod{#?}",max:"\\max",min:"\\min",erf:"\\operatorname{erf}",erfc:"\\operatorname{erfc}",bessel:"\\operatorname{bessel}",mean:"\\operatorname{mean}",median:"\\operatorname{median}",fft:"\\operatorname{fft}",lcm:"\\operatorname{lcm}",gcd:"\\operatorname{gcd}",randomReal:"\\operatorname{randomReal}",randomInteger:"\\operatorname{randomInteger}",Re:"\\operatorname{Re}",Im:"\\operatorname{Im}",mm:{after:"nothing+digit+operator",value:"\\operatorname{mm}"},cm:{after:"nothing+digit+operator",value:"\\operatorname{cm}"},km:{after:"nothing+digit+operator",value:"\\operatorname{km}"},kg:{after:"nothing+digit+operator",value:"\\operatorname{kg}"},"...":"\\ldots","+...":"+\\cdots","-...":"-\\cdots","->...":"\\to\\cdots","-->...":"\\longrightarrow\\cdots","->":"\\to","|->":"\\mapsto","-->":"\\longrightarrow","<--":"\\longleftarrow","=>":"\\Rightarrow","==>":"\\Longrightarrow","<=>":"\\Leftrightarrow","<->":"\\leftrightarrow","(.)":"\\odot","(+)":"\\oplus","(/)":"\\oslash","(*)":"\\otimes","(-)":"\\ominus","||":"\\Vert","*":"\\cdot","**":"\\star","***":"\\ast","//":"\\slash","\\\\":"\\backslash",setminus:"\\backslash","|><":"\\ltimes","><|":"\\rtimes","|><|":"\\bowtie","-:":"\\div",divide:"\\div","@":"\\circ","^^":"\\wedge","^^^":"\\bigwedge",vv:"\\vee",vvv:"\\bigvee",nn:"\\cap",nnn:"\\bigcap",uu:"\\cup",uuu:"\\bigcup","-=":"\\equiv","~=":"\\cong",lt:"<","lt=":"\\leq",gt:">","gt=":"\\geq","-<":"\\prec","-lt":"\\prec","-<=":"\\preceq",">-=":"\\succeq",prop:"\\propto",diamond:"\\diamond",square:"\\square",iff:"\\iff",sub:"\\subset",sup:"\\supset",sube:"\\subseteq",supe:"\\supseteq",uarr:"\\uparrow",darr:"\\downarrow",rarr:"\\rightarrow",rArr:"\\Rightarrow",larr:"\\leftarrow",lArr:"\\Leftarrow",harr:"\\leftrightarrow",hArr:"\\Leftrightarrow",aleph:"\\aleph",and:"\\land",or:"\\lor",not:"\\neg","_|_":"\\bot",TT:"\\top","|--":"\\vdash","|==":"\\models","|__":"\\lfloor","__|":"\\rfloor","|~":"\\lceil","~|":"\\rceil",">->":"\\rightarrowtail","->>":"\\twoheadrightarrow",">->>":"\\twoheadrightarrowtail",frac:"\\frac{#?}{#?}",cbrt:"\\sqrt[3]{#?}",nthroot:"\\sqrt[#?]{#?}"};function qc(r,o){var u;let d=(u=o==null?void 0:o.format)!=null?u:"auto";return d==="auto"&&([d,r]=am(r)),d==="ascii-math"?(r=r.replace(/\u2061/gu,""),r=r.replace(/\u3016/gu,"{"),r=r.replace(/\u3017/gu,"}"),r=r.replace(/([^\\])sinx/g,"$1\\sin x"),r=r.replace(/([^\\])cosx/g,"$1\\cos x "),r=r.replace(/\u2013/g,"-"),["ascii-math",Ca(r,{inlineShortcuts:o==null?void 0:o.inlineShortcuts})]):["latex",r]}function Ca(r,o){var u,d,g;if(!r)return"";let b=!1,M;const N=(u=o.inlineShortcuts)!=null?u:om;if(!b&&(r.startsWith("^")||r.startsWith("_"))&&(M=oh(r.slice(1),{inlineShortcuts:N,noWrap:!0}),r=r[0]+"{"+M.match+"}",r+=Ca(M.rest,o),b=!0),b||(M=r.match(/^(sqrt|\u221A)(.*)/),M&&(M=oh(M[2],{inlineShortcuts:N,noWrap:!0}),r="\\sqrt{"+((d=M.match)!=null?d:"\\placeholder{}")+"}",r+=Ca(M.rest,o),b=!0)),b||(M=r.match(/^(\\cbrt|\u221B)(.*)/),M&&(M=oh(M[2],{inlineShortcuts:N,noWrap:!0}),r="\\sqrt[3]{"+((g=M.match)!=null?g:"\\placeholder{}")+"}",r+=Ca(M.rest,o),b=!0)),b||(M=r.match(/^abs(.*)/),M&&(M=oh(M[1],{inlineShortcuts:N,noWrap:!0}),r="\\left|"+M.match+"\\right|",r+=Ca(M.rest,o),b=!0)),b||(M=r.match(/^["”“](.*?)["”“](.*)/),M&&(r="\\text{"+M[1]+"}",r+=Ca(M[2],o),b=!0)),b||(M=r.match(/^([^a-zA-Z\(\{\[\_\^\\\s"]+)(.*)/),M&&(r=sm(M[1],N),r+=Ca(M[2],o),b=!0)),!b&&/^([fgh])[^a-zA-Z]/.test(r)&&(M=oh(r.slice(1),{inlineShortcuts:N,noWrap:!0}),r=r[1]==="("?r[0]+"\\left("+M.match+"\\right)":r[0]+M.match,r+=Ca(M.rest,o),b=!0),b||(M=r.match(/^([a-zA-Z]+)(.*)/),M&&(r=sm(M[1],N),r+=Ca(M[2],o),b=!0)),!b)if(M=oh(r,{inlineShortcuts:N,noWrap:!0}),M.match&&M.rest[0]==="/"){const I=oh(M.rest.slice(1),{inlineShortcuts:N,noWrap:!0});I.match&&(r="\\frac{"+M.match+"}{"+I.match+"}"+Ca(I.rest,o)),b=!0}else M.match&&(r=r.startsWith("(")?"\\left("+M.match+"\\right)"+Ca(M.rest,o):M.match+Ca(M.rest,o),b=!0);return b||(M=r.match(/^(\s+)(.*)$/),M&&(r=" "+Ca(M[2],o),b=!0)),r}function oh(r,o){let u="";r=r.trim();let d=r,g=r.charAt(0),b={"(":")","{":"}","[":"]"}[g];if(b){let M=1,N=1;for(;N<r.length&&M>0;)r[N]===g&&M++,r[N]===b&&M--,N++;M===0?(o.noWrap&&g==="("?u=Ca(r.substring(1,N-1),o):(g==="{"&&b==="}"&&(g="\\{",b="\\}"),u="\\left"+g+Ca(r.substring(1,N-1),o)+"\\right"+b),d=r.slice(Math.max(0,N))):(u=r.substring(1,N),d="")}else{let M=r.match(/^([a-zA-Z]+)/);if(M){let N=rm(null,r,o.inlineShortcuts);if(N)return N=N.replace("_{#?}",""),N=N.replace("^{#?}",""),{match:N,rest:r.slice(N.length)}}if(M=r.match(/^([a-zA-Z])/),M)return{match:M[1],rest:r.slice(1)};if(M=r.match(/^(-)?\d+(\.\d*)?/),M)return{match:M[0],rest:r.slice(M[0].length)};/^\\(left|right)/.test(r)||(M=r.match(/^(\\[a-zA-Z]+)/),M&&(d=r.slice(M[1].length),u=M[1]))}return{match:u,rest:d}}function sm(r,o){let u=rm(null,r,o);return u?(u=u.replace("_{#?}",""),u=u.replace("^{#?}",""),u+=" "):u=r,u}var Wf=[["\\[","\\]"],["\\(","\\)"],["$$","$$"],["$","$"],["\\begin{math}","\\end{math}"],["\\begin{displaymath}","\\end{displaymath}"],["\\begin{equation}","\\end{equation}"],["\\begin{equation*}","\\end{equation*}"]];function sh(r){const o=r.trim();for(const u of Wf)if(o.startsWith(u[0])&&o.endsWith(u[1]))return[!0,o.substring(u[0].length,o.length-u[1].length)];return[!1,r]}function am(r){if(r=r.trim(),r.length<=1)return["latex",r];let o;return[o,r]=sh(r),o?["latex",r]:r.startsWith("`")&&r.endsWith("`")?(r=r.substring(1,r.length-1),["ascii-math",r]):r.includes("\\")?["latex",r]:/\$.+\$/.test(r)?["latex",`\\text{${r}}`]:[void 0,r]}var Uf="$$",wg="$$",Vp=(r,o,u)=>(Wf.some(d=>o.startsWith(d[0])&&o.endsWith(d[1]))||(o=`${Uf} ${o} ${wg}`),o),lm=class hx{constructor(o){hx._modes[o]=this}static onPaste(o,u,d){var g;if(!u.contentEditable&&u.userSelect==="none")return u.model.announce("plonk"),!1;if(typeof d=="string"){const M=new DataTransfer;M.setData("text/plain",d),d=M}const b=new ClipboardEvent("paste",{clipboardData:d,cancelable:!0});return(g=u.host)!=null&&g.dispatchEvent(b)?hx._modes[o].onPaste(u,d):!1}static copyToClipboard(o,u){if(!o.contentEditable&&o.userSelect==="none"){o.model.announce("plonk");return}const d=o.model,g=d.selectionIsCollapsed?[0,d.lastOffset]:Yo(d.selection),b=d.getValue(g,u);navigator.clipboard.writeText(b).then(()=>{},()=>o.model.announce("plonk"))}static onCopy(o,u){var d;if(!u.clipboardData)return;if(!o.contentEditable&&o.userSelect==="none"){o.model.announce("plonk");return}const g=o.model,b=g.selectionIsCollapsed?[0,g.lastOffset]:Yo(g.selection);let M=g.getAtoms(b);if(M.every(N=>N.mode==="text"||!N.mode))u.clipboardData.setData("text/plain",M.filter(N=>N instanceof nh).map(N=>N.value).join(""));else if(M.every(N=>N.mode==="latex"))u.clipboardData.setData("text/plain",g.getAtoms(b,{includeChildren:!0}).map(N=>{var I;return(I=N.value)!=null?I:""}).join(""));else{let N;M.length===1&&M[0].verbatimLatex!==void 0?N=M[0].verbatimLatex:N=g.getValue(b,"latex-expanded"),u.clipboardData.setData("application/x-latex",N);try{u.clipboardData.setData("text/plain",o.options.onExport(o,N,b))}catch(I){}if(M.length===1){const I=M[0];(I.type==="root"||I.type==="group")&&(M=I.body.filter(F=>F.type!=="first"))}try{u.clipboardData.setData("application/json+mathlive",JSON.stringify(M.map(I=>I.toJson())))}catch(I){}if((d=window[Symbol.for("io.cortexjs.compute-engine")])!=null&&d.ComputeEngine){const I=window.MathfieldElement.computeEngine;if(I)try{const F=I.jsonSerializationOptions;I.jsonSerializationOptions={metadata:["latex"]};const $=I.parse(g.getValue(b,"latex-unstyled"));I.jsonSerializationOptions=F;const it=JSON.stringify($.json);it&&u.clipboardData.setData("application/json",it)}catch(F){}}}u.preventDefault()}static insert(o,u,d={}){var g;const b=d.mode==="auto"?o.mode:(g=d.mode)!=null?g:o.mode;return hx._modes[b].insert(o,u,d)}onPaste(o,u){return!1}insert(o,u,d){return!1}};lm._modes={};var Bn=lm,Fd=[{key:"left",command:"moveToPreviousChar"},{key:"right",command:"moveToNextChar"},{key:"up",command:"moveUp"},{key:"down",command:"moveDown"},{key:"shift+[ArrowLeft]",command:"extendSelectionBackward"},{key:"shift+[ArrowRight]",command:"extendSelectionForward"},{key:"shift+[ArrowUp]",command:"extendSelectionUpward"},{key:"shift+[ArrowDown]",command:"extendSelectionDownward"},{key:"[Backspace]",command:"deleteBackward"},{key:"alt+[Delete]",command:"deleteBackward"},{key:"[Delete]",command:"deleteForward"},{key:"alt+[Backspace]",command:"deleteForward"},{key:"alt+[ArrowLeft]",command:"moveToPreviousWord"},{key:"alt+[ArrowRight]",command:"moveToNextWord"},{key:"shift+alt+[ArrowLeft]",command:"extendToPreviousWord"},{key:"shift+alt+[ArrowRight]",command:"extendToNextWord"},{key:"ctrl+[ArrowLeft]",command:"moveToGroupStart"},{key:"ctrl+[ArrowRight]",command:"moveToGroupEnd"},{key:"shift+ctrl+[ArrowLeft]",command:"extendToGroupStart"},{key:"shift+ctrl+[ArrowRight]",command:"extendToGroupEnd"},{key:"[Home]",command:"moveToMathfieldStart"},{key:"cmd+[ArrowLeft]",command:"moveToMathfieldStart"},{key:"shift+[Home]",command:"extendToMathFieldStart"},{key:"shift+cmd+[ArrowLeft]",command:"extendToMathFieldStart"},{key:"[End]",command:"moveToMathfieldEnd"},{key:"cmd+[ArrowRight]",command:"moveToMathfieldEnd"},{key:"shift+[End]",command:"extendToMathFieldEnd"},{key:"shift+cmd+[ArrowRight]",command:"extendToMathFieldEnd"},{key:"[Pageup]",command:"moveToGroupStart"},{key:"[Pagedown]",command:"moveToGroupEnd"},{key:"[Tab]",command:"moveToNextGroup"},{key:"shift+[Tab]",command:"moveToPreviousGroup"},{key:"[Escape]",ifMode:"math",command:["switchMode","latex"]},{key:"[Escape]",ifMode:"text",command:["switchMode","latex"]},{key:"[Escape]",ifMode:"latex",command:["complete","complete",{selectItem:"true"}]},{key:"\\",ifMode:"math",command:["switchMode","latex","\\"]},{key:"[IntlBackslash]",ifMode:"math",command:["switchMode","latex","\\"]},{key:"[Tab]",ifMode:"latex",command:["complete","accept-suggestion"]},{key:"[Return]",ifMode:"latex",command:"complete"},{key:"[Enter]",ifMode:"latex",command:"complete"},{key:"shift+[Escape]",ifMode:"latex",command:["complete","reject"]},{key:"[ArrowDown]",ifMode:"latex",command:"nextSuggestion"},{key:"[ArrowUp]",ifMode:"latex",command:"previousSuggestion"},{key:"ctrl+a",ifPlatform:"!macos",command:"selectAll"},{key:"cmd+a",command:"selectAll"},{key:"[Cut]",command:"cutToClipboard"},{key:"[Copy]",command:"copyToClipboard"},{key:"[Paste]",command:"pasteFromClipboard"},{key:"[Clear]",command:"deleteBackward"},{key:"[Undo]",command:"undo"},{key:"[Redo]",command:"redo"},{key:"[EraseEof]",command:"deleteToGroupEnd"},{key:"ctrl+x",ifPlatform:"ios",command:"cutToClipboard"},{key:"cmd+x",ifPlatform:"ios",command:"cutToClipboard"},{key:"ctrl+c",ifPlatform:"ios",command:"copyToClipboard"},{key:"cmd+c",ifPlatform:"ios",command:"copyToClipboard"},{key:"ctrl+v",ifPlatform:"ios",command:"pasteFromClipboard"},{key:"cmd+v",ifPlatform:"ios",command:"pasteFromClipboard"},{key:"ctrl+z",ifPlatform:"!macos",command:"undo"},{key:"cmd+z",command:"undo"},{key:"ctrl+y",ifPlatform:"!macos",command:"redo"},{key:"shift+cmd+y",command:"redo"},{key:"shift+ctrl+z",ifPlatform:"!macos",command:"redo"},{key:"shift+cmd+z",command:"redo"},{key:"ctrl+b",ifPlatform:"macos",command:"moveToPreviousChar"},{key:"ctrl+f",ifPlatform:"macos",command:"moveToNextChar"},{key:"ctrl+p",ifPlatform:"macos",command:"moveUp"},{key:"ctrl+n",ifPlatform:"macos",command:"moveDown"},{key:"ctrl+a",ifPlatform:"macos",command:"moveToMathfieldStart"},{key:"ctrl+e",ifPlatform:"macos",command:"moveToMathfieldEnd"},{key:"shift+ctrl+b",ifPlatform:"macos",command:"extendSelectionBackward"},{key:"shift+ctrl+f",ifPlatform:"macos",command:"extendSelectionForward"},{key:"shift+ctrl+p",ifPlatform:"macos",command:"extendSelectionUpward"},{key:"shift+ctrl+n",ifPlatform:"macos",command:"extendSelectionDownward"},{key:"shift+ctrl+a",ifPlatform:"macos",command:"extendToMathFieldStart"},{key:"shift+ctrl+e",ifPlatform:"macos",command:"extendToMathFieldEnd"},{key:"alt+ctrl+b",ifPlatform:"macos",command:"moveToPreviousWord"},{key:"alt+ctrl+f",ifPlatform:"macos",command:"moveToNextWord"},{key:"shift+alt+ctrl+b",ifPlatform:"macos",command:"extendToPreviousWord"},{key:"shift+alt+ctrl+f",ifPlatform:"macos",command:"extendToNextWord"},{key:"ctrl+h",ifPlatform:"macos",command:"deleteBackward"},{key:"ctrl+d",ifPlatform:"macos",command:"deleteForward"},{key:"ctrl+l",ifPlatform:"macos",command:"scrollIntoView"},{key:"ctrl+[Digit2]",ifMode:"math",command:["insert","\\sqrt{#0}"]},{key:"ctrl+[Digit5]",ifMode:"math",command:"moveToOpposite"},{key:"ctrl+[Digit6]",ifMode:"math",command:"moveToSuperscript"},{key:"ctrl+[Return]",ifMode:"math",command:"addRowAfter"},{key:"ctrl+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"cmd+[Return]",ifMode:"math",command:"addRowAfter"},{key:"cmd+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"alt+p",ifMode:"math",command:["insert","\\pi"]},{key:"alt+v",ifMode:"math",command:["insert","\\sqrt{#0}"]},{key:"alt+o",ifMode:"math",command:["insert","\\emptyset"]},{key:"alt+d",ifMode:"math",command:["insert","\\differentialD"]},{key:"shift+alt+o",ifMode:"math",command:["insert","\\varnothing"]},{key:"shift+alt+d",ifMode:"math",command:["insert","\\partial"]},{key:"alt+[Backslash]",ifMode:"math",command:["insert","\\backslash"]},{key:"[NumpadDivide]",ifMode:"math",command:["insert","\\frac{#@}{#?}"]},{key:"alt+[NumpadDivide]",ifMode:"math",command:["insert","\\frac{#?}{#@}"]},{key:"shift+alt+k",command:"toggleKeystrokeCaption"},{key:"alt+[Space]",command:"toggleContextMenu"},{key:"alt+shift+[Space]",command:"toggleVirtualKeyboard"},{key:"alt+ctrl+[ArrowUp]",command:["speak","all",{withHighlighting:!1}]},{key:"alt+ctrl+[ArrowDown]",command:["speak","selection",{withHighlighting:!1}]},{key:"shift+[Quote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["switchMode","text","",""]},{key:"shift+alt+[KeyT]",ifMode:"math",command:["switchMode","text","",""]},{key:"shift+[Quote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"text",command:["switchMode","math","",""]},{key:"shift+alt+[KeyT]",ifMode:"text",command:["switchMode","math","",""]},{key:"/",ifMode:"math",command:["insert","\\frac{#@}{#?}"]},{key:"alt+/",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","/"]},{key:"alt+shift+/",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","/"]},{key:"alt+[BracketLeft]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\left\\lbrack #0 \\right\\rbrack"]},{key:"ctrl+[Minus]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"moveToSubscript"},{key:"shift+alt+[BracketLeft]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\left\\lbrace #0 \\right\\rbrace"]},{key:"ctrl+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowAfter"},{key:"cmd+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowAfter"},{key:"shift+ctrl+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowBefore"},{key:"shift+cmd+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowBefore"},{key:"ctrl+[Backspace]",ifMode:"math",command:"removeRow"},{key:"cmd+[Backspace]",ifMode:"math",command:"removeRow"},{key:"alt+[Tab]",ifMode:"math",command:"addColumnAfter"},{key:"shift+alt+[Tab]",ifMode:"math",command:"addColumnBefore"},{key:"alt+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"shift+alt+[Enter]",ifMode:"math",command:"addRowBefore"},{key:"alt+[Return]",ifMode:"math",command:"addRowAfter"},{key:"shift+alt+[Return]",ifMode:"math",command:"addRowBefore"},{key:"shift+[Backspace]",ifMode:"math",command:"removeColumn"},{key:"alt+[Digit5]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","$\\infty"]},{key:"alt+[Digit9]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","("]},{key:"alt+[Digit0]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert",")"]},{key:"alt+|",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","|"]},{key:"shift+[Backquote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\~"]},{key:"[Backquote]",ifLayout:["windows.french","linux.french"],ifMode:"math",command:["insert","^2"]},{key:"[Backquote]",ifLayout:["windows.german","linux.german"],ifMode:"math",command:["insert","^"]},{key:"[IntlBackslash]",ifLayout:["apple.german"],ifMode:"math",command:["insert","^"]}],Qc={"\\sqrt":["alt+v","ctrl+[Digit2]"],"\\pi":"alt+p","\\infty":"alt+[Digit5]","\\differentialD":"alt+d","\\partial":"shift+alt+d","\\frac":"Slash","\\emptyset":"alt+o","\\varnothing":"shift+alt+o","\\~":"~"};function Jo(r){var o;return((o=r.element)==null?void 0:o.mathfield)===r}function Ya(r){var o,u;return(u=(o=r.querySelector(".ML__caret"))!=null?o:r.querySelector(".ML__text-caret"))!=null?u:r.querySelector(".ML__latex-caret")}function ku(r){const o=Ya(r);if(!o)return null;const u=o.getBoundingClientRect();return{x:u.right,y:u.bottom,height:u.height}}function Zf(r){var o;if(!r.parent)return"root";let u=(o=r.parent.id)!=null?o:"";return u+=typeof r.parentBranch=="string"?"-"+r.parentBranch:`-${r.parentBranch[0]}/${r.parentBranch[0]}`,u}function Wp(r,o,u){if(!o)return null;const d=r.field.getBoundingClientRect(),g=o.right-o.left,b=o.bottom-o.top,M=Math.ceil(o.left-d.left+r.field.scrollLeft*u),N=Math.ceil(o.top-d.top);return{left:M,right:M+g,top:N,bottom:N+b}}function Up(r){const o=r.getBoundingClientRect(),u=parseInt(getComputedStyle(r).marginRight),d={top:o.top-1,bottom:o.bottom,left:o.left,right:o.right-1+u};if(r.children.length===0||r.tagName.toUpperCase()==="SVG")return d;for(const g of r.children)if(g.nodeType===1&&"atomId"in g.dataset&&!g.classList.contains("pstrut")){const b=Up(g);d.left=Math.min(d.left,b.left),d.right=Math.max(d.right,b.right),d.top=Math.min(d.top,b.top),d.bottom=Math.max(d.bottom,b.bottom)}return d}function td(r,o){var u,d;if(!o.id)return null;let g=(d=(u=r.atomBoundsCache)==null?void 0:u.get(o.id))!=null?d:null;if(g!==null)return g;const b=r.field.querySelector(`[data-atom-id="${o.id}"]`);return g=b?Up(b):null,r.atomBoundsCache&&(g?r.atomBoundsCache.set(o.id,g):r.atomBoundsCache.delete(o.id)),g!=null?g:null}function um(r,o,u){const d=new Map;for(const g of r.model.getAtoms(o,{includeChildren:!0})){if(u!=null&&u.excludeAtomsWithBackground&&g.style.backgroundColor)continue;const b=r.field,M=b.offsetWidth;let I=Math.floor(b.getBoundingClientRect().width)/M;I=isNaN(I)?1:I;const F=Wp(r,td(r,g),I);if(F){const $=Zf(g);if(d.has($)){const it=d.get($);d.set($,{left:Math.min(it.left,F.left),right:Math.max(it.right,F.right),top:Math.min(it.top,F.top),bottom:Math.max(it.bottom,F.bottom)})}else d.set($,F)}}return[...d.values()]}function Zp(r,o){return r.model.selection.ranges.reduce((u,d)=>u.concat(...um(r,d,o)),[])}function ah(r,o){return r==="*"||o==="none"?!0:o==="same-origin"?!window.origin||r===window.origin:typeof o=="function"?o(r):!1}function Rd(r){let o=0,u=0;const d=r.offsetWidth,g=r.offsetHeight;for(;r instanceof HTMLElement;)o+=r.offsetTop,u+=r.offsetLeft,r=r.offsetParent;return new DOMRect(u,o,d,g)}var yc=`@keyframes ML__caret-blink {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0;
}
}
.ML__container {
display: inline-flex;
flex-flow: row;
justify-content: space-between;
align-items: flex-end;
min-height: 39px;
/* Need some room for the virtual keyboard toggle */
width: 100%;
/* Encourage browsers to consider allocating a hardware accelerated
layer for this element. */
isolation: isolate;
/* Prevent the browser from trying to interpret touch gestures in the field */
/* "Disabling double-tap to zoom removes the need for browsers to
delay the generation of click events when the user taps the screen." */
touch-action: none;
--_caret-color: var(--caret-color, hsl(var(--_hue), 40%, 49%));
--_selection-color: var(--selection-color, #000);
--_selection-background-color: var(--selection-background-color, hsl(var(--_hue), 70%, 85%));
--_text-highlight-background-color: var(--highlight-text, hsla(var(--_hue), 40%, 50%, 0.1));
--_contains-highlight-background-color: var(--contains-highlight-background-color, hsl(var(--_hue), 40%, 95%));
--_smart-fence-color: var(--smart-fence-color, currentColor);
--_smart-fence-opacity: var(--smart-fence-opacity, 0.5);
--_latex-color: var(--latex-color, hsl(var(--_hue), 80%, 40%));
--_correct-color: var(--correct-color, #10a000);
--_incorrect-color: var(--incorrect-color, #a01b00);
--_composition-background-color: var(--composition-background-color, #fff1c2);
--_composition-text-color: var(--composition-text-color, black);
--_composition-underline-color: var(--composition-underline-color, transparent);
}
/* This is the actual field content (formula) */
.ML__content {
display: flex;
align-items: center;
align-self: center;
position: relative;
overflow: hidden;
padding: 2px 3px 2px 1px;
width: 100%;
}
.ML__virtual-keyboard-toggle,
.ML__menu-toggle {
box-sizing: border-box;
display: flex;
align-self: center;
align-items: center;
flex-shrink: 0;
flex-direction: column;
justify-content: center;
width: 34px;
height: 34px;
padding: 0;
margin-right: 4px;
cursor: pointer;
/* Avoid some weird blinking with :hover */
border-radius: 8px;
border: 1px solid transparent;
transition: background 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
color: hsl(var(--_hue), 40%, 50%);
fill: currentColor;
background: transparent;
}
.ML__virtual-keyboard-toggle:hover,
.ML__menu-toggle:hover {
background: hsla(0, 0%, 70%, 0.3);
color: #333;
fill: currentColor;
}
.ML__virtual-keyboard-toggle > span,
.ML__menu-toggle > span {
display: flex;
align-self: center;
align-items: center;
}
/* The invisible element used to capture keyboard events. We're just trying
really hard to make sure it doesn't show. */
.ML__keyboard-sink {
display: inline-block;
resize: none;
outline: none;
border: none;
/* Need these for Microsoft Edge */
position: fixed;
clip: rect(0 0 0 0);
/* Need this to prevent iOS Safari from auto-zooming */
font-size: 1em;
font-family: KaTeX_Main;
line-height: 0.5;
/* On Chromium, if this is 0, no keyboard events are received */
}
[part="placeholder"] {
color: var(--neutral-400);
}
.ML__composition {
background: var(--_composition-background-color);
color: var(--_composition-text-color);
text-decoration: underline var(--_composition-underline-color);
}
.ML__caret::after {
content: '';
visibility: hidden;
width: 0;
display: inline-block;
height: 0.76em;
--_caret-width: clamp(2px, 0.08em, 10px);
border: none;
border-radius: calc(var(--_caret-width) / 2);
border-right: var(--_caret-width) solid var(--_caret-color);
margin-right: calc(-1 * var(--_caret-width));
position: relative;
left: -0.045em;
bottom: -0.05em;
animation: ML__caret-blink 1.05s step-end forwards infinite;
}
.ML__text-caret::after {
content: '';
visibility: hidden;
width: 0;
display: inline-block;
height: 0.76em;
--_caret-width: clamp(2px, 0.08em, 10px);
border: none;
border-radius: calc(var(--_caret-width) / 2);
border-right: var(--_caret-width) solid var(--_caret-color);
margin-right: calc(-1 * var(--_caret-width));
position: relative;
left: -0.045em;
bottom: -0.05em;
animation: ML__caret-blink 1.05s step-end forwards infinite;
}
.ML__latex-caret::after {
content: '';
visibility: hidden;
--_caret-width: clamp(2px, 0.08em, 10px);
border: none;
border-radius: calc(var(--_caret-width) / 2);
border-right: var(--_caret-width) solid var(--_latex-color);
margin-right: calc(-1 * var(--_caret-width));
position: relative;
left: -0.019em;
animation: ML__caret-blink 1.05s step-end forwards infinite;
}
.ML__focused .ML__latex-caret::after,
.ML__focused .ML__text-caret::after,
.ML__focused .ML__caret::after {
visibility: visible;
}
.ML__focused .ML__text {
background: var(--_text-highlight-background-color);
}
/* When using smartFence, the anticipated closing fence is displayed
with this style */
.ML__smart-fence__close {
opacity: var(--_smart-fence-opacity);
color: var(--_smart-fence-color);
}
.ML__selected,
.ML__focused .ML__selected .ML__contains-caret,
.ML__focused .ML__selected .ML__smart-fence__close,
.ML__focused .ML__selected .ML__placeholder {
color: var(--_selection-color);
opacity: 1;
}
.ML__selection {
box-sizing: border-box;
background: var(--_selection-background-color) !important;
}
.ML__contains-caret.ML__close,
.ML__contains-caret.ML__open,
.ML__contains-caret > .ML__close,
.ML__contains-caret > .ML__open,
.ML__contains-caret .ML__sqrt-sign,
.ML__contains-caret .ML__sqrt-line {
color: var(--_caret-color);
}
.ML__contains-highlight {
box-sizing: border-box;
background: transparent;
}
.ML__focused .ML__contains-highlight {
background: var(--_contains-highlight-background-color);
}
.ML__raw-latex {
font-family: 'Berkeley Mono', 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace;
font-weight: 400;
font-size: 0.8em;
letter-spacing: -0.05em;
color: var(--_latex-color);
}
.ML__suggestion {
color: var(--neutral-500);
}
.ML__virtual-keyboard-toggle.is-visible.is-pressed:hover {
background: hsl(var(--_hue), 25%, 35%);
color: #fafafa;
fill: currentColor;
}
.ML__virtual-keyboard-toggle:focus {
outline: none;
border-radius: 8px;
border: 2px solid hsl(var(--_hue), 40%, 50%);
}
.ML__virtual-keyboard-toggle.is-pressed,
.ML__virtual-keyboard-toggle.is-active:hover,
.ML__virtual-keyboard-toggle.is-active {
background: hsl(var(--_hue), 25%, 35%);
color: #fafafa;
fill: currentColor;
}
/* Add an attribute 'data-tooltip' to automatically show a
tooltip over a element on hover.
*/
[data-tooltip] {
position: relative;
}
[data-tooltip]::after {
content: attr(data-tooltip);
position: absolute;
display: block;
z-index: 2;
pointer-events: none;
right: auto;
top: calc(-100% - 4px);
width: max-content;
max-width: 200px;
padding: 8px 8px;
border-radius: 4px;
background: #616161;
color: #fff;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
text-align: center;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-style: normal;
font-weight: 400;
font-size: 13px;
/* Phone */
opacity: 0;
transform: scale(0.5);
}
@media only screen and (max-width: 767px) {
[data-tooltip]::after {
padding: 8px 16px;
font-size: 16px;
}
}
menu [data-tooltip]::after {
left: 100%;
top: 0%;
}
menu .ML__base {
cursor: default;
}
/** Don't display if we're tracking, i.e. have the pointer down */
.tracking [data-tooltip]:hover::after {
/* Use visibility, not display. Display will remove the after from the DOM, and the override below will not work */
visibility: hidden;
}
/** But do display if tracking and inside a menu */
.tracking menu li[data-tooltip]:hover::after,
[data-tooltip]:hover::after {
visibility: visible;
opacity: 1;
transform: scale(1);
transition-property: opacity, scale;
transition-duration: 0.15s;
transition-delay: 1s;
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}
.ML__prompt {
border-radius: 2px;
}
.ML__editablePromptBox {
outline: 1px solid #acacac;
border-radius: 2px;
z-index: -1;
}
.ML__focusedPromptBox {
outline: highlight auto 1px;
}
.ML__lockedPromptBox {
background-color: rgba(142, 142, 141, 0.4);
z-index: -1;
}
.ML__correctPromptBox {
outline: 1px solid var(--_correct-color);
box-shadow: 0 0 5px var(--_correct-color);
}
.ML__incorrectPromptBox {
outline: 1px solid var(--_incorrect-color);
box-shadow: 0 0 5px var(--_incorrect-color);
}
.variant-submenu {
display: flex;
flex-direction: column;
padding: 8px;
}
.variant-submenu [part=menu-item] {
font-size: 2rem;
text-align: center;
margin: 0;
}
.insert-matrix-submenu {
display: grid;
padding: 8px;
align-content: center;
justify-content: center;
grid-template-columns: repeat(5, minmax(0, 1fr));
}
.insert-matrix-submenu [part=menu-item] {
font-size: 21px;
border: none;
border-radius: 0;
line-height: 21px;
text-align: center;
padding: 0;
margin: 0;
}
.border-submenu [part=menu-item] {
font-size: 2rem;
line-height: 1.2;
text-align: center;
}
.swatches-submenu {
--_swatch-size: 2rem;
--_columns: 4;
display: flex;
flex-flow: wrap;
padding: 8px;
max-width: calc(var(--_columns) * (var(--_swatch-size) + 18px) + 16px);
box-sizing: border-box;
}
.menu-swatch {
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: fit-content;
height: fit-content;
margin: 2px;
padding: 0;
background: var(--neutral-200);
}
.menu-swatch > .label {
padding: 0;
margin: 0;
line-height: 0;
}
.menu-swatch > .label > span {
display: inline-block;
margin: 6px;
min-width: var(--_swatch-size);
min-height: var(--_swatch-size);
border-radius: 50%;
}
.menu-swatch.active {
background: var(--neutral-100);
scale: 1.4;
}
.menu-swatch.active > .label > span {
border-radius: 2px;
}
.menu-swatch .ui-checkmark,
.menu-swatch .ui-mixedmark {
position: absolute;
margin: 0;
padding: 0;
color: white;
}
.menu-swatch.dark-contrast .ui-checkmark,
.menu-swatch.dark-contrast .ui-mixedmark {
color: #000;
}
`,go=`.ML__container {
min-height: auto !important;
--_hue: var(--hue, 212);
--_placeholder-color: var(--placeholder-color, hsl(var(--_hue), 40%, 49%));
--_placeholder-opacity: var(--placeholder-opacity, 0.4);
--_text-font-family: var(--text-font-family, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif);
}
.ML__sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}
.ML__is-inline {
display: inline-block;
}
.ML__base {
visibility: inherit;
display: inline-block;
position: relative;
cursor: text;
padding: 0;
margin: 0;
box-sizing: content-box;
border: 0;
outline: 0;
vertical-align: baseline;
font-weight: inherit;
font-family: inherit;
font-style: inherit;
text-decoration: none;
width: min-content;
}
.ML__strut,
.ML__strut--bottom {
display: inline-block;
min-height: 0.5em;
}
.ML__small-delim {
font-family: KaTeX_Main;
}
/* Text mode */
.ML__text {
font-family: var(--_text-font-family);
white-space: pre;
}
/* Use cmr for 'math upright' */
.ML__cmr {
font-family: KaTeX_Main;
font-style: normal;
}
.ML__mathit {
font-family: KaTeX_Math;
/* The KaTeX_Math font is italic by default, so the font-style below is only
useful when a fallback font is used
*/
font-style: italic;
}
.ML__mathbf {
font-family: KaTeX_Main;
font-weight: bold;
}
/* Lowercase greek symbols should stick to math font when \\mathbf is applied
to match TeX idiosyncratic behavior */
.lcGreek.ML__mathbf {
font-family: KaTeX_Math;
font-weight: normal;
}
.ML__mathbfit {
font-family: KaTeX_Math;
font-weight: bold;
font-style: italic;
}
.ML__ams {
font-family: KaTeX_AMS;
}
/* Blackboard */
.ML__bb {
font-family: KaTeX_AMS;
}
.ML__cal {
font-family: KaTeX_Caligraphic;
}
.ML__frak {
font-family: KaTeX_Fraktur;
}
.ML__tt {
font-family: KaTeX_Typewriter;
}
.ML__script {
font-family: KaTeX_Script;
}
.ML__sans {
font-family: KaTeX_SansSerif;
}
.ML__series_ul {
font-weight: 100;
}
.ML__series_el {
font-weight: 100;
}
.ML__series_l {
font-weight: 200;
}
.ML__series_sl {
font-weight: 300;
}
.ML__series_sb {
font-weight: 500;
}
.ML__bold,
.ML__boldsymbol {
font-weight: 700;
}
.ML__series_eb {
font-weight: 800;
}
.ML__series_ub {
font-weight: 900;
}
.ML__series_uc {
font-stretch: ultra-condensed;
}
.ML__series_ec {
font-stretch: extra-condensed;
}
.ML__series_c {
font-stretch: condensed;
}
.ML__series_sc {
font-stretch: semi-condensed;
}
.ML__series_sx {
font-stretch: semi-expanded;
}
.ML__series_x {
font-stretch: expanded;
}
.ML__series_ex {
font-stretch: extra-expanded;
}
.ML__series_ux {
font-stretch: ultra-expanded;
}
.ML__it {
font-style: italic;
}
.ML__shape_ol {
-webkit-text-stroke: 1px black;
text-stroke: 1px black;
color: transparent;
}
.ML__shape_sc {
font-variant: small-caps;
}
.ML__shape_sl {
font-style: oblique;
}
/* First level emphasis */
.ML__emph {
color: #bc2612;
}
/* Second level emphasis */
.ML__emph .ML__emph {
color: #0c7f99;
}
.ML__highlight {
color: #007cb2;
background: #edd1b0;
}
.ML__center {
text-align: center;
}
.ML__label_padding {
padding: 0 0.5em;
}
.ML__frac-line {
width: 100%;
min-height: 1px;
}
.ML__frac-line:after {
content: '';
display: block;
margin-top: max(-1px, -0.04em);
min-height: max(1px, 0.04em);
/* Ensure the line is visible when printing even if "turn off background images" is on*/
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
/* There's a bug since Chrome 62 where
sub-pixel border lines don't draw at some zoom
levels (110%, 90%).
Setting the min-height used to work around it, but that workaround
broke in Chrome 84 or so.
Setting the background (and the min-height) seems to work for now.
*/
background: currentColor;
box-sizing: content-box;
/* Vuetify sets the box-sizing to inherit
causes the fraction line to not draw at all sizes (see #26) */
/* On some versions of Firefox on Windows, the line fails to
draw at some zoom levels, but setting the transform triggers
the hardware accelerated path, which works */
transform: translate(0, 0);
}
.ML__sqrt {
display: inline-block;
}
.ML__sqrt-sign {
display: inline-block;
position: relative;
}
.ML__sqrt-line {
display: inline-block;
height: max(1px, 0.04em);
width: 100%;
}
.ML__sqrt-line:before {
content: '';
display: block;
margin-top: min(-1px, -0.04em);
min-height: max(1px, 0.04em);
/* Ensure the line is visible when printing even if "turn off background images" is on*/
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
background: currentColor;
/* On some versions of Firefox on Windows, the line fails to
draw at some zoom levels, but setting the transform triggers
the hardware accelerated path, which works */
transform: translate(0, 0);
}
.ML__sqrt-line:after {
border-bottom-width: 1px;
content: ' ';
display: block;
margin-top: -0.1em;
}
.ML__sqrt-index {
margin-left: 0.27777778em;
margin-right: -0.55555556em;
}
.ML__delim-size1 {
font-family: KaTeX_Size1;
}
.ML__delim-size2 {
font-family: KaTeX_Size2;
}
.ML__delim-size3 {
font-family: KaTeX_Size3;
}
.ML__delim-size4 {
font-family: KaTeX_Size4;
}
.ML__delim-mult .delim-size1 > span {
font-family: KaTeX_Size1;
}
.ML__delim-mult .delim-size4 > span {
font-family: KaTeX_Size4;
}
.ML__accent-body > span {
font-family: KaTeX_Main;
width: 0;
}
.ML__accent-vec {
position: relative;
left: 0.24em;
}
/** The markup for a LaTeX formula, either in an editable mathfield or
in a static display.
*/
.ML__latex {
display: inline-block;
direction: ltr;
text-align: left;
text-indent: 0;
text-rendering: auto;
font-family: KaTeX_Main, 'Times New Roman', serif;
font-style: normal;
font-size-adjust: none;
font-stretch: normal;
font-variant-caps: normal;
letter-spacing: normal;
line-height: 1.2;
word-wrap: normal;
word-spacing: normal;
white-space: nowrap;
text-shadow: none;
-webkit-user-select: none;
user-select: none;
width: min-content;
}
.ML__latex .style-wrap {
position: relative;
}
.ML__latex .mfrac {
display: inline-block;
}
.ML__latex .left-right {
display: inline-block;
}
.ML__latex .vlist-t {
display: inline-table;
table-layout: fixed;
border-collapse: collapse;
}
.ML__latex .vlist-r {
display: table-row;
}
.ML__latex .vlist {
display: table-cell;
vertical-align: bottom;
position: relative;
}
.ML__latex .vlist > span {
display: block;
height: 0;
position: relative;
}
.ML__latex .vlist > span > span {
display: inline-block;
}
.ML__latex .vlist > span > .pstrut {
overflow: hidden;
width: 0;
}
.ML__latex .vlist-t2 {
margin-right: -2px;
}
.ML__latex .vlist-s {
display: table-cell;
vertical-align: bottom;
font-size: 1px;
width: 2px;
min-width: 2px;
}
.ML__latex .msubsup {
text-align: left;
}
.ML__latex .negativethinspace {
display: inline-block;
margin-left: -0.16667em;
height: 0.71em;
}
.ML__latex .thinspace {
display: inline-block;
width: 0.16667em;
height: 0.71em;
}
.ML__latex .mediumspace {
display: inline-block;
width: 0.22222em;
height: 0.71em;
}
.ML__latex .thickspace {
display: inline-block;
width: 0.27778em;
height: 0.71em;
}
.ML__latex .enspace {
display: inline-block;
width: 0.5em;
height: 0.71em;
}
.ML__latex .quad {
display: inline-block;
width: 1em;
height: 0.71em;
}
.ML__latex .qquad {
display: inline-block;
width: 2em;
height: 0.71em;
}
.ML__latex .llap,
.ML__latex .rlap {
width: 0;
position: relative;
display: inline-block;
}
.ML__latex .llap > .inner,
.ML__latex .rlap > .inner {
position: absolute;
}
.ML__latex .llap > .fix,
.ML__latex .rlap > .fix {
display: inline-block;
}
.ML__latex .llap > .inner {
right: 0;
}
.ML__latex .rlap > .inner {
left: 0;
}
.ML__latex .rule {
display: inline-block;
border: solid 0;
position: relative;
box-sizing: border-box;
}
.ML__latex .overline .overline-line,
.ML__latex .underline .underline-line {
width: 100%;
}
.ML__latex .overline .overline-line:before,
.ML__latex .underline .underline-line:before {
content: '';
border-bottom-style: solid;
border-bottom-width: max(1px, 0.04em);
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
display: block;
}
.ML__latex .overline .overline-line:after,
.ML__latex .underline .underline-line:after {
border-bottom-style: solid;
border-bottom-width: max(1px, 0.04em);
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
content: '';
display: block;
margin-top: -1px;
}
.ML__latex .stretchy {
display: block;
position: absolute;
width: 100%;
left: 0;
overflow: hidden;
}
.ML__latex .stretchy:before,
.ML__latex .stretchy:after {
content: '';
}
.ML__latex .stretchy svg {
display: block;
position: absolute;
width: 100%;
height: inherit;
fill: currentColor;
stroke: currentColor;
fill-rule: nonzero;
fill-opacity: 1;
stroke-width: 1;
stroke-linecap: butt;
stroke-linejoin: miter;
stroke-miterlimit: 4;
stroke-dasharray: none;
stroke-dashoffset: 0;
stroke-opacity: 1;
}
.ML__latex .slice-1-of-2 {
display: inline-flex;
position: absolute;
left: 0;
width: 50.2%;
overflow: hidden;
}
.ML__latex .slice-2-of-2 {
display: inline-flex;
position: absolute;
right: 0;
width: 50.2%;
overflow: hidden;
}
.ML__latex .slice-1-of-3 {
display: inline-flex;
position: absolute;
left: 0;
width: 25.1%;
overflow: hidden;
}
.ML__latex .slice-2-of-3 {
display: inline-flex;
position: absolute;
left: 25%;
width: 50%;
overflow: hidden;
}
.ML__latex .slice-3-of-3 {
display: inline-flex;
position: absolute;
right: 0;
width: 25.1%;
overflow: hidden;
}
.ML__latex .slice-1-of-1 {
display: inline-flex;
position: absolute;
width: 100%;
left: 0;
overflow: hidden;
}
.ML__latex .nulldelimiter {
display: inline-block;
}
.ML__latex .op-group {
display: inline-block;
}
.ML__latex .op-symbol {
position: relative;
}
.ML__latex .op-symbol.small-op {
font-family: KaTeX_Size1;
}
.ML__latex .op-symbol.large-op {
font-family: KaTeX_Size2;
}
.ML__latex .mtable .vertical-separator {
display: inline-block;
min-width: 1px;
box-sizing: border-box;
}
.ML__latex .mtable .arraycolsep {
display: inline-block;
}
.ML__latex .mtable .col-align-m > .vlist-t {
text-align: center;
}
.ML__latex .mtable .col-align-c > .vlist-t {
text-align: center;
}
.ML__latex .mtable .col-align-l > .vlist-t {
text-align: left;
}
.ML__latex .mtable .col-align-r > .vlist-t {
text-align: right;
}
.ML__error {
display: inline-block;
background-image: radial-gradient(ellipse at center, hsl(341, 100%, 40%), rgba(0, 0, 0, 0) 70%);
background-color: hsla(341, 100%, 40%, 0.1);
background-repeat: repeat-x;
background-size: 3px 3px;
padding-bottom: 3px;
background-position: 0 100%;
}
.ML__error > .ML__error {
background: transparent;
padding: 0;
}
.ML__placeholder {
color: var(--_placeholder-color);
opacity: var(--_placeholder-opacity);
padding-left: 0.4ex;
padding-right: 0.4ex;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}
.ML__notation {
position: absolute;
box-sizing: border-box;
line-height: 0;
}
/* This class is used to implement the \`\\mathtip\` and \`\\texttip\` commands
For UI elements, see \`[data-ML__tooltip]\`
*/
.ML__tooltip-container {
position: relative;
transform: scale(0);
}
.ML__tooltip-container .ML__tooltip-content {
position: fixed;
display: inline-table;
visibility: hidden;
z-index: 2;
width: max-content;
max-width: 400px;
padding: 12px 12px;
border-radius: 8px;
background: #616161;
--_selection-color: #fff;
color: #fff;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
opacity: 0;
transition: opacity 0.15s cubic-bezier(0.4, 0, 1, 1);
}
.ML__tooltip-container .ML__tooltip-content .ML__text {
white-space: normal;
}
.ML__tooltip-container .ML__tooltip-content .ML__base {
display: contents;
}
.ML__tooltip-container:hover .ML__tooltip-content {
visibility: visible;
opacity: 1;
font-size: 0.75em;
transform: scale(1) translate(0, 3em);
}
`,Gp=`#mathlive-environment-popover.is-visible {
visibility: visible;
}
#mathlive-environment-popover {
--_environment-panel-height: var(--environment-panel-height, 70px);
--_accent-color: var(--accent-color, #aaa);
--_background: var(--environment-panel-background, #fff);
--_button-background: var(--environment-panel-button-background, white);
--_button-background-hover: var(--environment-panel-button-background-hover, #f5f5f7);
--_button-background-active: var(--environment-panel-button-background-active, #f5f5f7);
--_button-text: var(--environment-panel-button-text, #e3e4e8);
position: absolute;
width: calc(var(--_environment-panel-height) * 2);
height: var(--_environment-panel-height);
border-radius: 4px;
border: 1.5px solid var(--_accent-color);
background-color: var(--_background);
box-shadow: 0 0 30px 0 var(--environment-shadow, rgba(0, 0, 0, 0.4));
pointer-events: all;
visibility: hidden;
}
#mathlive-environment-popover .MLEP__array-buttons {
height: calc(var(--_environment-panel-height) * 5/4);
width: calc(var(--_environment-panel-height) * 5/4);
margin-left: calc(0px - var(--_environment-panel-height) * 0.16);
margin-top: calc(0px - var(--_environment-panel-height) * 0.19);
}
#mathlive-environment-popover .MLEP__array-buttons .font {
fill: white;
}
#mathlive-environment-popover .MLEP__array-buttons circle {
fill: #7f7f7f;
transition: fill 300ms;
}
#mathlive-environment-popover .MLEP__array-buttons .MLEP__array-insert-background {
fill-opacity: 1;
fill: var(--_background);
stroke: var(--_accent-color);
stroke-width: 3px;
}
#mathlive-environment-popover .MLEP__array-buttons line {
stroke: var(--_accent-color);
stroke-opacity: 0;
stroke-width: 40;
pointer-events: none;
transition: stroke-opacity 300ms;
stroke-linecap: round;
}
#mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover circle {
fill: var(--_accent-color);
}
#mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover line {
stroke-opacity: 1;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls {
height: 100%;
width: 50%;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options {
width: var(--_environment-panel-height);
height: var(--_environment-panel-height);
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: space-around;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg {
pointer-events: all;
margin-top: 2px;
width: calc(var(--_environment-panel-height) / 3 * 28 / 24);
height: calc(var(--_environment-panel-height) / 3 - 2px);
border-radius: calc(var(--_environment-panel-height) / 25);
background-color: var(--_button-background);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg:hover {
background-color: var(--_button-background-hover);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path,
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg line {
stroke: var(--_button-text);
stroke-width: 2;
stroke-linecap: round;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg rect,
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path {
fill-opacity: 0;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active {
pointer-events: none;
background-color: var(--_button-background-active);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active path,
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active line {
stroke: var(--_accent-color);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active circle {
fill: var(--_accent-color);
}
`,hm=`/* The element that display info while in latex mode */
#mathlive-suggestion-popover {
background-color: rgba(97, 97, 97);
color: #fff;
text-align: center;
border-radius: 8px;
position: fixed;
z-index: 1;
display: none;
flex-direction: column;
justify-content: center;
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
}
#mathlive-suggestion-popover.top-tip::after {
content: '';
position: absolute;
top: -15px;
left: calc(50% - 15px);
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-bottom: 15px solid rgba(97, 97, 97);
font-size: 1rem;
}
#mathlive-suggestion-popover.bottom-tip::after {
content: '';
position: absolute;
bottom: -15px;
left: calc(50% - 15px);
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 15px solid rgba(97, 97, 97);
font-size: 1rem;
}
#mathlive-suggestion-popover.is-animated {
transition: all 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
animation: ML__fade-in cubic-bezier(0, 0, 0.2, 1) 0.15s;
}
#mathlive-suggestion-popover.is-visible {
display: flex;
}
@keyframes ML__fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
/* The wrapper class for the entire content of the popover panel */
#mathlive-suggestion-popover ul {
display: flex;
flex-flow: column;
list-style: none;
margin: 0;
padding: 0;
align-items: flex-start;
max-height: 400px;
overflow-y: auto;
}
#mathlive-suggestion-popover li {
display: flex;
flex-direction: row;
justify-content: space-between;
margin: 8px;
padding: 8px;
width: calc(100% - 16px - 16px);
column-gap: 1em;
border-radius: 8px;
cursor: pointer;
/* Since the content can be clicked on, provide feedback on hover */
}
#mathlive-suggestion-popover li a {
color: #5ea6fd;
padding-top: 0.3em;
margin-top: 0.4em;
display: block;
}
#mathlive-suggestion-popover li a:hover {
color: #5ea6fd;
text-decoration: underline;
}
#mathlive-suggestion-popover li:hover,
#mathlive-suggestion-popover li.is-pressed,
#mathlive-suggestion-popover li.is-active {
background: rgba(255, 255, 255, 0.1);
}
/* The command inside a popover (inside a #mathlive-suggestion-popover) */
.ML__popover__command {
font-size: 1.6rem;
font-family: KaTeX_Main;
}
.ML__popover__current {
background: #5ea6fd;
color: #fff;
}
.ML__popover__latex {
font-family: 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace;
align-self: center;
}
/* The keyboard shortcuts for a symbol as displayed in the popover */
.ML__popover__keybinding {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 0.8em;
opacity: 0.7;
}
/* Style for the character that joins the modifiers of a keyboard shortcut
(usually a "+" sign)*/
.ML__shortcut-join {
opacity: 0.5;
}
`,zd=`/* The element that displays the keys as the user type them */
#mathlive-keystroke-caption-panel {
visibility: hidden;
/*min-width: 160px;*/
/*background-color: rgba(97, 97, 200, .95);*/
background: var(--secondary, hsl(var(--_hue), 19%, 26%));
border-color: var(--secondary-border, hsl(0, 0%, 91%));
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
text-align: center;
border-radius: 6px;
padding: 16px;
position: absolute;
z-index: 1;
display: flex;
flex-direction: row-reverse;
justify-content: center;
--keystroke: white;
--on-keystroke: #555;
--keystroke-border: #f7f7f7;
}
@media (prefers-color-scheme: dark) {
body:not([theme='light']) #mathlive-keystroke-caption-panel {
--keystroke: hsl(var(--_hue), 50%, 30%);
--on-keystroke: hsl(0, 0%, 98%);
--keystroke-border: hsl(var(--_hue), 50%, 25%);
}
}
body[theme='dark'] #mathlive-keystroke-caption-panel {
--keystroke: hsl(var(--_hue), 50%, 30%);
--on-keystroke: hsl(0, 0%, 98%);
--keystroke-border: hsl(var(--_hue), 50%, 25%);
}
#mathlive-keystroke-caption-panel > span {
min-width: 14px;
/*height: 8px;*/
margin: 0 8px 0 0;
padding: 4px;
background-color: var(--keystroke);
color: var(--on-keystroke);
fill: currentColor;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 1em;
border-radius: 6px;
border: 2px solid var(--keystroke-border);
/*box-shadow: 0 7px 14px rgba(0,0,0,0.25), 0 5px 5px rgba(0,0,0,0.22);*/
}
`,jd=`.ML__keyboard {
--_keyboard-height: 0;
--_keyboard-zindex: var(--keyboard-zindex, 105);
--_accent-color: var(--keyboard-accent-color, #0c75d8);
--_background: var(--keyboard-background, #cacfd7);
--_border: var(--keyboard-border, #ddd);
--_padding-horizontal: var(--keyboard-padding-horizontal, 0px);
--_padding-top: var(--keyboard-padding-top, 5px);
--_padding-bottom: var(--keyboard-padding-bottom, 0px);
--_row-padding-left: var(--keyboard-row-padding-left, 0px);
--_row-padding-right: var(--keyboard-row-padding-right, 0px);
--_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f);
--_toolbar-text-active: var(--keyboard-toolbar-text-active, var(--_accent-color));
--_toolbar-background: var(--keyboard-toolbar-background, transparent);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee);
--_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent);
--_toolbar-font-size: var(--keyboard-toolbar-font-size, '135%');
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff);
--_keycap-background: var(--keycap-background, white);
--_keycap-background-hover: var(--keycap-background-hover, #f5f5f7);
--_keycap-background-active: var(--keycap-background-active, var(--_accent-color));
--_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color));
--_keycap-border: var(--keycap-border, #e5e6e9);
--_keycap-border-bottom: var(--keycap-border-bottom, #8d8f92);
--_keycap-text: var(--keycap-text, #000);
--_keycap-text-active: var(--keycap-text-active, #fff);
--_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text));
--_keycap-text-pressed: var(--keycap-text-pressed, #fff);
--_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color));
--_keycap-primary-background: var(--keycap-primary-background, var(--_accent-color));
--_keycap-primary-text: var(--keycap-primary-text, #ddd);
--_keycap-primary-background-hover: var(--keycap-primary-background-hover, #0d80f2);
--_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795);
--_keycap-secondary-text: var(--keycap-secondary-text, #060707);
--_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6);
--_keycap-height: var(--keycap-height, 60px);
/* Keycap width (incl. margin) */
--_keycap-max-width: var(--keycap-max-width, 100px);
--_keycap-gap: var(--keycap-gap, 8px);
--_keycap-font-size: var(--keycap-font-size, clamp(16px, 4cqw, 24px));
--_keycap-small-font-size: var(--keycap-small-font-size, calc(var(--keycap-font-size) * 0.8));
--_keycap-extra-small-font-size: var(--keycap-extra-small-font-size, calc(var(--keycap-font-size) / 1.42));
--_variant-panel-background: var(--variant-panel-background, #fff);
--_variant-keycap-text: var(--variant-keycap-text, var(--_keycap-text));
--_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active));
--_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color));
--_variant-keycap-length: var(--variant-keycap-length, 70px);
--_variant-keycap-font-size: var(--variant-keycap-font-size, 30px);
--_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 12px);
--_keycap-shift-font-size: var(--keycap-shift-font-size, 16px);
--_keycap-shift-color: var(--keycap-shift-color, var(--_accent-color));
--_box-placeholder-color: var(--box-placeholder-color, var(--_accent-color));
--_box-placeholder-pressed-color: var(--box-placeholder-pressed-color, var(--keycap-text-pressed));
}
.is-math-mode .MLK__rows .if-text-mode,
.is-text-mode .MLK__rows .if-math-mode {
display: none;
}
.if-can-undo,
.if-can-redo,
.if-can-copy,
.if-can-cut,
.if-can-paste {
opacity: 0.4;
pointer-events: none;
}
.can-undo .if-can-undo,
.can-redo .if-can-redo,
.can-copy .if-can-copy,
.can-cut .if-can-cut,
.can-paste .if-can-paste {
opacity: 1;
pointer-events: all;
}
body > .ML__keyboard {
position: fixed;
--_padding-bottom: calc(var(--keyboard-padding-bottom, 0px) + env(safe-area-inset-bottom, 0));
}
body > .ML__keyboard.is-visible > .MLK__backdrop {
box-shadow: 0 -5px 6px rgba(0, 0, 0, 0.08);
border-top: 1px solid var(--_border);
}
body > .ML__keyboard.backdrop-is-transparent.is-visible > .MLK__backdrop {
box-shadow: none;
border: none;
}
body > .ML__keyboard.is-visible.animate > .MLK__backdrop {
transition: 0.28s cubic-bezier(0, 0, 0.2, 1);
transition-property: transform, opacity;
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}
.ML__keyboard {
position: relative;
overflow: hidden;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: var(--_keyboard-zindex);
box-sizing: border-box;
outline: none;
border: none;
margin: 0;
padding: 0;
line-height: 1;
overflow-wrap: unset;
text-align: left;
vertical-align: baseline;
cursor: auto;
white-space: pre;
box-shadow: none;
opacity: 1;
transform: none;
pointer-events: none;
}
.ML__keyboard :where(div) {
box-sizing: border-box;
outline: none;
border: none;
margin: 0;
padding: 0;
line-height: 1;
overflow-wrap: unset;
text-align: left;
vertical-align: baseline;
cursor: auto;
white-space: pre;
box-shadow: none;
transform: none;
}
.MLK__backdrop {
position: absolute;
bottom: calc(-1 * var(--_keyboard-height));
width: 100%;
height: var(--_keyboard-height);
box-sizing: border-box;
padding-top: var(--_padding-top);
padding-bottom: var(--_padding-bottom);
padding-left: var(--_padding-horizontal);
padding-right: var(--_padding-horizontal);
opacity: 0;
visibility: hidden;
transform: translate(0, 0);
background: var(--_background);
}
.backdrop-is-transparent .MLK__backdrop {
background: transparent;
}
/* If a custom layout has a custom container/backdrop
(backdrop-is-transparent), make sure to let pointer event go through. */
.backdrop-is-transparent .MLK__plate {
background: transparent;
pointer-events: none;
}
/* If a custom layout has a custom container/backdrop, make sure to
allow pointer events on it. */
.backdrop-is-transparent .MLK__layer > div > div {
pointer-events: all;
}
.ML__keyboard.is-visible > .MLK__backdrop {
transform: translate(0, calc(-1 * var(--_keyboard-height)));
opacity: 1;
visibility: visible;
}
.caps-lock-indicator {
display: none;
width: 8px;
height: 8px;
background: #0cbc0c;
box-shadow: inset 0 0 4px 0 #13ca13, 0 0 4px 0 #a9ef48;
border-radius: 8px;
right: 8px;
top: 8px;
position: absolute;
}
.ML__keyboard.is-caps-lock .caps-lock-indicator {
display: block;
}
.ML__keyboard.is-caps-lock .shift {
background: var(--_keycap-background-active);
color: var(--_keycap-text-active);
}
.MLK__plate {
position: absolute;
top: var(--_padding-top);
left: var(--_padding-horizontal);
width: calc(100% - 2 * var(--_padding-horizontal));
margin: 0;
padding: 0;
box-sizing: border-box;
container-type: inline-size;
touch-action: none;
-webkit-user-select: none;
user-select: none;
pointer-events: all;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 16px;
/* Size of toolbar labels */
font-weight: 400;
text-shadow: none;
}
.ML__box-placeholder {
color: var(--_box-placeholder-color);
}
.MLK__tex {
font-family: KaTeX_Main, KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
}
.MLK__tex-math {
font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
font-style: italic;
}
.MLK__layer {
display: none;
outline: none;
}
.MLK__layer.is-visible {
display: flex;
flex-flow: column;
}
/* Keyboard layouts are made or rows of keys... */
.MLK__rows {
--_keycap-width: min(var(--_keycap-max-width), 10cqw);
display: flex;
flex-flow: column;
align-items: center;
border-collapse: separate;
clear: both;
border: 0;
margin: 0;
margin-bottom: var(--_keycap-gap);
gap: var(--_keycap-gap);
/* If the styling include, e.g., some shadows, they will be
cut off by the overflow. In that case, set the padding to
compensate. */
padding-left: var(--_row-padding-left);
padding-right: var(--_row-padding-right);
overflow: visible;
touch-action: none;
}
.MLK__rows > .MLK__row {
display: flex;
flex-flow: row;
justify-content: center;
width: 100%;
gap: var(--_keycap-gap);
margin: 0;
padding: 0;
/* For the alignment of the text on some modifiers (e.g. shift) */
/* Extra spacing between two adjacent keys */
}
.MLK__rows > .MLK__row .tex {
font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
}
.MLK__rows > .MLK__row .tex-math {
font-family: KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
}
.MLK__rows > .MLK__row .big-op {
font-size: calc(1.25 * var(--_keycap-font-size));
}
.MLK__rows > .MLK__row .small {
font-size: var(--_keycap-small-font-size);
}
.MLK__rows > .MLK__row .bottom {
justify-content: flex-end;
}
.MLK__rows > .MLK__row .left {
align-items: flex-start;
padding-left: 12px;
}
.MLK__rows > .MLK__row .right {
align-items: flex-end;
padding-right: 12px;
}
.MLK__rows > .MLK__row .w0 {
width: 0;
}
.MLK__rows > .MLK__row .w5 {
width: calc(0.5 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w15 {
width: calc(1.5 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w20 {
width: calc(2 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w40 {
width: calc(4 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w50 {
width: calc(5 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .MLK__keycap.w50 {
font-size: 80%;
padding-top: 10px;
font-weight: 100;
}
.MLK__rows > .MLK__row .separator {
background: transparent;
border: none;
pointer-events: none;
}
.MLK__rows > .MLK__row .horizontal-rule {
height: 6px;
margin-top: 3px;
margin-bottom: 0;
width: 100%;
border-radius: 0;
border-top: var(--_horizontal-rule);
}
.MLK__rows > .MLK__row .ghost {
background: var(--_toolbar-background);
border: none;
color: var(--_toolbar-text);
}
.MLK__rows > .MLK__row .ghost:hover {
background: var(--_toolbar-background-hover);
}
.MLK__rows > .MLK__row .bigfnbutton {
font-size: var(--_keycap-extra-small-font-size);
}
.MLK__rows > .MLK__row .shift,
.MLK__rows > .MLK__row .action {
color: var(--_keycap-secondary-text);
background: var(--_keycap-secondary-background);
border-color: var(--_keycap-secondary-border);
border-bottom-color: var(--_keycap-secondary-border-bottom);
line-height: 0.8;
font-size: min(1rem, var(--_keycap-small-font-size));
font-weight: 600;
padding: 8px 12px 8px 12px;
}
.MLK__rows > .MLK__row .shift:hover,
.MLK__rows > .MLK__row .action:hover {
background: var(--_keycap-secondary-background-hover);
}
.MLK__rows > .MLK__row .action.primary {
background: var(--_keycap-primary-background);
color: var(--_keycap-primary-text);
}
.MLK__rows > .MLK__row .action.primary:hover {
background: var(--_keycap-primary-background-hover);
color: var(--_keycap-primary-text);
}
.MLK__rows > .MLK__row .shift.selected,
.MLK__rows > .MLK__row .action.selected {
color: var(--_toolbar-text-active);
}
.MLK__rows > .MLK__row .shift.selected.is-pressed,
.MLK__rows > .MLK__row .action.selected.is-pressed,
.MLK__rows > .MLK__row .shift.selected.is-active,
.MLK__rows > .MLK__row .action.selected.is-active {
color: white;
}
.MLK__rows > .MLK__row .warning {
background: #cd0030;
color: white;
}
.MLK__rows > .MLK__row .warning svg.svg-glyph {
width: 24px;
height: 24px;
min-height: 24px;
}
/** A regular keycap
* Use the :where() pseudo-class to give it a very low specifity,
* so that it can be overriden by custom style.
*/
:where(.MLK__rows > .MLK__row div) {
display: flex;
flex-flow: column;
align-items: center;
justify-content: space-evenly;
width: calc(var(--_keycap-width) - var(--_keycap-gap));
height: var(--_keycap-height);
box-sizing: border-box;
padding: 0;
vertical-align: top;
text-align: center;
float: left;
color: var(--_keycap-text);
fill: currentColor;
font-size: var(--_keycap-font-size);
background: var(--_keycap-background);
border: 1px solid var(--_keycap-border);
border-bottom-color: var(--_keycap-border-bottom);
border-radius: 6px;
cursor: pointer;
touch-action: none;
/* Keys with a variants panel */
position: relative;
overflow: hidden;
-webkit-user-select: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
:where(.MLK__rows > .MLK__row div):hover {
overflow: visible;
background: var(--_keycap-background-hover);
}
:where(.MLK__rows > .MLK__row div) .ML__latex {
pointer-events: none;
touch-action: none;
}
:where(.MLK__rows > .MLK__row div) svg.svg-glyph {
margin: 8px 0;
width: 20px;
height: 20px;
min-height: 20px;
}
:where(.MLK__rows > .MLK__row div) svg.svg-glyph-lg {
margin: 8px 0;
width: 24px;
height: 24px;
min-height: 24px;
}
:where(.MLK__rows > .MLK__row div).MLK__tex-math {
font-size: 25px;
}
:where(.MLK__rows > .MLK__row div).is-pressed {
background: var(--_keycap-background-pressed);
color: var(--_keycap-text-pressed);
--_box-placeholder-color: var(--_box-placeholder-pressed-color);
}
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active,
:where(.MLK__rows > .MLK__row div).action.is-active,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed,
:where(.MLK__rows > .MLK__row div).action.is-pressed {
z-index: calc(var(--_keyboard-zindex) - 5);
}
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active aside,
:where(.MLK__rows > .MLK__row div).action.is-active aside,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed aside,
:where(.MLK__rows > .MLK__row div).action.is-pressed aside {
display: none;
}
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active .MLK__shift,
:where(.MLK__rows > .MLK__row div).action.is-active .MLK__shift,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed .MLK__shift,
:where(.MLK__rows > .MLK__row div).action.is-pressed .MLK__shift {
display: none;
}
:where(.MLK__rows > .MLK__row div).shift.is-pressed,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed,
:where(.MLK__rows > .MLK__row div).action.is-pressed {
background: var(--_keycap-background-pressed);
color: var(--_keycap-text-pressed);
}
:where(.MLK__rows > .MLK__row div).shift.is-active,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active,
:where(.MLK__rows > .MLK__row div).action.is-active {
background: var(--_keycap-background-active);
color: var(--_keycap-text-active);
--_box-placeholder-color: var(--_box-placeholder-pressed-color);
}
:where(.MLK__rows > .MLK__row div) small {
color: var(--_keycap-secondary-text);
}
:where(.MLK__rows > .MLK__row div) aside {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 10px;
line-height: 10px;
color: var(--_keycap-secondary-text);
}
/* Add an attribute 'data-tooltip' to display a tooltip on hover.
Note there are a different set of tooltip rules for the keyboard toggle
(it's in a different CSS tree) */
.ML__keyboard [data-tooltip] {
position: relative;
}
.ML__keyboard [data-tooltip]::after {
position: absolute;
display: inline-table;
content: attr(data-tooltip);
top: inherit;
bottom: 100%;
width: max-content;
max-width: 200px;
padding: 8px 8px;
background: #616161;
color: #fff;
text-align: center;
z-index: 2;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
border-radius: 2px;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-weight: 400;
font-size: 12px;
transition: all 0.15s cubic-bezier(0.4, 0, 1, 1) 1s;
opacity: 0;
transform: scale(0.5);
}
.ML__keyboard [data-tooltip]:hover {
position: relative;
}
.ML__keyboard [data-tooltip]:hover::after {
opacity: 1;
transform: scale(1);
}
.MLK__toolbar {
align-self: center;
display: flex;
flex-flow: row;
justify-content: space-between;
width: 100%;
max-width: 996px;
min-height: 32px;
/* Icons for undo/redo, etc. */
}
.MLK__toolbar svg {
height: 20px;
width: 20px;
}
.MLK__toolbar > .left {
position: relative;
display: flex;
justify-content: flex-start;
flex-flow: row;
}
.MLK__toolbar > .right {
display: flex;
justify-content: flex-end;
flex-flow: row;
}
.MLK__toolbar > div > div {
/* "button" in the toolbar */
display: flex;
align-items: center;
justify-content: center;
color: var(--_toolbar-text);
fill: currentColor;
background: var(--_toolbar-background);
font-size: var(--_toolbar-font-size);
padding: 4px 15px;
cursor: pointer;
width: max-content;
min-width: 42px;
min-height: 34px;
border: none;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 8px;
padding-top: 8px;
margin-top: 0;
margin-bottom: 4px;
margin-left: 4px;
margin-right: 4px;
border-radius: 8px;
box-shadow: none;
border-bottom: 2px solid transparent;
}
.MLK__toolbar > div > div:not(.disabled):not(.selected):hover {
background: var(--_toolbar-background-hover);
}
.MLK__toolbar > div > div.disabled svg,
.MLK__toolbar > div > div.disabled:hover svg,
.MLK__toolbar > div > div.disabled.is-pressed svg {
color: var(--_toolbar-text);
opacity: 0.2;
}
.MLK__toolbar > div > div:hover,
.MLK__toolbar > div > div:active,
.MLK__toolbar > div > div.is-pressed,
.MLK__toolbar > div > div.is-active {
color: var(--_toolbar-text-active);
}
.MLK__toolbar > div > div.selected {
color: var(--_toolbar-text-active);
background: var(--_toolbar-background-selected);
border-radius: 0;
border-bottom-color: var(--_toolbar-text-active);
padding-bottom: 4px;
margin-bottom: 8px;
}
/* This is the element that displays variants on press+hold */
.MLK__variant-panel {
visibility: hidden;
position: fixed;
display: flex;
flex-flow: row wrap-reverse;
justify-content: center;
align-content: center;
margin: 0;
padding: 0;
bottom: auto;
top: 0;
box-sizing: content-box;
transform: none;
z-index: calc(var(--_keyboard-zindex) + 1);
touch-action: none;
max-width: 350px;
background: var(--_variant-panel-background);
text-align: center;
border-radius: 6px;
padding: 6px;
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
transition: none;
}
.MLK__variant-panel.is-visible {
visibility: visible;
}
.MLK__variant-panel.compact {
--_variant-keycap-length: var(--variant-keycap-length, 50px);
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
--_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 10px);
}
.MLK__variant-panel .item {
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
font-size: var(--_variant-keycap-font-size);
height: var(--_variant-keycap-length);
width: var(--_variant-keycap-length);
margin: 0;
box-sizing: border-box;
border-radius: 5px;
border: 1px solid transparent;
background: transparent;
pointer-events: all;
cursor: pointer;
color: var(--_variant-keycap-text);
fill: currentColor;
}
@media (max-height: 412px) {
.MLK__variant-panel .item {
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
--_variant-keycap-length: var(--variant-keycap-length, 50px);
}
}
.MLK__variant-panel .item .ML__latex {
pointer-events: none;
}
.MLK__variant-panel .item.is-active {
background: var(--_variant-keycap-background-active);
color: var(--_variant-keycap-text-active);
}
.MLK__variant-panel .item.is-pressed {
background: var(--_variant-keycap-background-pressed);
color: var(--_variant-keycap-text-pressed);
}
.MLK__variant-panel .item.small {
font-size: var(--_keycap-small-font-size);
}
.MLK__variant-panel .item.swatch-button {
box-sizing: border-box;
background: #fbfbfb;
}
.MLK__variant-panel .item.swatch-button > span {
display: inline-block;
margin: 6px;
width: calc(100% - 12px);
height: calc(100% - 12px);
border-radius: 50%;
}
.MLK__variant-panel .item.swatch-button:hover {
background: #f0f0f0;
}
.MLK__variant-panel .item.swatch-button:hover > span {
border-radius: 2px;
}
.MLK__variant-panel .item.box > div,
.MLK__variant-panel .item.box > span {
border: 1px dashed rgba(0, 0, 0, 0.24);
}
.MLK__variant-panel .item .warning {
min-height: 60px;
min-width: 60px;
background: #cd0030;
color: white;
padding: 5px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 5px;
}
.MLK__variant-panel .item .warning.is-pressed,
.MLK__variant-panel .item .warning.is-active {
background: red;
}
.MLK__variant-panel .item .warning svg.svg-glyph {
width: 50px;
height: 50px;
}
.MLK__variant-panel .item aside {
font-size: var(--_variant-keycap-aside-font-size);
line-height: 12px;
opacity: 0.78;
padding-top: 2px;
}
.MLK__keycap {
position: relative;
}
.MLK__shift {
display: block;
position: absolute;
right: 4px;
top: 4px;
font-size: var(--_keycap-shift-font-size);
color: var(--_keycap-shift-color);
}
.hide-shift .MLK__shift {
display: none;
}
@media (max-width: 414px) {
.MLK__variant-panel {
max-width: 350px;
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
--_variant-keycap-length: var(--variant-keycap-length, 50px);
}
}
/* @xs breakpoint: iPhone 5 */
@container (max-width: 414px) {
.MLK__rows {
--_keycap-gap: max(var(--_keycap-gap, 2px), 2px);
--_keycap-height: max(var(--_keycap-height), 42px);
--_keycap-width: min(min(var(--_keycap-max-width), 10cqw), 62px);
}
.MLK__toolbar > div > div {
font-size: 100%;
margin-left: 2px;
margin-right: 2px;
}
.MLK__rows .shift,
.MLK__rows .action {
font-size: 65%;
}
.MLK__rows .warning svg.svg-glyph {
width: 14px;
height: 14px;
min-height: 14px;
}
}
@container (max-width: 744px) {
.MLK__rows {
--_keycap-gap: max(var(--keycap-gap, 2px), 2px);
--_keycap-height: max(var(--keycap-height, 52px), 52px);
--_keycap-width: min(min(var(--_keycap-max-width), 10cqw), 62px);
}
.MLK__toolbar > div > div {
padding-left: 0;
padding-right: 0;
}
.MLK__tooltip::after {
padding: 8px 16px;
font-size: 16px;
}
.MLK__rows > .MLK__row > div.fnbutton {
font-size: 16px;
}
.MLK__rows > .MLK__row > div.bigfnbutton {
font-size: calc(var(--_keycap-extra-small-font-size) / 1.55);
}
.MLK__rows > .MLK__row > div.small {
font-size: 13px;
}
.MLK__rows > .MLK__row > div > aside {
display: none;
}
.MLK__shift {
display: none;
}
}
/* Medium breakpoint: larger phones */
@container (max-width: 768px) {
.MLK__rows {
--_keycap-height: max(var(--keycap-height, 42px), 42px);
}
.MLK__rows > .MLK__row > div > small {
font-size: 14px;
}
}
@media (max-height: 768px) {
.MLK__rows {
--_keycap-height: max(var(--keycap-height, 42px), 42px);
}
.MLK__rows > .MLK__row > div > small {
font-size: 14px;
}
}
@container (max-width: 1444px) {
.MLK__rows .if-wide {
display: none;
}
}
@media (prefers-color-scheme: dark) {
.ML__keyboard {
--_accent-color: var(--keyboard-accent-color, #0b5c9c);
--_background: var(--keyboard-background, #151515);
--_border: var(--keyboard-border, transparent);
--_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030);
--keyboard-toolbar-background-hover: #303030;
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030);
--_keycap-background: var(--keycap-background, #1f2022);
--_keycap-background-hover: var(--keycap-background-hover, #2f3032);
--_keycap-border: var(--_keycap-border, transparent);
--_keycap-border-bottom: var(--_keycap-border-bottom, transparent);
--_keycap-text: var(--keycap-text, #e3e4e8);
--_keycap-secondary-background: var(--keycap-secondary-background, #3d4144);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154);
--_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee);
--keycap-secondary-border: transparent;
--keycap-secondary-border-bottom: transparent;
--_keycap-secondary-border: var(--keycap-secondary-border, transparent);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent);
--_variant-panel-background: var(--variant-panel-background, #303030);
--_variant-keycap-text-active: var(--variant-keycap-text-active, #fff);
}
}
/* Same as the media query, but with a class */
[theme='dark'] .ML__keyboard {
--_accent-color: var(--keyboard-accent-color, #0b5c9c);
--_background: var(--keyboard-background, #151515);
--_border: var(--keyboard-border, transparent);
--_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030);
--keyboard-toolbar-background-hover: #303030;
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030);
--_keycap-background: var(--keycap-background, #1f2022);
--_keycap-background-hover: var(--keycap-background-hover, #2f3032);
--_keycap-border: var(--_keycap-border, transparent);
--_keycap-border-bottom: var(--_keycap-border-bottom, transparent);
--_keycap-text: var(--keycap-text, #e3e4e8);
--_keycap-secondary-background: var(--keycap-secondary-background, #3d4144);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154);
--_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee);
--keycap-secondary-border: transparent;
--keycap-secondary-border-bottom: transparent;
--_keycap-secondary-border: var(--keycap-secondary-border, transparent);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent);
--_variant-panel-background: var(--variant-panel-background, #303030);
--_variant-keycap-text-active: var(--variant-keycap-text-active, #fff);
}
[theme='light'] .ML__keyboard {
--_accent-color: var(--keyboard-accent-color, #0c75d8);
--_background: var(--keyboard-background, #cacfd7);
--_border: var(--keyboard-border, #ddd);
--_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f);
--_toolbar-background: var(--keyboard-toolbar-background, transparent);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee);
--_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent);
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff);
--_keycap-background: var(--keycap-background, white);
--_keycap-background-hover: var(--keycap-background-hover, #f5f5f7);
--_keycap-background-active: var(--keycap-background-active, var(--_accent-color));
--_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color));
--_keycap-border: var(--_keycap-border, #e5e6e9);
--_keycap-border-bottom: var(--_keycap-border-bottom, #8d8f92);
--_keycap-text: var(--keycap-text, #000);
--_keycap-text-active: var(--keycap-text-active, #fff);
--_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text));
--_keycap-text-pressed: var(--keycap-text-pressed, #fff);
--_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color));
--_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795);
--_keycap-secondary-text: var(--keycap-secondary-text, #060707);
--_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6);
--_variant-panel-background: var(--variant-panel-background, #fff);
--_variant-keycap-text: var(--variant-keycap-textvar, var(--_keycap-text));
--_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active));
--_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color));
}
`,Gf=`:host {
--primary-color: #5898ff;
--primary-color-dimmed: #c0c0f0;
--primary-color-dark: var(--blue-500);
--primary-color-light: var(--blue-100);
--primary-color-reverse: #ffffff;
--secondary-color: #ff8a65;
--secondary-color-dimmed: #f0d5c5;
--secondary-color-dark: var(--orange-500);
--secondary-color-light: var(--orange-100);
--secondary-color-reverse: #ffffff;
--link-color: #5898ff;
--link-color-dimmed: #c5c5c5;
--link-color-dark: #121212;
--link-color-light: #e2e2e2;
--link-color-reverse: #ffffff;
--semantic-blue: var(--blue-700);
--semantic-red: var(--red-400);
--semantic-orange: var(--orange-400);
--semantic-green: var(--green-700);
--neutral-100: #f5f5f5;
--neutral-200: #eeeeee;
--neutral-300: #e0e0e0;
--neutral-400: #bdbdbd;
--neutral-500: #9e9e9e;
--neutral-600: #757575;
--neutral-700: #616161;
--neutral-800: #424242;
--neutral-900: #212121;
--red-25: #fff8f7;
--red-50: #fff1ef;
--red-100: #ffeae6;
--red-200: #ffcac1;
--red-300: #ffa495;
--red-400: #ff7865;
--red-500: #f21c0d;
--red-600: #e50018;
--red-700: #d30024;
--red-800: #bd002c;
--red-900: #a1002f;
--orange-25: #fffbf8;
--orange-50: #fff7f1;
--orange-100: #fff3ea;
--orange-200: #ffe1c9;
--orange-300: #ffcca2;
--orange-400: #ffb677;
--orange-500: #fe9310;
--orange-600: #f58700;
--orange-700: #ea7c00;
--orange-800: #dc6d00;
--orange-900: #ca5b00;
--brown-25: #fff8ef;
--brown-50: #fff1df;
--brown-100: #ffe9ce;
--brown-200: #ebcca6;
--brown-300: #cdaf8a;
--brown-400: #af936f;
--brown-500: #856a47;
--brown-600: #7f5e34;
--brown-700: #78511f;
--brown-800: #6e4200;
--brown-900: #593200;
--yellow-25: #fffdf9;
--yellow-50: #fffcf2;
--yellow-100: #fffaec;
--yellow-200: #fff2ce;
--yellow-300: #ffe8ab;
--yellow-400: #ffdf85;
--yellow-500: #ffcf33;
--yellow-600: #f1c000;
--yellow-700: #dfb200;
--yellow-800: #c9a000;
--yellow-900: #ad8a00;
--lime-25: #f4ffee;
--lime-50: #e9ffdd;
--lime-100: #ddffca;
--lime-200: #a8fb6f;
--lime-300: #94e659;
--lime-400: #80d142;
--lime-500: #63b215;
--lime-600: #45a000;
--lime-700: #268e00;
--lime-800: #007417;
--lime-900: #005321;
--green-25: #f5fff5;
--green-50: #ebffea;
--green-100: #e0ffdf;
--green-200: #a7ffa7;
--green-300: #5afa65;
--green-400: #45e953;
--green-500: #17cf36;
--green-600: #00b944;
--green-700: #00a34a;
--green-800: #008749;
--green-900: #00653e;
--teal-25: #f3ffff;
--teal-50: #e6fffe;
--teal-100: #d9fffe;
--teal-200: #8dfffe;
--teal-300: #57f4f4;
--teal-400: #43e5e5;
--teal-500: #17cfcf;
--teal-600: #00c2c0;
--teal-700: #00b5b1;
--teal-800: #00a49e;
--teal-900: #009087;
--cyan-25: #f7fcff;
--cyan-50: #eff8ff;
--cyan-100: #e7f5ff;
--cyan-200: #c2e6ff;
--cyan-300: #95d5ff;
--cyan-400: #61c4ff;
--cyan-500: #13a7ec;
--cyan-600: #069eda;
--cyan-700: #0095c9;
--cyan-800: #0088b2;
--cyan-900: #0a7897;
--blue-25: #f7faff;
--blue-50: #eef5ff;
--blue-100: #e5f1ff;
--blue-200: #bfdbff;
--blue-300: #92c2ff;
--blue-400: #63a8ff;
--blue-500: #0d80f2;
--blue-600: #0077db;
--blue-700: #006dc4;
--blue-800: #0060a7;
--blue-900: #005086;
--indigo-25: #f8f7ff;
--indigo-50: #f1efff;
--indigo-100: #eae7ff;
--indigo-200: #ccc3ff;
--indigo-300: #ac99ff;
--indigo-400: #916aff;
--indigo-500: #63c;
--indigo-600: #5a21b2;
--indigo-700: #4e0b99;
--indigo-800: #3b0071;
--indigo-900: #220040;
--purple-25: #fbf7ff;
--purple-50: #f8f0ff;
--purple-100: #f4e8ff;
--purple-200: #e4c4ff;
--purple-300: #d49aff;
--purple-400: #c36aff;
--purple-500: #a219e6;
--purple-600: #9000c4;
--purple-700: #7c009f;
--purple-800: #600073;
--purple-900: #3d0043;
--magenta-25: #fff8fb;
--magenta-50: #fff2f6;
--magenta-100: #ffebf2;
--magenta-200: #ffcddf;
--magenta-300: #ffa8cb;
--magenta-400: #ff7fb7;
--magenta-500: #eb4799;
--magenta-600: #da3689;
--magenta-700: #c82179;
--magenta-800: #b00065;
--magenta-900: #8a004c;
}
@media (prefers-color-scheme: dark) {
:host {
--semantic-blue: var(--blue-700);
--semantic-red: var(--red-400);
--semantic-orange: var(--orange-400);
--semantic-green: var(--green-700);
--semantic-bg-blue: var(--blue-25);
--semantic-bg-red: var(--red-25);
--semantic-bg-orange: var(--orange-25);
--semantic-bg-green: var(--green-25);
--neutral-100: #121212;
--neutral-200: #424242;
--neutral-300: #616161;
--neutral-400: #757575;
--neutral-500: #9e9e9e;
--neutral-600: #bdbdbd;
--neutral-700: #e0e0e0;
--neutral-800: #eeeeee;
--neutral-900: #f5f5f5;
}
}
:host([theme='dark']) {
--semantic-blue: var(--blue-700);
--semantic-red: var(--red-400);
--semantic-orange: var(--orange-400);
--semantic-green: var(--green-700);
--semantic-bg-blue: var(--blue-25);
--semantic-bg-red: var(--red-25);
--semantic-bg-orange: var(--orange-25);
--semantic-bg-green: var(--green-25);
--neutral-100: #121212;
--neutral-200: #424242;
--neutral-300: #616161;
--neutral-400: #757575;
--neutral-500: #9e9e9e;
--neutral-600: #bdbdbd;
--neutral-700: #e0e0e0;
--neutral-800: #eeeeee;
--neutral-900: #f5f5f5;
}
/* @media (prefers-color-scheme: dark) {
:host {
--label-color: #fff;
--active-label-color: #000;
--menu-bg: #525252;
--active-bg: #5898ff;
--active-bg-dimmed: #5c5c5c;
}
} */
:host {
--ui-font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont,
'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol';
--ui-font-size: 14px;
--ui-line-height: 1.5;
--ui-letter-spacing: 0.007em;
--mono-font-family: 'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono',
'Source Code Pro', Menlo, Monaco, 'Courier New', monospace;
--ui-layer-1: var(--neutral-100);
--ui-layer-2: var(--neutral-200);
--ui-layer-3: var(--neutral-300);
--ui-layer-4: var(--neutral-400);
--ui-layer-5: var(--neutral-500);
--ui-layer-6: var(--neutral-600);
--ui-border-color: var(--primary-color);
--ui-border-radius: 4px;
--ui-text: var(--neutral-900);
--ui-text-secondary: var(--neutral-700);
--ui-text-placeholder: var(--neutral-500);
--ui-text-muted: var(--neutral-300);
/** A field is a UI element in which a user can type data, for
* example an input or textarea element.
*/
--ui-field-bg: var(--neutral-100);
--ui-field-bg-hover: var(--neutral-100);
--ui-field-bg-disabled: var(--neutral-300);
--ui-field-bg-invalid: var(--red-100);
--ui-field-bg-focus: var(--neutral-100);
--ui-field-border: 0.5px solid var(--border-color);
--ui-field-border-hover: 0.5px solid var(--border-color);
--ui-field-border-disabled: 0.5px solid var(--border-color);
--ui-field-border-invalid: 0.5px solid var(--border-color);
--ui-field-border-focus: 0.5px solid var(--border-color);
--ui-menu-bg: var(--neutral-100);
--ui-menu-text: var(--neutral-900);
--ui-menu-bg-hover: var(--neutral-200);
--ui-menu-text-hover: var(--neutral-900);
/** The \`active\` state is used for the state of menu items
* when they are selected.
*/
--ui-menu-bg-active: var(--primary-color);
--ui-menu-text-active: var(--primary-color-reverse);
/** The \`active-muted\` set is used for the state of
* submenus when they are open.
*/
--ui-menu-bg-active-muted: var(--neutral-300);
--ui-menu-text-active-muted: var(--neutral-900);
/* --ui-menu-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.302),
0 2px 6px 2px rgba(60, 64, 67, 0.149); */
--ui-menu-shadow: 0 0 2px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.2);
--ui-menu-divider: 0.5px solid #c7c7c7;
/* var(--neutral-300); */
--ui-menu-z-index: 10000;
--page-bg: var(--neutral-100);
--content-bg: var(--neutral-200);
}
@media (prefers-color-scheme: dark) {
:host {
--ui-menu-bg: var(--neutral-200);
}
}
:host([theme='dark']) {
--ui-menu-bg: var(--neutral-200);
}
/* PingFang SC is a macOS font. Microsoft Yahei is a Windows font.
Noto is a Linux/Android font.
*/
:lang(zh-cn),
:lang(zh-sg),
:lang(zh-my),
:lang(zh) {
--ui-font-family: -apple-system, system-ui, 'PingFang SC', 'Hiragino Sans GB',
'Noto Sans CJK SC', 'Noto Sans SC', 'Noto Sans', 'Microsoft Yahei UI',
'Microsoft YaHei New', 'Microsoft Yahei', '\u5FAE\u8F6F\u96C5\u9ED1', SimSun, '\u5B8B\u4F53',
STXihei, '\u534E\u6587\u7EC6\u9ED1', sans-serif;
}
:lang(zh-tw),
:lang(zh-hk),
:lang(zh-mo) {
--ui-font-family: -apple-system, system-ui, 'Noto Sans',
'Microsoft JhengHei UI', 'Microsoft JhengHei', '\u5FAE\u8EDF\u6B63\u9ED1\u9AD4', '\u65B0\u7D30\u660E\u9AD4',
'PMingLiU', '\u7D30\u660E\u9AD4', 'MingLiU', sans-serif;
}
:lang(ja),
:lang(ja-jp),
:lang(ja-jp-mac) {
--ui-font-family: -apple-system, system-ui, 'Hiragino Sans',
'Hiragino Kaku Gothic ProN', 'Noto Sans CJK JP', 'Noto Sans JP', 'Noto Sans',
'\u6E38\u30B4\u30B7\u30C3\u30AF', '\u6E38\u30B4\u30B7\u30C3\u30AF\u4F53', YuGothic, 'Yu Gothic', '\u30E1\u30A4\u30EA\u30AA', Meiryo,
'\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF', 'MS PGothic', sans-serif;
}
:lang(ko),
:lang(ko-kr),
:lang(ko-kr-std) {
--ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR',
'Noto Sans', 'Malgun Gothic', '\uB9D1\uC740 \uACE0\uB515', 'Apple SD Gothic Neo',
'\uC560\uD50C SD \uC0B0\uB3CC\uACE0\uB515 Neo', 'Apple SD \uC0B0\uB3CC\uACE0\uB515 Neo', '\uB3CB\uC6C0', Dotum, sans-serif;
}
:lang(ko-kr-apple) {
--ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR',
'Noto Sans', 'Apple SD Gothic Neo', '\uC560\uD50C SD \uC0B0\uB3CC\uACE0\uB515 Neo',
'Apple SD \uC0B0\uB3CC\uACE0\uB515 Neo', '\uB3CB\uC6C0', Dotum, sans-serif;
}
:lang(zh-cn),
:lang(zh-sg),
:lang(zh-my),
:lang(zh),
:lang(zh-tw),
:lang(zh-hk),
:lang(zh-mo),
:lang(ja),
:lang(ja-jp),
:lang(ja-jp-mac),
:lang(ko),
:lang(ko-kr),
:lang(ko-kr-std),
:lang(ko-kr-apple) {
--ui-font-size: 1rem;
--ui-line-height: 1.7;
--ui-letter-spacing: 0;
}
:dir(rtl) {
--ui-line-height: auto;
--ui-letter-spacing: 0;
}
`,bg=`.ui-menu *,
.ui-menu ::before,
.ui-menu ::after {
box-sizing: border-box;
}
.ui-menu {
display: none;
color-scheme: light dark;
-webkit-user-select: none;
/* Important: Safari iOS doesn't respect user-select */
user-select: none;
cursor: default;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0 0 0 0);
--active-label-color: #fff;
/* ui-menu-text-active */
--label-color: #121212;
/* ui-menu-text */
--menu-bg: #e2e2e2;
/* ui-menu-background */
--active-bg: #5898ff;
/* ui-menu-background-active */
--active-bg-dimmed: #c5c5c5;
/* ui-menu-background-active-muted */
}
/** Use the :where pseudo selector to make the specificity of the
* selector 0, so that it can be overridden by the user.
*/
:where(.ui-menu-container) {
position: absolute;
overflow: visible;
width: auto;
height: auto;
z-index: 10000;
border-radius: 8px;
background: var(--ui-menu-bg);
box-shadow: var(--ui-menu-shadow);
list-style: none;
padding: 6px 0 6px 0;
margin: 0;
user-select: none;
cursor: default;
color: var(--ui-menu-text);
font-weight: normal;
font-style: normal;
text-shadow: none;
text-transform: none;
letter-spacing: 0;
outline: none;
opacity: 1;
/* The [popover] elements have a 1px solid black border. Ugh. */
border: none;
width: fit-content;
height: fit-content;
}
:where(.ui-menu-container > li) {
display: flex;
flex-flow: row;
align-items: center;
padding: 1px 7px 1px 7px;
margin-top: 0;
margin-left: 6px;
margin-right: 6px;
border-radius: 4px;
white-space: nowrap;
position: relative;
outline: none;
fill: currentColor;
user-select: none;
cursor: default;
text-align: left;
color: inherit;
font-family: var(--ui-font-family);
font-size: var(--ui-font-size);
line-height: var(--ui-line-height);
letter-spacing: var(--ui-letter-spacing);
}
:where(.ui-menu-container > li > .label) {
appearance: none;
background: none;
outline: none;
width: 100%;
margin: 0;
padding: 1px 2px 1px 1px;
overflow: visible;
border: 1px solid transparent;
white-space: nowrap;
text-align: start;
}
:where(.ui-menu-container > li:has(.heading)) {
margin-top: 0.5em;
}
:where(.ui-menu-container > li > .label.heading) {
font-weight: bold;
opacity: 0.4;
}
:where(.ui-menu-container > li.indent > .label) {
margin-inline-start: 12px;
}
:where(.ui-menu-container > li > .label.indent) {
margin-inline-start: 12px;
}
:where(.ui-menu-container > li[role='divider']) {
border-bottom: 1px solid var(--ui-menu-divider);
border-radius: 0;
padding: 0;
margin-left: 15px;
margin-right: 15px;
padding-top: 5px;
margin-bottom: 5px;
width: calc(100% - 30px);
/** 100% - (margin-left + margin-right) */
}
:where(.ui-menu-container > li[aria-disabled='true']) {
opacity: 0.5;
}
:where(.ui-menu-container > li.active) {
background: var(--ui-menu-bg-active);
background: -apple-system-control-accent;
color: var(--ui-menu-text-active);
}
:where(.ui-menu-container > li.active.is-submenu-open) {
background: var(--ui-menu-bg-active-muted);
color: inherit;
}
:where(.ui-menu-container > li[aria-haspopup='true'] > .label) {
padding-inline-end: 0;
}
:where(.ui-menu-container > li[aria-haspopup='true'].active::after) {
color: var(--ui-menu-text-active);
}
/** Keyboard shortcut */
:where(.ui-menu-container > li > kbd) {
font-family: var(--ui-font-family);
margin-inline-start: 12px;
opacity: 0.4;
}
:where(.ui-menu-container > li.active > kbd) {
opacity: 0.85;
}
.ui-trailing-chevron {
display: flex;
margin-inline-start: 24px;
width: 10px;
height: 10px;
margin-bottom: 4px;
}
.ui-trailing-chevron:dir(rtl) {
transform: scaleX(-1);
}
.ui-checkmark {
display: flex;
margin-inline-end: -11px;
margin-inline-start: -4px;
margin-top: 2px;
width: 16px;
height: 16px;
}
.ui-mixedmark {
display: flex;
margin-inline-end: -11px;
margin-inline-start: -4px;
margin-top: 2px;
width: 16px;
height: 16px;
}
`,Ro;function xc(r){let o="";switch(r){case"mathfield-element":o=`
:host { display: inline-block; background-color: field; color: fieldtext; border-width: 1px; border-style: solid; border-color: #acacac; border-radius: 2px; padding:4px;}
:host([hidden]) { display: none; }
:host([disabled]), :host([disabled]:focus), :host([disabled]:focus-within) { outline: none; opacity: .5; }
:host(:focus), :host(:focus-within) {
outline: Highlight auto 1px; /* For Firefox */
outline: -webkit-focus-ring-color auto 1px;
}
:host([readonly]:focus), :host([readonly]:focus-within),
:host([read-only]:focus), :host([read-only]:focus-within) {
outline: none;
}
@media (hover: none) and (pointer: coarse) {
:host(:not(:focus)) :first-child { pointer-events: none !important; }
}`;break;case"core":o=go;break;case"mathfield":o=yc;break;case"environment-popover":o=Gp;break;case"suggestion-popover":o=hm;break;case"keystroke-caption":o=zd;break;case"virtual-keyboard":o=jd;break;case"ui":o=Gf;break;case"menu":o=bg;break;default:debugger}return o}function Lu(r){return Ro||(Ro={}),Ro[r]||(Ro[r]=new CSSStyleSheet,Ro[r].replaceSync(xc(r))),Ro[r]}var Ra;function Hl(r){var o;if(!("adoptedStyleSheets"in document)){if(window.document.getElementById(`mathlive-style-${r}`))return;const u=window.document.createElement("style");u.id=`mathlive-style-${r}`,u.append(window.document.createTextNode(xc(r))),window.document.head.appendChild(u);return}if(Ra||(Ra={}),((o=Ra[r])!=null?o:0)!==0)Ra[r]+=1;else{const u=Lu(r);document.adoptedStyleSheets=[...document.adoptedStyleSheets,u],Ra[r]=1}}function h(r){if("adoptedStyleSheets"in document&&Ra!=null&&Ra[r]&&(Ra[r]-=1,Ra[r]<=0)){const o=Ro[r];document.adoptedStyleSheets=document.adoptedStyleSheets.filter(u=>u!==o)}}var p=class u2 extends oi{constructor(o){var u;super(rt(Q({},o),{type:"accent",body:(u=o.body)!=null?u:void 0})),o.accentChar?this.accent=o.accentChar:this.svgAccent=o==null?void 0:o.svgAccent,this.skipBoundary=!0,this.captureSelection=!0}static fromJson(o){return new u2(o)}toJson(){return rt(Q({},super.toJson()),{accentChar:this.accent,svgAccent:this.svgAccent})}render(o){var u;const d=new Dr({parent:o,mathstyle:"cramp"},this.style),g=(u=oi.createBox(d,this.body))!=null?u:new zi("\u25A2",{style:this.style});let b=0;!this.hasEmptyBranch("body")&&this.body.length===2&&this.body[1].isCharacterBox()&&(b=g.skew);let M=Math.min(g.height,Ju),N;if(this.svgAccent)N=jl(this.svgAccent),M=d.metrics.bigOpSpacing1-M;else if(this.accent){const F=new zi(this.accent,{fontFamily:"Main-Regular"});F.italic=0;const $=this.accent===8407?" ML__accent-vec":"";N=new zi(new zi(F),{classes:"ML__accent-body"+$})}N=new to({shift:0,children:[{box:new zi(g)},-M,{box:N,marginLeft:g.left+2*b,classes:["ML__center"]}]});const I=new zi(N,{type:"lift"});return this.caret&&(I.caret=this.caret),this.bind(d,I.wrap(d)),this.attachSupsub(d,{base:I})}},x={"(":")","{":"}","[":"]","|":"|","\\lbrace":"\\rbrace","\\lparen":"\\rparen","\\{":"\\}","\\langle":"\\rangle","\\lfloor":"\\rfloor","\\lceil":"\\rceil","\\vert":"\\vert","\\lvert":"\\rvert","\\Vert":"\\Vert","\\lVert":"\\rVert","\\lbrack":"\\rbrack","\\ulcorner":"\\urcorner","\\llcorner":"\\lrcorner","\\lgroup":"\\rgroup","\\lmoustache":"\\rmoustache"},y=Object.fromEntries(Object.entries(x).map(([r,o])=>[o,r]));function S(r){var o;return(o={"[":91,"]":93,"(":40,")":41,"\\mid":8739,"|":8739,"\u2223":8739,"\u2225":8741,"\\|":8739,"\\{":123,"\\}":125,"\\lbrace":123,"\\rbrace":125,"\\lparen":40,"\\rparen":41,"\\lbrack":91,"\\rbrack":93,"\\vert":8739,"\\lvert":8739,"\\mvert":8739,"\\rvert":8739,"\\Vert":8741,"\\lVert":8741,"\\mVert":8741,"\\rVert":8741,"\\parallel":8741,"\\shortparallel":8741,"\\langle":10216,"\\rangle":10217,"\\lfloor":8970,"\\rfloor":8971,"\\lceil":8968,"\\rceil":8969,"\\ulcorner":9484,"\\urcorner":9488,"\\llcorner":9492,"\\lrcorner":9496,"\\lgroup":10222,"\\rgroup":10223,"\\lmoustache":9136,"\\rmoustache":9137,"\\surd":8730}[r])!=null?o:r.codePointAt(0)}function _(r,o,u,d){var g;const M=new zi(S(r),{fontFamily:"Main-Regular",isSelected:d.isSelected,classes:"ML__small-delim "+((g=d.classes)!=null?g:"")}).wrap(o);return u&&M.setTop((1-o.scalingFactor)*la),M}function O(r,o,u,d,g){var b,M;const N=new Dr({parent:d,mathstyle:"textstyle"},g==null?void 0:g.style),I=new zi(S(r),{fontFamily:`Size${o}-Regular`,isSelected:g.isSelected,classes:((b=g.classes)!=null?b:"")+` ML__delim-size${o}`,type:(M=g.type)!=null?M:"ignore"}).wrap(N);return u&&I.setTop((1-N.scalingFactor)*la),I}function V(r,o,u,d,g){var b;let M,N,I,F;M=I=F=S(r),N=null;let $="Size1-Regular";r==="\\vert"||r==="\\lvert"||r==="\\rvert"||r==="\\mvert"||r==="\\mid"?I=M=F=8739:r==="\\Vert"||r==="\\lVert"||r==="\\rVert"||r==="\\mVert"||r==="\\|"?I=M=F=8741:r==="\\uparrow"?I=F=9168:r==="\\Uparrow"?I=F=8214:r==="\\downarrow"?M=I=9168:r==="\\Downarrow"?M=I=8214:r==="\\updownarrow"?(M=8593,I=9168,F=8595):r==="\\Updownarrow"?(M=8657,I=8214,F=8659):r==="["||r==="\\lbrack"?(M=9121,I=9122,F=9123,$="Size4-Regular"):r==="]"||r==="\\rbrack"?(M=9124,I=9125,F=9126,$="Size4-Regular"):r==="\\lfloor"||r==="\u230A"?(I=M=9122,F=9123,$="Size4-Regular"):r==="\\lceil"||r==="\u2308"?(M=9121,I=F=9122,$="Size4-Regular"):r==="\\rfloor"||r==="\u230B"?(I=M=9125,F=9126,$="Size4-Regular"):r==="\\rceil"||r==="\u2309"?(M=9124,I=F=9125,$="Size4-Regular"):r==="("||r==="\\lparen"?(M=9115,I=9116,F=9117,$="Size4-Regular"):r===")"||r==="\\rparen"?(M=9118,I=9119,F=9120,$="Size4-Regular"):r==="\\{"||r==="\\lbrace"?(M=9127,N=9128,F=9129,I=9130,$="Size4-Regular"):r==="\\}"||r==="\\rbrace"?(M=9131,N=9132,F=9133,I=9130,$="Size4-Regular"):r==="\\lgroup"||r==="\u27EE"?(M=9127,F=9129,I=9130,$="Size4-Regular"):r==="\\rgroup"||r==="\u27EF"?(M=9131,F=9133,I=9130,$="Size4-Regular"):r==="\\lmoustache"||r==="\u23B0"?(M=9127,F=9133,I=9130,$="Size4-Regular"):r==="\\rmoustache"||r==="\u23B1"?(M=9131,F=9129,I=9130,$="Size4-Regular"):r==="\\surd"?(M=57345,F=9143,I=57344,$="Size4-Regular"):r==="\\ulcorner"?(M=9484,I=F=32):r==="\\urcorner"?(M=9488,I=F=32):r==="\\llcorner"?(F=9492,I=M=32):r==="\\lrcorner"&&(M=9496,I=M=32);const it=Qu(M,$),gt=it.height+it.depth,_t=Qu(I,$),zt=_t.height+_t.depth,Ne=Qu(F,$),Bi=Ne.height+Ne.depth;let Ee=0,hi=1;if(N!==null){const pa=Qu(N,$);Ee=pa.height+pa.depth,hi=2}const $i=gt+Bi+Ee,xi=Math.max(0,Math.ceil((o-$i)/(hi*zt))),bn=$i+xi*hi*zt;let Rn=la;u&&(Rn=Rn*d.scalingFactor);const En=bn/2-Rn,Fr=.008,Po=[];Po.push({box:new zi(F,{fontFamily:$})}),Po.push(-Fr);const Yi=new zi(I,{fontFamily:$});if(N===null)for(let pa=0;pa<xi;pa++)Po.push({box:Yi});else{for(let pa=0;pa<xi;pa++)Po.push({box:Yi});Po.push(-Fr),Po.push({box:new zi(N,{fontFamily:$})}),Po.push(-Fr);for(let pa=0;pa<xi;pa++)Po.push({box:Yi})}Po.push(-Fr),Po.push({box:new zi(M,{fontFamily:$})});let Nu="";$==="Size1-Regular"?Nu=" delim-size1":$==="Size4-Regular"&&(Nu=" delim-size4");const Au=new to({bottom:En,children:Po},{classes:Nu});return new zi(Au,rt(Q({},g!=null?g:{}),{classes:((b=g==null?void 0:g.classes)!=null?b:"")+" ML__delim-mult"}))}var K=new Set(["(",")","\\lparen","\\rparen","[","]","\\lbrack","\\rbrack","\\{","\\}","\\lbrace","\\rbrace","\\lfloor","\\rfloor","\\lceil","\\rceil","\\surd","\u230A","\u230B","\u2308","\u2309"]),et=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\mvert","\\mid","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","\u27EE","\u27EF","\u23B0","\u23B1"]),Lt=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),at=[0,1.2,1.8,2.4,3];function ie(r,o,u,d){return r===void 0||r==="."?dn(u,d.classes):(r==="<"||r==="\\lt"||r==="\u27E8"?r="\\langle":(r===">"||r==="\\gt"||r==="\u27E9")&&(r="\\rangle"),K.has(r)||Lt.has(r)?O(r,o,!1,u,d):et.has(r)?V(r,at[o],!1,u,d):(console.assert(!1,"Unknown delimiter '"+r+"'"),null))}var Yt=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Ge=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"stack"}],si=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];function yi(r){return r.type==="small"?"Main-Regular":r.type==="large"?"Size"+r.size+"-Regular":(console.assert(r.type==="stack"),"Size4-Regular")}function Vi(r,o,u,d){const g={"-4":0,"-3":1,0:2}[d.mathstyle.sizeDelta];for(let b=g;b<u.length&&u[b].type!=="stack";b++){const M=Qu(r,yi(u[b]));if(M.defaultMetrics)return{type:"small",mathstyle:"scriptstyle"};let N=M.height+M.depth;if(u[b].type==="small"&&(u[b].mathstyle==="scriptscriptstyle"?N*=Math.max(Wc[Math.max(1,d.size-2)],d.minFontScale):u[b].mathstyle==="scriptstyle"&&(N*=Math.max(Wc[Math.max(1,d.size-1)],d.minFontScale))),N>o)return u[b]}return u[u.length-1]}function un(r,o,u,d,g,b){if(!o||o.length===0||o===".")return dn(g);o==="<"||o==="\\lt"?o="\\langle":(o===">"||o==="\\gt")&&(o="\\rangle");let M;Lt.has(o)?M=Yt:K.has(o)?M=si:M=Ge;const N=Vi(S(o),u,M,g),I=new Dr({parent:g,mathstyle:N.mathstyle},b==null?void 0:b.style);return N.type==="small"?_(o,I,d,rt(Q({},b),{type:r})):N.type==="large"?O(o,N.size,d,I,rt(Q({},b),{type:r})):(console.assert(N.type==="stack"),V(o,u,d,I,rt(Q({},b),{type:r})))}function qi(r,o,u,d,g,b){if(o===".")return dn(g,b==null?void 0:b.classes);const M=la*g.scalingFactor,N=901,I=5/Yu,F=Math.max(u-M,d+M),$=Math.max(F/500*N,2*F-I);return un(r,o,$,!0,g,b)}function dn(r,o){const u=new zi(null,{classes:" nulldelimiter "+(o!=null?o:""),type:"ignore"});return u.width=r.getRegisterAsEm("nulldelimiterspace"),u.wrap(new Dr({parent:r,mathstyle:"textstyle"}))}var Dn=class h2 extends oi{constructor(o){var u;super({type:"placeholder",command:"\\placeholder",mode:(u=o==null?void 0:o.mode)!=null?u:"math",style:o==null?void 0:o.style}),this.captureSelection=!0}static fromJson(o){return new h2(o)}toJson(){return super.toJson()}render(o){let u;return this.value=o.placeholderSymbol,typeof o.renderPlaceholder=="function"?u=o.renderPlaceholder(o):u=this.createBox(o),this.caret&&(u.classes+=" ML__placeholder-selected"),u}_serialize(o){return o.skipPlaceholders?"":"\\placeholder{}"}},en=["matrix","matrix*","pmatrix","pmatrix*","bmatrix","bmatrix*","Bmatrix","Bmatrix*","vmatrix","vmatrix*","Vmatrix","Vmatrix*"],lr=["cases","dcases","rcases"],To=["align","align*","aligned","gather","gathered","split"],Ws=["array","subequations","eqnarray"];function qo(r){return Ws.concat(To).concat(lr).concat(en).includes(r)}function za(r){return en.includes(r)}function ka(r){return lr.includes(r)}function Os(r){return To.includes(r)}function dl(r,o,u){let d=0;for(const F of u)"align"in F&&(d+=1);let g=0;const b=[];for(const F of o){let $=0;for(g=Math.max(g,Math.min(F.length,d));$<F.length;){const it=[],gt=Math.min(F.length,$+d);for(;$<gt;){const _t=F[$];_t.length===0?it.push([new oi({type:"first",mode:r.mode})]):_t[0].type!=="first"?it.push([new oi({type:"first",mode:r.mode}),..._t]):(console.assert(!_t.slice(1).some(zt=>zt.type==="first")),it.push(_t)),$+=1}b.push(it)}}b.length>0&&b[b.length-1].length===1&&b[b.length-1][0].length===1&&b[b.length-1][0][0].type==="first"&&b.pop();const M=[];for(const F of b){if(F.length!==g)for(let $=F.length;$<g;$++)F.push([new oi({type:"first",mode:r.mode}),new Dn]);M.push(F)}let N=0,I=0;for(const F of M){I=0;for(const $ of F){for(const it of $)it.parent=r,it.parentBranch=[N,I];I+=1}N+=1}return r.isDirty=!0,M}var rr=class c2 extends oi{constructor(o,u,d,g={}){var b;super({type:"array"}),this.environmentName=o,this.rowGaps=d,g.mathstyleName&&(this.mathstyleName=g.mathstyleName),g.columns&&(g.columns.length===0?this.colFormat=[{align:"l"}]:this.colFormat=g.columns),this.colFormat||(this.colFormat=[{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"}]),this.array=dl(this,u,this.colFormat),g.leftDelim&&(this.leftDelim=g.leftDelim),g.rightDelim&&(this.rightDelim=g.rightDelim),g.arraycolsep!==void 0&&(this.arraycolsep=g.arraycolsep),this.colSeparationType=g.colSeparationType,g.arraystretch!==void 0&&(this.arraystretch=g.arraystretch),this.minColumns=(b=g.minColumns)!=null?b:1}static fromJson(o){return new c2(o.environmentName,o.array,o.rowGaps,o)}toJson(){const o=rt(Q({},super.toJson()),{environmentName:this.environmentName,array:this.array.map(u=>u.map(d=>d.map(g=>g.toJson()))),rowGaps:this.rowGaps,columns:this.colFormat,colSeparationType:this.colSeparationType});return this.arraystretch!==void 0&&(o.arraystretch=this.arraystretch),this.arraycolsep!==void 0&&(o.arraycolsep=this.arraycolsep),this.leftDelim&&(o.leftDelim=this.leftDelim),this.rightDelim&&(o.rightDelim=this.rightDelim),o}branch(o){var u;if(Bd(o))return(u=this.array[o[0]][o[1]])!=null?u:void 0}createBranch(o){var u;return Bd(o)?(this.isDirty=!0,(u=this.branch(o))!=null?u:[]):[]}get rowCount(){return this.array.length}get colCount(){return this.array[0].length}get maxColumns(){return this.colFormat.filter(o=>!!o.align).length}removeBranch(o){if(Kl(o))return super.removeBranch(o);const u=this.branch(o);return this.array[o[0]][o[1]]=void 0,u.forEach(d=>{d.parent=void 0,d.parentBranch=void 0}),console.assert(u[0].type==="first"),u.shift(),this.isDirty=!0,u}get hasChildren(){return this.children.length>0}get children(){const o=[];for(const u of this.array)for(const d of u)if(d)for(const g of d)o.push(...g.children),o.push(g);return[...o,...super.children]}render(o){var u,d,g,b,M,N;const I=new Dr({parent:o,mathstyle:this.mathstyleName},this.style),F=I.getRegisterAsEm("arrayrulewidth"),$=I.getRegisterAsEm("arraycolsep"),it=I.getRegisterAsEm("doublerulesep"),gt=(d=(u=this.arraystretch)!=null?u:I.getRegisterAsNumber("arraystretch"))!=null?d:1;let _t=typeof this.arraycolsep=="number"?this.arraycolsep:$;this.colSeparationType==="small"&&(_t=.2778*(new Dr({parent:o,mathstyle:"scriptstyle"}).scalingFactor/o.scalingFactor));const zt=gt*Rf,Ne=.7*zt,Bi=.3*zt;let Ee=0;const hi=[];let $i=0;const xi=this.array.length;for(let Vr=0;Vr<xi;++Vr){const No=this.array[Vr];$i=Math.max($i,No.length);const Gs=new Dr({parent:I,mathstyle:this.mathstyleName},this.style);let ph=Ne/Gs.scalingFactor,fu=Bi/Gs.scalingFactor;const Ou={cells:[],height:0,depth:0,pos:0};for(const Bu of No){const A0=(g=oi.createBox(Gs,Bu,{type:"ignore"}))!=null?g:new zi(null,{type:"ignore"});fu=Math.max(fu,A0.depth),ph=Math.max(ph,A0.height),Ou.cells.push(A0)}let mh=(b=Xc(this.rowGaps[Vr]))!=null?b:0;mh>0&&(mh+=Bi,fu=Math.max(fu,mh),mh=0),Vr<xi-1&&!za(this.environmentName)&&this.environmentName!=="cases"&&this.environmentName!=="array"&&(fu+=I.getRegisterAsEm("jot")),Ou.height=ph,Ou.depth=fu,Ee+=ph,Ou.pos=Ee,Ee+=fu+mh,hi.push(Ou)}const bn=Ee/2+la,Rn=[];for(let Vr=0;Vr<$i;Vr++){const No=[];for(const Gs of hi){const ph=Gs.cells[Vr];ph.depth=Gs.depth,ph.height=Gs.height,No.push({box:ph,shift:Gs.pos-bn})}No.length>0&&Rn.push(new to({individualShift:No}))}const En=[];let Fr=!1,Po=!1,Yi=0,Nu=!this.leftDelim;const{colFormat:Au}=this;for(const Vr of Au){if("align"in Vr&&Yi>=Rn.length)break;if("align"in Vr)Fr?En.push(Br(2*_t)):(Po||Nu)&&En.push(Br(_t)),En.push(new zi(Rn[Yi],{classes:"col-align-"+Vr.align})),Yi++,Fr=!0,Po=!1,Nu=!1;else if("gap"in Vr){if(typeof Vr.gap=="number")En.push(Br(Vr.gap));else{const No=ss(o,hi,bn,Vr.gap);No&&En.push(No)}Fr=!1,Po=!1,Nu=!1}else if("separator"in Vr){const No=new zi(null,{classes:"vertical-separator"});No.height=Ee,No.setStyle("height",Ee,"em"),No.setStyle("border-right",`${F}em ${Vr.separator} currentColor`),No.setStyle("vertical-align",-(Ee-bn),"em");let Gs=0;Po?Gs=it-F:Fr&&(Gs=_t-F),No.left=Gs,En.push(No),Fr=!1,Po=!0,Nu=!1}}Fr&&!this.rightDelim&&En.push(Br(_t));const Du=new zi(En,{classes:"mtable"});if((!this.leftDelim||this.leftDelim===".")&&(!this.rightDelim||this.rightDelim==="."))return this.caret&&(Du.caret=this.caret),this.bind(o,Du);const pa=Du.height,Iu=Du.depth,el=this.bind(o,new zi([this.bind(o,qi("open",(M=this.leftDelim)!=null?M:".",pa,Iu,I,{isSelected:this.isSelected})),Du,this.bind(o,qi("close",(N=this.rightDelim)!=null?N:".",pa,Iu,I,{isSelected:this.isSelected}))],{type:"ord"}));return el?(el.setStyle("display","inline-block"),this.caret&&(el.caret=this.caret),this.bind(o,this.attachSupsub(o,{base:el}))):null}_serialize(o){var u;const d=[];if(this.environmentName==="lines"?d.push("{\\displaylines"):d.push(`\\begin{${this.environmentName}}`),this.environmentName==="array"){if(d.push("{"),this.colFormat!==void 0)for(const g of this.colFormat)"align"in g&&typeof g.align=="string"?d.push(g.align):"separator"in g&&g.separator==="solid"?d.push("|"):"separator"in g&&g.separator==="dashed"&&d.push(":");d.push("}")}for(let g=0;g<this.array.length;g++){for(let b=0;b<this.array[g].length;b++)b>0&&d.push(" & "),d.push(oi.serialize(this.array[g][b],o));if(g<this.array.length-1){const b=this.rowGaps[g];b!=null&&b.dimension?d.push(`\\\\[${b.dimension} ${(u=b.unit)!=null?u:"pt"}] `):d.push("\\\\ ")}}return this.environmentName==="lines"?d.push("}"):d.push(`\\end{${this.environmentName}}`),fr(d)}getCell(o,u){return this.array[o][u]}setCell(o,u,d){console.assert(this.type==="array"&&Array.isArray(this.array)&&this.array[o][u]!==void 0);for(const b of this.array[o][u])b.parent=void 0,b.parentBranch=void 0;let g=d;(d.length===0||d[0].type!=="first")&&(g=[new oi({type:"first",mode:this.mode}),...d]),this.array[o][u]=g;for(const b of g)b.parent=this,b.parentBranch=[o,u];this.isDirty=!0}addRowBefore(o){console.assert(this.type==="array"&&Array.isArray(this.array));const u=[];for(let d=0;d<this.colCount;d++)u.push(gs(this));this.array.splice(o,0,u);for(let d=o;d<this.rowCount;d++)for(let g=0;g<this.colCount;g++){const b=this.array[d][g];if(b)for(const M of b)M.parentBranch=[d,g]}this.isDirty=!0}addRowAfter(o){console.assert(this.type==="array"&&Array.isArray(this.array));const u=[];for(let d=0;d<this.colCount;d++)u.push(gs(this));this.array.splice(o+1,0,u);for(let d=o+1;d<this.rowCount;d++)for(let g=0;g<this.colCount;g++){const b=this.array[d][g];if(b)for(const M of b)M.parentBranch=[d,g]}this.isDirty=!0}removeRow(o){console.assert(this.type==="array"&&Array.isArray(this.array)&&this.rowCount>o);const u=this.array.splice(o,1);for(const d of u)for(const g of d)if(g)for(const b of g)b.parent=void 0,b.parentBranch=void 0;for(let d=o;d<this.rowCount;d++)for(let g=0;g<this.colCount;g++){const b=this.array[d][g];if(b)for(const M of b)M.parentBranch=[d,g]}this.isDirty=!0}addColumnBefore(o){console.assert(this.type==="array"&&Array.isArray(this.array));for(const u of this.array)u.splice(o,0,gs(this));for(let u=0;u<this.rowCount;u++)for(let d=o;d<this.colCount;d++){const g=this.array[u][d];if(g)for(const b of g)b.parentBranch=[u,d]}this.isDirty=!0}addColumnAfter(o){console.assert(this.type==="array"&&Array.isArray(this.array));for(const u of this.array)u.splice(o+1,0,gs(this));for(let u=0;u<this.rowCount;u++)for(let d=o+1;d<this.colCount;d++){const g=this.array[u][d];if(g)for(const b of g)b.parentBranch=[u,d]}this.isDirty=!0}addColumn(){this.addColumnAfter(this.colCount-1)}removeColumn(o){console.assert(this.type==="array"&&Array.isArray(this.array)&&this.colCount>o);for(const u of this.array){const d=u.splice(o,1);for(const g of d)if(g)for(const b of g)b.parent=void 0,b.parentBranch=void 0}for(let u=0;u<this.rowCount;u++)for(let d=o;d<this.colCount;d++){const g=this.array[u][d];if(g)for(const b of g)b.parentBranch=[u,d]}this.isDirty=!0}get cells(){const o=[];for(const u of this.array)for(const d of u)d&&o.push(d.filter(g=>g.type!=="first"));return o}};function gs(r){const o=new oi({type:"first",mode:r.mode});o.parent=r;const u=new Dn;return u.parent=r,[o,u]}function Br(r){const o=new zi(null,{classes:"arraycolsep"});return o.width=r,o}function ss(r,o,u,d){if(!d)return null;const g=[];for(const b of o){const M=oi.createBox(r,d,{type:"ignore"});M&&(M.depth=b.depth,M.height=b.height,g.push({box:M,shift:b.pos-u}))}return new to({individualShift:g}).wrap(r)}var Qo=class d2 extends oi{constructor(o){super({mode:o.mode,command:o.command,style:o.style,body:o.body,type:"box"}),this.framecolor=o.framecolor,this.backgroundcolor=o.backgroundcolor,this.padding=o.padding,this.offset=o.offset,this.border=o.border}static fromJson(o){return new d2(o)}toJson(){return rt(Q({},super.toJson()),{framecolor:this.framecolor,backgroundcolor:this.backgroundcolor,padding:this.padding,offset:this.offset,border:this.border})}render(o){var u,d,g,b;const M=oi.createBox(o,this.body,{type:"lift"});if(!M)return null;const N=o.toEm((u=this.offset)!=null?u:{dimension:0});M.depth+=N,M.setStyle("display","inline-block"),M.setStyle("position","relative"),M.setStyle("height",Math.floor(100*M.height+M.depth)/100,"em"),M.setStyle("vertical-align",-Math.floor(100*M.height)/100,"em");const I=new Dr({parent:o},this.style),F=I.toEm((d=this.padding)!=null?d:{register:"fboxsep"}),$=new zi(null,{classes:"ML__box"});$.height=M.height+F,$.depth=M.depth+F,$.setStyle("box-sizing","border-box"),$.setStyle("position","absolute"),$.setStyle("top",-F+.3,"em"),$.setStyle("left",0),$.setStyle("height",$.height+$.depth,"em"),$.setStyle("width","100%"),this.backgroundcolor&&$.setStyle("background-color",(g=I.toColor(this.backgroundcolor))!=null?g:"transparent"),this.framecolor&&$.setStyle("border",`${I.getRegisterAsEm("fboxrule",2)}em solid ${(b=I.toColor(this.framecolor))!=null?b:"black"}`),this.border&&$.setStyle("border",this.border);const it=new zi([$,M],{type:"lift"});return it.setStyle("display","inline-block"),it.setStyle("position","relative"),it.setStyle("line-height",0),it.height=M.height+F+(N>0?N:0),it.depth=M.depth+F+(N<0?-N:0),it.setStyle("padding-left",F,"em"),it.setStyle("padding-right",F,"em"),it.setStyle("height",Math.floor(100*(M.height+M.depth+2*F+Math.abs(N)))/100,"em"),it.setStyle("margin-top",-F,"em"),it.setStyle("top",Math.floor(100*(M.depth-M.height+2*F-N))/100,"em"),it.setStyle("vertical-align",Math.floor(100*(M.depth+2*F))/100,"em"),this.caret&&(it.caret=this.caret),this.attachSupsub(o,{base:it})}_serialize(o){return o.skipStyles?fr([this.bodyToLatex(o),this.supsubToLatex(o)]):super._serialize(o)}},Qs=class f2 extends oi{constructor(o,u){var d;super({type:"composition",mode:(d=u==null?void 0:u.mode)!=null?d:"math",value:o})}static fromJson(o){return new f2(o.value,o)}toJson(){return super.toJson()}get computedStyle(){return{}}render(o){const u=new zi(this.value,{classes:"ML__composition",type:"composition"});return this.bind(o,u),this.caret&&(u.caret=this.caret),u}_serialize(o){return""}},La=class p2 extends oi{constructor(o){super({type:"error",value:o,command:o,mode:"math"}),this.verbatimLatex=o}static fromJson(o){return new p2(o.command)}toJson(){return super.toJson()}render(o){const u=this.createBox(o,{classes:"ML__error"});return this.caret&&(u.caret=this.caret),u}},Wo=class m2 extends oi{constructor(o,u,d){super({type:"group",mode:u,style:d}),this.body=o,this.boxType=o.length>1?"ord":"ignore",this.skipBoundary=!0,this.displayContainsHighlight=!1,o&&o.length===1&&o[0].command===","&&(this.captureSelection=!0)}static fromJson(o){return new m2(o.body,o.mode,o.style)}render(o){const u=oi.createBox(o,this.body,{type:this.boxType});return u?(this.caret&&(u.caret=this.caret),this.bind(o,u)):null}_serialize(o){if(!(o.expandMacro||o.skipStyles||o.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const u=we(this.command,this.mode);return u!=null&&u.serialize?u.serialize(this,o):`{${this.bodyToLatex(o)}}`}},Kr=class g2 extends oi{constructor(o,u,d){super({type:"leftright",style:d.style,displayContainsHighlight:!0}),this.variant=o,this.body=u,this.leftDelim=d.leftDelim,this.rightDelim=d.rightDelim}static fromJson(o){var u;return new g2((u=o.variant)!=null?u:"",o.body,o)}toJson(){const o=super.toJson();return this.variant&&(o.variant=this.variant),this.leftDelim&&(o.leftDelim=this.leftDelim),this.rightDelim&&(o.rightDelim=this.rightDelim),o}_serialize(o){var u,d;const g=this.matchingRightDelim();return this.variant==="left...right"?fr(["\\left",(u=this.leftDelim)!=null?u:".",this.bodyToLatex(o),"\\right",g]):this.variant==="mleft...mright"?fr(["\\mleft",(d=this.leftDelim)!=null?d:".",this.bodyToLatex(o),"\\mright",g]):fr([!this.leftDelim||this.leftDelim==="."?"":this.leftDelim,this.bodyToLatex(o),g])}matchingRightDelim(){var o,u;if(this.rightDelim&&this.rightDelim!=="?")return this.rightDelim;const d=(o=this.leftDelim)!=null?o:".";return(u=x[d])!=null?u:d}render(o){var u,d;const g=new Dr({parent:o},this.style);console.assert(this.body!==void 0);const b=new Dr({parent:o,mathstyle:"textstyle"},this.style),M=(u=oi.createBox(g,this.body,{type:"inner"}))!=null?u:new zi(null,{type:"inner"}),N=M.height/b.scalingFactor,I=M.depth/b.scalingFactor,F=[];if(this.leftDelim&&F.push(this.bind(b,qi("open",this.leftDelim,N,I,b,{isSelected:this.isSelected,classes:"ML__open"+(this.containsCaret?" ML__contains-caret":""),mode:this.mode,style:this.style}))),M&&(as(M.children,this,g,N,I),F.push(M)),this.rightDelim){let _t=this.containsCaret?" ML__contains-caret":"",zt=this.rightDelim;zt==="?"&&(g.smartFence?(zt=this.matchingRightDelim(),_t+=" ML__smart-fence__close"):zt="."),F.push(this.bind(b,qi("close",zt,N,I,b,{isSelected:this.isSelected,classes:_t+" ML__close",mode:this.mode,style:this.style})))}let $=this.variant==="mleft...mright";const it=this.leftSibling;it&&(!$&&it.isFunction&&($=!0),!$&&it.type==="subsup"&&((d=it.leftSibling)!=null&&d.isFunction)&&($=!0));const gt=new zi(F,{type:$?"close":"inner",classes:"left-right"});return gt.setStyle("margin-top",`${-M.depth}em`),gt.setStyle("height",`${M.height+M.depth}em`),this.caret&&(gt.caret=this.caret),this.bind(g,gt.wrap(g))}};function as(r,o,u,d,g){if(r)for(let b=0;b<r.length;b++){const M=r[b];M.type==="middle"?(r[b]=o.bind(u,qi("inner",M.value,d,g,u,{isSelected:o.isSelected})),r[b].caret=M.caret,r[b].isSelected=M.isSelected,r[b].cssId=M.cssId,r[b].htmlData=M.htmlData,r[b].htmlStyle=M.htmlStyle,r[b].attributes=M.attributes,r[b].cssProperties=M.cssProperties):M.children&&as(M.children,o,u,d,g)}}var $d=class v2 extends oi{constructor(o,u){var d;super({type:"macro",command:o,style:u.style}),this.body=u.body,u.captureSelection===void 0?u.args?this.captureSelection=!1:this.captureSelection=!0:this.captureSelection=u.captureSelection,this.macroArgs=u.args,this.expand=(d=u.expand)!=null?d:!1}static fromJson(o){return new v2(o.command,o)}toJson(){const o=super.toJson();return this.expand&&(o.expand=!0),this.captureSelection!==void 0&&(o.captureSelection=this.captureSelection),this.macroArgs&&(o.args=this.macroArgs),o}_serialize(o){var u;return o.expandMacro&&this.expand?this.bodyToLatex(o):this.command+((u=this.macroArgs)!=null?u:"")}render(o){const u=oi.createBox(o,this.body);return u?(this.caret&&(u.caret=this.caret),this.bind(o,u)):null}},_l=class y2 extends oi{constructor(){super({type:"macro-argument"})}static fromJson(o){return new y2}toJson(){return super.toJson()}_serialize(o){return""}render(o){return null}},Ja=class x2 extends oi{constructor(o,u,d=!1,g,b){var M;super({type:"prompt",mode:(M=b==null?void 0:b.mode)!=null?M:"math",style:b==null?void 0:b.style,command:"\\placeholder"}),this.body=g,this.correctness=u,this.placeholderId=o,this.locked=d,this.captureSelection=this.locked}static fromJson(o){return new x2(o.placeholderId,o.correctness,o.locked,o.body,o)}toJson(){const o=super.toJson();return this.placeholderId&&(o.placeholderId=this.placeholderId),this.body||delete o.body,this.body&&(o.body=this.body.filter(u=>u.type!=="first").map(u=>u.toJson())),this.correctness&&(o.correctness=this.correctness),o.locked=this.locked,o}render(o){const u=new Dr({parent:o}),d=u.getRegisterAsEm("fboxsep"),g=d,b=d,M=oi.createBox(o,this.body);if(!M)return null;M.height||(M.height=u.metrics.xHeight),M.setStyle("vertical-align",-M.height,"em"),this.correctness==="correct"?M.setStyle("color","var(--correct-color, var(--ML__correct-color))"):this.correctness==="incorrect"&&M.setStyle("color","var(--incorrect-color, var(--ML__incorrect-color))");const N=new zi(M,{type:"ord"});N.setStyle("display","inline-block"),N.setStyle("height",M.height+M.depth,"em"),N.setStyle("vertical-align",-b,"em");let I="ML__prompt ";this.locked?I+=" ML__lockedPromptBox ":I+=" ML__editablePromptBox ",this.correctness==="correct"?I+=" ML__correctPromptBox ":this.correctness==="incorrect"&&(I+=" ML__incorrectPromptBox "),this.containsCaret&&(I+=" ML__focusedPromptBox ");const F=new zi(null,{classes:I,attributes:{part:"prompt"}});F.height=N.height+b,F.depth=N.depth+b,F.width=N.width+2*g,F.setStyle("box-sizing","border-box"),F.setStyle("position","absolute"),F.setStyle("height",N.height+N.depth+2*b,"em"),g===0&&F.setStyle("width","100%"),g!==0&&(F.setStyle("width",`calc(100% + ${2*g}em)`),F.setStyle("top",d,"em"),F.setStyle("left",-g,"em")),(!this.body||this.body.length===1)&&(F.width=3*g,F.setStyle("width",`calc(100% + ${3*g}em)`),F.setStyle("left",-1.5*g,"em"));let $="";this.correctness==="incorrect"&&($+='<line x1="3%" y1="97%" x2="97%" y2="3%" stroke-width="0.5" stroke="var(--incorrect-color, var(--ML__incorrect-color))" stroke-linecap="round" />'),$&&(F.svgOverlay=$);const it=new zi([F,N],{classes:"ML__prompt-atom"});return it.setStyle("position","relative"),it.setStyle("display","inline-block"),it.setStyle("line-height",0),it.height=N.height+b+.2,it.depth=N.depth+b,it.left=g,it.right=g,it.setStyle("height",N.height+b,"em"),it.setStyle("top",N.depth-N.height,"em"),it.setStyle("vertical-align",N.depth+b,"em"),it.setStyle("margin-left",.5,"em"),it.setStyle("margin-right",.5,"em"),this.caret&&(it.caret=this.caret),this.bind(u,this.attachSupsub(o,{base:it}))}_serialize(o){var u;const d=(u=this.bodyToLatex(o))!=null?u:"";if(o.skipPlaceholders)return d;let g="\\placeholder";return this.placeholderId&&(g+=`[${this.placeholderId}]`),this.correctness==="correct"?g+="[correct]":this.correctness==="incorrect"&&(g+="[incorrect]"),this.locked&&(g+="[locked]"),Vo(g,d)}},ha=class w2 extends oi{constructor(o){super({type:"subsup",style:o==null?void 0:o.style}),this.subsupPlacement="auto"}static fromJson(o){const u=new w2(o);for(const d of Rh)o[d]&&u.setChildren(o[d],d);return u}render(o){var u;const d=new Dr({parent:o,isPhantom:!0}),g=this.leftSibling,b=(u=g.render(d))!=null?u:new zi(null),M=new zi(null);return M.height=b.height,M.depth=b.depth,this.attachSupsub(o,{base:M,isCharacterBox:g.isCharacterBox(),type:"ignore"})}_serialize(o){return this.supsubToLatex(o)}};function Hr(r){return r?!/^(<$$>|<$>|<space>|<{>|<}>|#[0-9\?]|\\.+)$/.test(r):!1}var Us=class{constructor(r,o,u){this.errors=[],this.index=0,this.endCount=0;var d,g,b,M;u!=null||(u={}),this.tokens=r,this.context=o instanceof Dr&&!(u!=null&&u.parseMode)&&!u.mathstyle?o:new Dr({from:o,mathstyle:u.mathstyle},u.style),this.args=(d=u.args)!=null?d:void 0,this.smartFence=this.context.smartFence,this.parsingContext={parent:void 0,mathlist:[],style:(g=u.style)!=null?g:{},parseMode:(b=u.parseMode)!=null?b:"math",mathstyle:(M=u.mathstyle)!=null?M:"displaystyle",tabular:!1}}beginContext(r){var o,u,d;const g=this.parsingContext,b={parent:g,mathlist:[],style:Q({},g.style),parseMode:(o=r==null?void 0:r.mode)!=null?o:g.parseMode,mathstyle:(u=r==null?void 0:r.mathstyle)!=null?u:g.mathstyle,tabular:(d=r==null?void 0:r.tabular)!=null?d:!1};this.parsingContext=b}endContext(){this.parsingContext=this.parsingContext.parent}onError(r){this.errors.push(Q({before:Ah(this.tokens.slice(this.index,this.index+10)),after:Ah(this.tokens.slice(Math.max(0,this.index-10),this.index))},r))}get mathlist(){return this.parsingContext.mathlist}set mathlist(r){this.parsingContext.mathlist=r}get parseMode(){return this.parsingContext.parseMode}set parseMode(r){this.parsingContext.parseMode=r}get tabularMode(){return this.parsingContext.tabular}get style(){let r=this.parsingContext;for(;r;){if(r.style)return Q({},r.style);r=r.parent}return{}}set style(r){this.parsingContext.style=r}end(){return this.endCount++,this.index>=this.tokens.length||this.endCount>1e3}next(){this.index+=1}get(){return this.endCount=0,this.index<this.tokens.length?this.tokens[this.index++]:""}peek(){return this.tokens[this.index]}match(r){return this.tokens[this.index]===r?(this.index++,!0):!1}lastSubsupAtom(){let r;return this.mathlist.length>0&&(r=this.mathlist[this.mathlist.length-1],r.type==="subsup"||r.subsupPlacement!==void 0)||(r=new ha({style:this.style}),this.mathlist.push(r)),r}hasPattern(r){return r.test(this.tokens[this.index])}hasInfixCommand(){var r;const{index:o}=this;if(o<this.tokens.length&&this.tokens[o].startsWith("\\")){const u=we(this.tokens[o],this.parseMode);return!u||u.definitionType==="symbol"||u.ifMode&&!u.ifMode.includes(this.parseMode)?!1:(r=u.infix)!=null?r:!1}return!1}matchColumnSeparator(){return!this.tabularMode||this.peek()!=="&"?!1:(this.index++,!0)}matchRowSeparator(){if(!this.tabularMode)return!1;const r=this.peek();return r!=="\\\\"&&r!=="\\cr"&&r!=="\\tabularnewline"?!1:(this.index++,!0)}placeholder(){var r;const o=(r=this.args)==null?void 0:r.call(this,"?");return o?vs(o,{parseMode:this.parseMode,mathstyle:"textstyle"}):[new Dn({mode:this.parseMode,style:this.style})]}skipWhitespace(){for(;this.match("<space>"););}skipUntilToken(r){let o=this.tokens[this.index];for(;o&&o!==r;)o=this.tokens[++this.index];o===r&&this.index++}skipFiller(){for(;this.match("\\relax")||this.match("<space>"););}matchKeyword(r){const o=this.index;let u=this.end(),d="";for(;!u;){const b=this.get();Hr(b)?(d+=b,u=this.end()||d.length>=r.length):u=!0}const g=r.toUpperCase()===d.toUpperCase();return g||(this.index=o),g}scanString(){let r="";for(;!this.end();){const o=this.peek();if(o==="]")return r;if(o==="<space>")r+=" ";else if(o.startsWith("\\"))this.onError({code:"unexpected-command-in-string"}),r+=o.substring(1);else if(Hr(o))r+=o;else return r;this.next()}return r}scanBalancedString(){let r="",o=this.end(),u=1;for(;!o;){const d=this.get();d==="<space>"?r+=" ":d==="<{>"?(r+="{",u+=1):d==="<}>"?(u-=1,u>0?r+="}":this.index-=1):d==="<$>"?r+="$":d==="<$$>"?r+="$$":r+=d,o=u===0||this.end()}return r}scanLiteralGroup(){var r;if(!this.match("<{>"))return"";let o="",u=1;for(;u>0&&!this.end();){const d=this.get();d==="<}>"?(u-=1,u>0&&(o+="}")):d==="<{>"?(u+=1,o+="{"):(/\\[a-zA-Z]+$/.test(o)&&/^[a-zA-Z]/.test(d)&&(o+=" "),o+=(r={"<space>":" ","<$$>":"$$","<$>":"$"}[d])!=null?r:d)}return o}scanNumber(r=!0){var o,u;let d=!1,g=this.peek();for(;g==="<space>"||g==="+"||g==="-";)this.get(),g==="-"&&(d=!d),g=this.peek();r=!!r;let b=10,M=/\d/;if(this.match("'"))b=8,M=/[0-7]/,r=!0;else if(this.match('"'))b=16,M=/[\dA-F]/,r=!0;else if(this.match("x"))b=16,M=/[\dA-Fa-f]/,r=!0;else if(this.match("`"))return g=this.get(),g?g.length===2&&g.startsWith("\\")?{number:(d?-1:1)*((o=g.codePointAt(1))!=null?o:0),base:"alpha"}:{number:(d?-1:1)*((u=g.codePointAt(0))!=null?u:0),base:"alpha"}:null;let N="";for(;this.hasPattern(M);)N+=this.get();if(!r&&(this.match(".")||this.match(",")))for(N+=".";this.hasPattern(M);)N+=this.get();const I=r?Number.parseInt(N,b):Number.parseFloat(N);return Number.isNaN(I)?null:{number:d?-I:I,base:b===16?"hexadecimal":b===8?"octal":"decimal"}}scanRegister(){var r;const o=this.index,u=this.scanNumber(!1);if(this.skipWhitespace(),this.match("\\relax"))return u;let d=!1;if(u===null)for(;;){const b=this.peek();if(b==="-")d=!d;else if(b!=="+")break;this.next(),this.skipWhitespace()}if(this.match("\\global")){this.skipWhitespace();const b=this.get();return b.startsWith("\\")?u?{register:b,global:!0,factor:(d?-1:1)*u.number}:d?{register:b,global:!0,factor:-1}:{register:b,global:!0}:(this.index=o,null)}let g=this.get();return g!=null&&g.startsWith("\\")?(g=g.substring(1),this.context.registers[g]?!d||u!==null?{register:g,factor:(d?-1:1)*((r=u==null?void 0:u.number)!=null?r:1)}:{register:g}:(this.index=o,null)):(this.index=o,null)}scanValue(){const r=this.scanRegister();if(r)return r;const o=this.index,u=this.scanGlueOrDimen();if(u&&("unit"in u||"glue"in u&&"unit"in u.glue))return u;this.index=o;const d=this.scanNumber();if(d)return d;if(this.end()||!Hr(this.peek()))return null;const g=this.scanString();return g.length>0?{string:g}:null}scanDimen(){const r=this.scanNumber(!1);if(r===null)return null;const o=r.number;this.skipWhitespace(),this.matchKeyword("true"),this.skipWhitespace();let u;return this.matchKeyword("pt")?u="pt":this.matchKeyword("mm")?u="mm":this.matchKeyword("cm")?u="cm":this.matchKeyword("ex")?u="ex":this.matchKeyword("px")?u="px":this.matchKeyword("em")?u="em":this.matchKeyword("bp")?u="bp":this.matchKeyword("dd")?u="dd":this.matchKeyword("pc")?u="pc":this.matchKeyword("in")?u="in":this.matchKeyword("mu")&&(u="mu"),u?{dimension:o,unit:u}:{dimension:o}}scanGlueOrDimen(){const r=this.scanDimen();if(r===null)return null;if(this.skipWhitespace(),this.match("\\relax"))return r;const o={glue:r};if(this.matchKeyword("plus")){const u=this.scanDimen();if(u)o.grow=u;else return o}if(this.skipWhitespace(),this.match("\\relax"))return o;if(this.skipWhitespace(),this.matchKeyword("minus")){const u=this.scanDimen();if(u)o.shrink=u;else return o}return!o.grow&&!o.shrink?r:o}scanColspec(){this.skipWhitespace();const r=[];for(;!this.end()&&!(this.peek()==="<}>"||this.peek()==="]");){const o=this.get();o==="c"||o==="r"||o==="l"?r.push({align:o}):o==="|"?r.push({separator:"solid"}):o===":"?r.push({separator:"dashed"}):o==="@"&&(this.match("<{>")&&(this.beginContext({mode:"math"}),r.push({gap:this.scan(u=>u==="<}>")}),this.endContext()),this.match("<}>")||this.onError({code:"unbalanced-braces"}))}return r}scanModeSet(){let r;if(this.match("\\(")&&(r="textstyle"),!r&&this.match("\\[")&&(r="displaystyle"),!r)return null;this.beginContext({mode:"math",mathstyle:r});const o=this.scan(u=>u===(r==="displaystyle"?"\\]":"\\)"));return this.match(r==="displaystyle"?"\\]":"\\)")||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),o}scanModeShift(){let r="";if(this.match("<$>")&&(r="<$>"),!r&&this.match("<$$>")&&(r="<$$>"),!r)return null;this.beginContext({mode:"math",mathstyle:"textstyle"});const o=this.scan(u=>u===r);return this.match(r)||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),o}scanEnvironment(){if(!this.match("\\begin"))return null;const r=this.scanArgument("string");if(!r)return null;const o=$e(r);if(!o)return this.onError({code:"unknown-environment",arg:r}),null;const u=[];if(o.params)for(const N of o.params)if(N.isOptional)u.push(this.scanOptionalArgument(N.type));else{const I=this.scanArgument(N.type);I||this.onError({code:"missing-argument",arg:r}),u.push(I)}this.beginContext({tabular:o.tabular});const d=[],g=[];let b=[],M=!1;do if(this.end()&&(this.onError({code:"unbalanced-environment",arg:r}),M=!0),!M&&this.match("\\end")&&(this.scanArgument("string")!==r&&this.onError({code:"unbalanced-environment",arg:r}),M=!0),!M)if(this.matchColumnSeparator())b.push(this.mathlist),this.mathlist=[];else if(this.matchRowSeparator()){b.push(this.mathlist),this.mathlist=[];let N=null;this.skipWhitespace(),this.match("[")&&(N=this.scanDimen(),this.skipWhitespace(),this.match("]")),g.push(N!=null?N:{dimension:0}),d.push(b),b=[]}else this.mathlist.push(...this.scan(N=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline"].includes(N)));while(!M);return b.push(this.mathlist),b.length>0&&d.push(b),this.endContext(),o.createAtom(r,d,g,u)}scanExpression(){const r=this.mathlist;if(this.mathlist=[],this.parseExpression()){const o=this.mathlist;return this.mathlist=r,o}return this.mathlist=r,null}scan(r){this.beginContext(),r||(r=M=>M==="<}>");let o="",u=null,d=[],g=null;for(;!this.end()&&!r(this.peek());)this.hasInfixCommand()&&!o?(o=this.get(),u=we(o,"math"),u&&(d=this.scanArguments(u)[1]),g=this.mathlist,this.mathlist=[]):this.parseExpression();let b;return o?(console.assert(!!u),d.unshift(this.mathlist),g&&d.unshift(g),b=[u.createAtom({command:o,args:d,style:this.style,mode:this.parseMode})]):b=this.mathlist,this.endContext(),b}scanGroup(){const r=this.index;if(!this.match("<{>"))return null;const o=this.scan(d=>d==="<}>");this.match("<}>")||this.onError({code:"unbalanced-braces"});const u=new Wo(o,this.parseMode,this.style);return u.verbatimLatex=Ah(this.tokens.slice(r,this.index)),u}scanSmartFence(){if(this.skipWhitespace(),!this.match("("))return null;this.beginContext();let r=1;for(;!this.end()&&r!==0;)this.match("(")&&(r+=1),this.match(")")&&(r-=1),r!==0&&this.parseExpression();const o=new Kr("",this.mathlist,{leftDelim:"(",rightDelim:r===0?")":"?"});return this.endContext(),o}scanDelim(){this.skipWhitespace();const r=this.peek();if(!r)return this.onError({code:"unexpected-end-of-string"}),null;if(!Hr(r)&&!r.startsWith("\\"))return null;this.next();const o=we(r,"math");return o?o.definitionType==="function"&&o.ifMode&&!o.ifMode.includes(this.parseMode)?(this.onError({code:"unexpected-delimiter",arg:r}),null):o.definitionType==="symbol"&&(o.type==="mopen"||o.type==="mclose")||/^(\.|\?|\||<|>|\\vert|\\Vert|\\\||\\surd|\\uparrow|\\downarrow|\\Uparrow|\\Downarrow|\\updownarrow|\\Updownarrow|\\mid|\\mvert|\\mVert)$/.test(r)?r:(this.onError({code:"unexpected-delimiter",arg:r}),null):(this.onError({code:"unknown-command",arg:r}),null)}scanLeftRight(){var r;if(this.match("\\right"))return this.onError({code:"unbalanced-braces"}),new La("\\right");if(this.match("\\mright"))return this.onError({code:"unbalanced-braces"}),new La("\\mright");let o="\\right";if(!this.match("\\left")){if(!this.match("\\mleft"))return null;o="\\mright"}const u=this.scanDelim();if(!u)return this.onError({code:"unexpected-delimiter"}),new La(o==="\\right"?"\\left":"\\mleft");for(this.beginContext();!this.end()&&!this.match(o);)this.parseExpression();const d=this.mathlist;this.endContext();const g=(r=this.scanDelim())!=null?r:".";return new Kr(o==="\\right"?"left...right":"mleft...mright",d,{leftDelim:u,rightDelim:g,style:this.style})}parseSupSub(){if(this.parseMode!=="math")return!1;let r=this.peek();if(r!=="^"&&r!=="_"&&r!=="'")return!1;const o=this.lastSubsupAtom();for(;r==="^"||r==="_"||r==="'";)this.match("'")?this.match("'")?o.addChild(new oi({type:"mord",command:"\\doubleprime",mode:"math",value:"\u2032\u2032"}),"superscript"):o.addChild(new oi({type:"mord",command:"\\prime",mode:"math",value:"\u2032"}),"superscript"):(this.match("^")||this.match("_"))&&o.addChildren(se(this.scanArgument("expression")),r==="_"?"subscript":"superscript"),r=this.peek();return!0}parseLimits(){if(this.parseMode!=="math")return!1;const r=this.match("\\limits"),o=!r&&this.match("\\nolimits"),u=!o&&!r&&this.match("\\displaylimits");if(!r&&!o&&!u)return!1;const d=this.mathlist.length>0?this.mathlist[this.mathlist.length-1]:null;return d===null?!1:(d.explicitSubsupPlacement=!0,r&&(d.subsupPlacement="over-under"),o&&(d.subsupPlacement="adjacent"),u&&(d.subsupPlacement="auto"),!0)}scanArguments(r){if(!(r!=null&&r.params))return[void 0,[]];let o;const u=[];let d=r.infix?2:0;for(;d<r.params.length;){const g=r.params[d];g.type==="rest"?u.push(this.scan(b=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline","\\right"].includes(b))):g.isOptional?u.push(this.scanOptionalArgument(g.type)):g.type.endsWith("*")?o=g.type.slice(0,-1):u.push(this.scanArgument(g.type)),d+=1}return[o,u]}scanSymbolOrLiteral(){const r=this.peek();if(!r)return null;this.next();let o;if(Hr(r)){const u=cl.createAtom(this.parseMode,r,Q({},this.style));return u?[u]:null}if(o=this.scanMacro(r),o)return[o];if(r.startsWith("\\")){const u=we(r,this.parseMode);if(!u)return this.onError({code:"unknown-command",arg:r}),[new La(r)];if(u.definitionType==="symbol"){const d=Q({},this.style);u.variant&&(d.variant=u.variant),o=new oi({type:u.type,command:r,style:d,value:String.fromCodePoint(u.codepoint),mode:this.parseMode,verbatimLatex:r})}else{if(u.applyMode||u.applyStyle||u.infix)return this.onError({code:"invalid-command",arg:r}),[new La(r)];u.createAtom&&(o=u.createAtom({command:r,args:[],style:this.style,mode:this.parseMode}))}}return o?[o]:null}scanArgument(r){var o;this.skipFiller();const u=this.parseMode;if(r==="auto"&&(r=u),!this.match("<{>")){if(r==="string")return this.scanString();if(r==="value")return this.scanValue();if(r==="delim")return(o=this.scanDelim())!=null?o:".";if(r==="expression")return this.scanExpression();if(r==="math"){r!==u&&this.beginContext({mode:"math"});const g=this.scanSymbolOrLiteral();return r!==u&&this.endContext(),g}if(r==="text"){r!==u&&this.beginContext({mode:"text"});const g=this.scanSymbolOrLiteral();return r!==u&&this.endContext(),g}return r==="balanced-string"||console.assert(!1),null}if(r==="text"){this.beginContext({mode:"text"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());const g=this.mathlist;return this.endContext(),{group:g}}if(r==="math"){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());const g=this.mathlist;return this.endContext(),{group:g}}let d=null;if(r==="expression"){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());const g=this.mathlist;return this.endContext(),{group:g}}return r==="string"?d=this.scanString():r==="balanced-string"?d=this.scanBalancedString():r==="colspec"?d=this.scanColspec():r==="value"&&(d=this.scanValue()),this.skipUntilToken("<}>"),d}scanOptionalArgument(r){if(r=r==="auto"?this.parseMode:r,this.skipFiller(),!this.match("["))return null;let o=null;for(;!this.end()&&!this.match("]");)if(r==="string")o=this.scanString();else if(r==="value")o=this.scanValue();else if(r==="colspec")o=this.scanColspec();else if(r==="bbox"){const u={},d=this.scanString().toLowerCase().trim().split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const g of d){const b=g.match(/^\s*([\d.]+)\s*([a-z]{2})/);if(b)u.padding={dimension:parseInt(b[1]),unit:b[2]};else{const M=g.match(/^\s*border\s*:\s*(.*)/);M?u.border=M[1]:u.backgroundcolor={string:g}}}o=u}else r==="math"&&(this.beginContext({mode:"math"}),o=this.mathlist.concat(this.scan(u=>u==="]")),this.endContext());return o}scanSymbolOrCommand(r){var o,u,d;if(r==="\\placeholder"){const N=this.scanOptionalArgument("string"),I=this.scanOptionalArgument("math"),F=oi.serialize(I,{defaultMode:"math"});let $=[],it;!it&&F==="correct"?it="correct":!it&&F==="incorrect"?it="incorrect":F!==""&&($=I);const gt=this.scanOptionalArgument("string")==="locked",_t=this.scanArgument("auto");let zt;return _t&&Array.isArray(_t)&&_t.length>0?zt=_t:_t&&typeof _t=="object"&&"group"in _t?zt=_t.group:zt=$,N?[new Ja(N,it,gt,zt!=null?zt:$,{mode:this.parseMode,style:this.style})]:[new Dn({mode:this.parseMode,style:this.style})]}if(r==="\\renewcommand"||r==="\\newcommand"||r==="\\providecommand"||r==="\\def"){const N=this.index,I=this.scanLiteralGroup()||this.next();if(!I)return null;if(this.context.registers[I.substring(1)]){const F=this.scanArgument("string");F!==null&&(this.context.registers[I.substring(1)]=F);const $=fr([r,Ah(this.tokens.slice(N,this.index))]);return[new oi({type:"text",value:"",verbatimLatex:$})]}}let g=this.scanMacro(r);if(g)return[g];const b=we(r,this.parseMode);if(!b)return this.parseMode==="text"?(/[a-zA-Z]/.test((o=this.peek())!=null?o:"")&&(r+=" "),[...r].map(N=>new oi({type:"text",value:N,mode:"text",style:this.style}))):(this.onError({code:"unknown-command",arg:r}),[new La(r)]);const M=this.index;if(b.definitionType==="symbol"){const N=Q({},this.style);b.variant&&(N.variant=b.variant),g=new oi({type:b.type,command:r,style:N,value:String.fromCodePoint(b.codepoint),mode:this.parseMode})}else{if(b.ifMode&&!b.ifMode.includes(this.parseMode))return[];const N=this.parseMode;b.applyMode&&(this.parseMode=b.applyMode);let I,F=[];if(b.parse?F=b.parse(this):[I,F]=this.scanArguments(b),this.parseMode=N,b.applyMode&&!b.applyStyle&&!b.createAtom)return se(F[0]);if(b.infix)return this.onError({code:"too-many-infix-commands",arg:r}),null;if(typeof b.createAtom=="function")g=b.createAtom({command:r,args:F,style:this.style,mode:this.parseMode}),I&&(g.body=se(this.scanArgument(I)));else if(typeof b.applyStyle=="function"){const $=Q(Q({},this.style),b.applyStyle(r,F,this.context)),it=this.parseMode;if(b.applyMode&&(this.parseMode=b.applyMode),I){const gt=this.style;this.style=$;const _t=this.scanArgument(I);return this.style=gt,this.parseMode=it,se(_t)}this.style=$}else g=new oi({type:"mord",command:(u=b.command)!=null?u:r,style:Q({},this.style),value:r,mode:(d=b.applyMode)!=null?d:this.parseMode})}if(!g)return null;if(g instanceof oi&&g.verbatimLatex===void 0&&!/^\\(llap|rlap|class|cssId|htmlData)$/.test(r)){const N=fr([r,Ah(this.tokens.slice(M,this.index))]);N&&(g.verbatimLatex=N)}if(g.verbatimLatex===null&&(g.verbatimLatex=void 0),g.isFunction&&this.smartFence){const N=this.scanSmartFence();if(N)return[g,N]}return[g]}scanSymbolCommandOrLiteral(){const r=this.get();if(!r)return null;if(Hr(r)){const o=cl.createAtom(this.parseMode,r,Q({},this.style));if(!o)return null;if(o.isFunction&&this.smartFence){const u=this.scanSmartFence();if(u)return[o,u]}return[o]}return r.startsWith("\\")?this.scanSymbolOrCommand(r):r==="<space>"?this.parseMode==="text"?[new nh(" "," ",this.style)]:null:(r==="<}>"?this.onError({latex:"",code:"unbalanced-braces"}):this.onError({latex:"",code:"unexpected-token",arg:r}),null)}scanMacro(r){var o;const u=this.context.getMacro(r);if(!u)return null;const d=this.index,g=u.args,b={"?":(o=this.args)==null?void 0:o.call(this,"?")};for(let M=1;M<=g;M++){let N=this.scanLiteralGroup();if(!N){const I=this.index;this.scanExpression(),N=Ah(this.tokens.slice(I,this.index))}b[M]=N}return new $d(r,{expand:u.expand,captureSelection:u.captureSelection,args:d===this.index?null:Ah(this.tokens.slice(d,this.index)),style:this.parsingContext.style,body:vs(u.def,{context:this.context,parseMode:this.parseMode,args:M=>b[M],mathstyle:this.parsingContext.mathstyle,style:this.parsingContext.style})})}parseExpression(){var r,o,u,d;let g=(d=(u=(o=(r=this.scanEnvironment())!=null?r:this.scanModeShift())!=null?o:this.scanModeSet())!=null?u:this.scanGroup())!=null?d:this.scanLeftRight();if(g===null){if(this.parseSupSub()||this.parseLimits())return!0;g=this.scanSymbolCommandOrLiteral()}return g?(Array.isArray(g)?this.mathlist.push(...g):this.mathlist.push(g),!0):!1}};function vs(r,o){var u,d,g,b;const M=(u=o==null?void 0:o.args)!=null?u:void 0,N=new Us(eh(r,M),o==null?void 0:o.context,{args:M,mathstyle:(d=o==null?void 0:o.mathstyle)!=null?d:"displaystyle",parseMode:(g=o==null?void 0:o.parseMode)!=null?g:"math",style:(b=o==null?void 0:o.style)!=null?b:{}}),I=[];for(;!N.end();)I.push(...N.scan(()=>!1));return I}function ed(r,o){var u;const d=new Us(eh(r,null),o==null?void 0:o.context,{mathstyle:"displaystyle",parseMode:(u=o==null?void 0:o.parseMode)!=null?u:"math"});for(;!d.end();)d.scan();return d.errors}var Rv=class b2 extends oi{constructor(o,u){super({type:"chem"},{command:o,mode:"math"});const d=ts.go(fi.go(u,o==="\\pu"?"pu":"ce"),!1);this.body=vs(d),this._verbatimLatex=o+"{"+u+"}",this.arg=u,this.captureSelection=!0}static fromJson(o){return new b2(o.command,o.arg)}set verbatimLatex(o){}get verbatimLatex(){return this._verbatimLatex}toJson(){return rt(Q({},super.toJson()),{arg:this.arg})}render(o){const u=oi.createBox(o,this.body,{type:"inner"});return this.caret&&(u.caret=this.caret),this.bind(o,u)}_serialize(o){return console.assert(this.verbatimLatex!==void 0),this.verbatimLatex}};qt(["ce","pu"],"{chemformula:balanced-string}",{createAtom:r=>{var o;return new Rv(r.command,(o=r.args[0])!=null?o:"")}});var fi={go:function(r,o){if(!r)return[];o===void 0&&(o="ce");var u="0",d={};d.parenthesisLevel=0,r=r.replace(/\n/g," "),r=r.replace(/[\u2212\u2013\u2014\u2010]/g,"-"),r=r.replace(/[\u2026]/g,"...");for(var g,b=10,M=[];;){g!==r?(b=10,g=r):b--;var N=fi.stateMachines[o],I=N.transitions[u]||N.transitions["*"];t:for(var F=0;F<I.length;F++){var $=fi.patterns.match_(I[F].pattern,r);if($){for(var it=I[F].task,gt=0;gt<it.action_.length;gt++){var _t;if(N.actions[it.action_[gt].type_])_t=N.actions[it.action_[gt].type_](d,$.match_,it.action_[gt].option);else if(fi.actions[it.action_[gt].type_])_t=fi.actions[it.action_[gt].type_](d,$.match_,it.action_[gt].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+it.action_[gt].type_+")"];fi.concatArray(M,_t)}if(u=it.nextState||u,r.length>0){if(it.revisit||(r=$.remainder),!it.toContinue)break t}else return M}}if(b<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(r,o){if(o)if(Object.prototype.toString.call(o)==="[object Array]")for(var u=0;u<o.length;u++)r.push(o[u]);else r.push(o)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(r){var o=r.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return o&&o[0]?{match_:o.slice(1),remainder:r.substr(o[0].length)}:null},"(-)(9)^(-9)":function(r){var o=r.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return o&&o[0]?{match_:o.slice(1),remainder:r.substr(o[0].length)}:null},"state of aggregation $":function(r){var o=fi.patterns.findObserveGroups(r,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(o&&o.remainder.match(/^($|[\s,;\)\]\}])/))return o;var u=r.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return u?{match_:u[0],remainder:r.substr(u[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(r){return fi.patterns.findObserveGroups(r,"^{","","","}")},"^($...$)":function(r){return fi.patterns.findObserveGroups(r,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(r){return fi.patterns.findObserveGroups(r,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(r){return fi.patterns.findObserveGroups(r,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(r){return fi.patterns.findObserveGroups(r,"_{","","","}")},"_($...$)":function(r){return fi.patterns.findObserveGroups(r,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(r){return fi.patterns.findObserveGroups(r,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(r){return fi.patterns.findObserveGroups(r,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(r){return fi.patterns.findObserveGroups(r,"","{","}","")},"{(...)}":function(r){return fi.patterns.findObserveGroups(r,"{","","","}")},"$...$":function(r){return fi.patterns.findObserveGroups(r,"","$","$","")},"${(...)}$":function(r){return fi.patterns.findObserveGroups(r,"${","","","}$")},"$(...)$":function(r){return fi.patterns.findObserveGroups(r,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(r){return fi.patterns.findObserveGroups(r,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(r){return fi.patterns.findObserveGroups(r,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(r){return fi.patterns.findObserveGroups(r,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(r){return fi.patterns.findObserveGroups(r,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(r){return fi.patterns.findObserveGroups(r,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(r){return fi.patterns.findObserveGroups(r,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(r){return fi.patterns.findObserveGroups(r,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(r){return fi.patterns.findObserveGroups(r,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(r){return fi.patterns.findObserveGroups(r,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(r){return fi.patterns.findObserveGroups(r,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(r){return fi.patterns.findObserveGroups(r,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(r){return fi.patterns.findObserveGroups(r,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(r){var o;if(o=r.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/),o)return{match_:o[0],remainder:r.substr(o[0].length)};var u=fi.patterns.findObserveGroups(r,"","$","$","");return u&&(o=u.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/),o)?{match_:o[0],remainder:r.substr(o[0].length)}:null},amount2:function(r){return this.amount(r)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(r){if(r.match(/^\([a-z]+\)$/))return null;var o=r.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return o?{match_:o[0],remainder:r.substr(o[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(r,o,u,d,g,b,M,N,I,F){var $=function(Ee,hi){if(typeof hi=="string")return Ee.indexOf(hi)!==0?null:hi;var $i=Ee.match(hi);return $i?$i[0]:null},it=function(Ee,hi,$i){for(var xi=0;hi<Ee.length;){var bn=Ee.charAt(hi),Rn=$(Ee.substr(hi),$i);if(Rn!==null&&xi===0)return{endMatchBegin:hi,endMatchEnd:hi+Rn.length};if(bn==="{")xi++;else if(bn==="}"){if(xi===0)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];xi--}hi++}return xi>0,null},gt=$(r,o);if(gt===null||(r=r.substr(gt.length),gt=$(r,u),gt===null))return null;var _t=it(r,gt.length,d||g);if(_t===null)return null;var zt=r.substring(0,d?_t.endMatchEnd:_t.endMatchBegin);if(b||M){var Ne=this.findObserveGroups(r.substr(_t.endMatchEnd),b,M,N,I);if(Ne===null)return null;var Bi=[zt,Ne.match_];return{match_:F?Bi.join(""):Bi,remainder:Ne.remainder}}else return{match_:zt,remainder:r.substr(_t.endMatchEnd)}},match_:function(r,o){var u=fi.patterns.patterns[r];if(u===void 0)throw["MhchemBugP","mhchem bug P. Please report. ("+r+")"];if(typeof u=="function")return fi.patterns.patterns[r](o);var d=o.match(u);if(d){var g;return d[2]?g=[d[1],d[2]]:d[1]?g=d[1]:g=d[0],{match_:g,remainder:o.substr(d[0].length)}}return null}},actions:{"a=":function(r,o){r.a=(r.a||"")+o},"b=":function(r,o){r.b=(r.b||"")+o},"p=":function(r,o){r.p=(r.p||"")+o},"o=":function(r,o){r.o=(r.o||"")+o},"q=":function(r,o){r.q=(r.q||"")+o},"d=":function(r,o){r.d=(r.d||"")+o},"rm=":function(r,o){r.rm=(r.rm||"")+o},"text=":function(r,o){r.text_=(r.text_||"")+o},insert:function(r,o,u){return{type_:u}},"insert+p1":function(r,o,u){return{type_:u,p1:o}},"insert+p1+p2":function(r,o,u){return{type_:u,p1:o[0],p2:o[1]}},copy:function(r,o){return o},rm:function(r,o){return{type_:"rm",p1:o||""}},text:function(r,o){return fi.go(o,"text")},"{text}":function(r,o){var u=["{"];return fi.concatArray(u,fi.go(o,"text")),u.push("}"),u},"tex-math":function(r,o){return fi.go(o,"tex-math")},"tex-math tight":function(r,o){return fi.go(o,"tex-math tight")},bond:function(r,o,u){return{type_:"bond",kind_:u||o}},"color0-output":function(r,o){return{type_:"color0",color:o[0]}},ce:function(r,o){return fi.go(o)},"1/2":function(r,o){var u=[];o.match(/^[+\-]/)&&(u.push(o.substr(0,1)),o=o.substr(1));var d=o.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return d[1]=d[1].replace(/\$/g,""),u.push({type_:"frac",p1:d[1],p2:d[2]}),d[3]&&(d[3]=d[3].replace(/\$/g,""),u.push({type_:"tex-math",p1:d[3]})),u},"9,9":function(r,o){return fi.go(o,"9,9")}},createTransitions:function(r){var o,u,d,g,b={};for(o in r)for(u in r[o])for(d=u.split("|"),r[o][u].stateArray=d,g=0;g<d.length;g++)b[d[g]]=[];for(o in r)for(u in r[o])for(d=r[o][u].stateArray||[],g=0;g<d.length;g++){var M=r[o][u];if(M.action_){M.action_=[].concat(M.action_);for(var N=0;N<M.action_.length;N++)typeof M.action_[N]=="string"&&(M.action_[N]={type_:M.action_[N]})}else M.action_=[];for(var I=o.split("|"),F=0;F<I.length;F++)if(d[g]==="*")for(var $ in b)b[$].push({pattern:I[F],task:M});else b[d[g]].push({pattern:I[F],task:M})}return b},stateMachines:{}};fi.stateMachines={ce:{transitions:fi.createTransitions({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(r,o){var u;if((r.d||"").match(/^[0-9]+$/)){var d=r.d;r.d=void 0,u=this.output(r),r.b=d}else u=this.output(r);return fi.actions["o="](r,o),u},"d= kv":function(r,o){r.d=o,r.dType="kv"},"charge or bond":function(r,o){if(r.beginsWithBond){var u=[];return fi.concatArray(u,this.output(r)),fi.concatArray(u,fi.actions.bond(r,o,"-")),u}else r.d=o},"- after o/d":function(r,o,u){var d=fi.patterns.match_("orbital",r.o||""),g=fi.patterns.match_("one lowercase greek letter $",r.o||""),b=fi.patterns.match_("one lowercase latin letter $",r.o||""),M=fi.patterns.match_("$one lowercase latin letter$ $",r.o||""),N=o==="-"&&(d&&d.remainder===""||g||b||M);N&&!r.a&&!r.b&&!r.p&&!r.d&&!r.q&&!d&&b&&(r.o="$"+r.o+"$");var I=[];return N?(fi.concatArray(I,this.output(r)),I.push({type_:"hyphen"})):(d=fi.patterns.match_("digits",r.d||""),u&&d&&d.remainder===""?(fi.concatArray(I,fi.actions["d="](r,o)),fi.concatArray(I,this.output(r))):(fi.concatArray(I,this.output(r)),fi.concatArray(I,fi.actions.bond(r,o,"-")))),I},"a to o":function(r){r.o=r.a,r.a=void 0},"sb=true":function(r){r.sb=!0},"sb=false":function(r){r.sb=!1},"beginsWithBond=true":function(r){r.beginsWithBond=!0},"beginsWithBond=false":function(r){r.beginsWithBond=!1},"parenthesisLevel++":function(r){r.parenthesisLevel++},"parenthesisLevel--":function(r){r.parenthesisLevel--},"state of aggregation":function(r,o){return{type_:"state of aggregation",p1:fi.go(o,"o")}},comma:function(r,o){var u=o.replace(/\s*$/,""),d=u!==o;return d&&r.parenthesisLevel===0?{type_:"comma enumeration L",p1:u}:{type_:"comma enumeration M",p1:u}},output:function(r,o,u){var d;if(!r.r)d=[],!r.a&&!r.b&&!r.p&&!r.o&&!r.q&&!r.d&&!u||(r.sb&&d.push({type_:"entitySkip"}),!r.o&&!r.q&&!r.d&&!r.b&&!r.p&&u!==2?(r.o=r.a,r.a=void 0):!r.o&&!r.q&&!r.d&&(r.b||r.p)?(r.o=r.a,r.d=r.b,r.q=r.p,r.a=r.b=r.p=void 0):r.o&&r.dType==="kv"&&fi.patterns.match_("d-oxidation$",r.d||"")?r.dType="oxidation":r.o&&r.dType==="kv"&&!r.q&&(r.dType=void 0),d.push({type_:"chemfive",a:fi.go(r.a,"a"),b:fi.go(r.b,"bd"),p:fi.go(r.p,"pq"),o:fi.go(r.o,"o"),q:fi.go(r.q,"pq"),d:fi.go(r.d,r.dType==="oxidation"?"oxidation":"bd"),dType:r.dType}));else{var g;r.rdt==="M"?g=fi.go(r.rd,"tex-math"):r.rdt==="T"?g=[{type_:"text",p1:r.rd||""}]:g=fi.go(r.rd);var b;r.rqt==="M"?b=fi.go(r.rq,"tex-math"):r.rqt==="T"?b=[{type_:"text",p1:r.rq||""}]:b=fi.go(r.rq),d={type_:"arrow",r:r.r,rd:g,rq:b}}for(var M in r)M!=="parenthesisLevel"&&M!=="beginsWithBond"&&delete r[M];return d},"oxidation-output":function(r,o){var u=["{"];return fi.concatArray(u,fi.go(o,"oxidation")),u.push("}"),u},"frac-output":function(r,o){return{type_:"frac-ce",p1:fi.go(o[0]),p2:fi.go(o[1])}},"overset-output":function(r,o){return{type_:"overset",p1:fi.go(o[0]),p2:fi.go(o[1])}},"underset-output":function(r,o){return{type_:"underset",p1:fi.go(o[0]),p2:fi.go(o[1])}},"underbrace-output":function(r,o){return{type_:"underbrace",p1:fi.go(o[0]),p2:fi.go(o[1])}},"color-output":function(r,o){return{type_:"color",color1:o[0],color2:fi.go(o[1])}},"r=":function(r,o){r.r=o},"rdt=":function(r,o){r.rdt=o},"rd=":function(r,o){r.rd=o},"rqt=":function(r,o){r.rqt=o},"rq=":function(r,o){r.rq=o},operator:function(r,o,u){return{type_:"operator",kind_:u||o}}}},a:{transitions:fi.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},"$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:fi.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"{text}"}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:fi.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(r){if(r.text_){var o={type_:"text",p1:r.text_};for(var u in r)delete r[u];return o}}}},pq:{transitions:fi.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(r,o){return{type_:"state of aggregation subscript",p1:fi.go(o,"o")}},"color-output":function(r,o){return{type_:"color",color1:o[0],color2:fi.go(o[1],"pq")}}}},bd:{transitions:fi.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(r,o){return{type_:"color",color1:o[0],color2:fi.go(o[1],"bd")}}}},oxidation:{transitions:fi.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(r,o){return{type_:"roman numeral",p1:o||""}}}},"tex-math":{transitions:fi.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(r){if(r.o){var o={type_:"tex-math",p1:r.o};for(var u in r)delete r[u];return o}}}},"tex-math tight":{transitions:fi.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(r,o){r.o=(r.o||"")+"{"+o+"}"},output:function(r){if(r.o){var o={type_:"tex-math",p1:r.o};for(var u in r)delete r[u];return o}}}},"9,9":{transitions:fi.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:fi.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(r,o){var u=[];return o[0]==="+-"||o[0]==="+/-"?u.push("\\pm "):o[0]&&u.push(o[0]),o[1]&&(fi.concatArray(u,fi.go(o[1],"pu-9,9")),o[2]&&(o[2].match(/[,.]/)?fi.concatArray(u,fi.go(o[2],"pu-9,9")):u.push(o[2])),(o[3]||o[4])&&(o[3]==="e"||o[4]==="*"?u.push({type_:"cdot"}):u.push({type_:"times"}))),o[5]&&u.push("10^{"+o[5]+"}"),u},"number^":function(r,o){var u=[];return o[0]==="+-"||o[0]==="+/-"?u.push("\\pm "):o[0]&&u.push(o[0]),fi.concatArray(u,fi.go(o[1],"pu-9,9")),u.push("^{"+o[2]+"}"),u},operator:function(r,o,u){return{type_:"operator",kind_:u||o}},space:function(){return{type_:"pu-space-1"}},output:function(r){var o,u=fi.patterns.match_("{(...)}",r.d||"");u&&u.remainder===""&&(r.d=u.match_);var d=fi.patterns.match_("{(...)}",r.q||"");if(d&&d.remainder===""&&(r.q=d.match_),r.d&&(r.d=r.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),r.d=r.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),r.q){r.q=r.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),r.q=r.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var g={d:fi.go(r.d,"pu"),q:fi.go(r.q,"pu")};r.o==="//"?o={type_:"pu-frac",p1:g.d,p2:g.q}:(o=g.d,g.d.length>1||g.q.length>1?o.push({type_:" / "}):o.push({type_:"/"}),fi.concatArray(o,g.q))}else o=fi.go(r.d,"pu-2");for(var b in r)delete r[b];return o}}},"pu-2":{transitions:fi.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(r,o){r.rm+="^{"+o+"}"},space:function(){return{type_:"pu-space-2"}},output:function(r){var o=[];if(r.rm){var u=fi.patterns.match_("{(...)}",r.rm||"");u&&u.remainder===""?o=fi.go(u.match_,"pu"):o={type_:"rm",p1:r.rm}}for(var d in r)delete r[d];return o}}},"pu-9,9":{transitions:fi.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(r){var o=[];if(r.text_=r.text_||"",r.text_.length>4){var u=r.text_.length%3;u===0&&(u=3);for(var d=r.text_.length-3;d>0;d-=3)o.push(r.text_.substr(d,3)),o.push({type_:"1000 separator"});o.push(r.text_.substr(0,u)),o.reverse()}else o.push(r.text_);for(var g in r)delete r[g];return o},"output-o":function(r){var o=[];if(r.text_=r.text_||"",r.text_.length>4){for(var u=r.text_.length-3,d=0;d<u;d+=3)o.push(r.text_.substr(d,3)),o.push({type_:"1000 separator"});o.push(r.text_.substr(d))}else o.push(r.text_);for(var g in r)delete r[g];return o}}}};var ts={go:function(r,o){if(!r)return"";for(var u="",d=!1,g=0;g<r.length;g++){var b=r[g];typeof b=="string"?u+=b:(u+=ts._go2(b),b.type_==="1st-level escape"&&(d=!0))}return!o&&!d&&u&&(u="{"+u+"}"),u},_goInner:function(r){return r&&ts.go(r,!0)},_go2:function(r){var o;switch(r.type_){case"chemfive":o="";var u={a:ts._goInner(r.a),b:ts._goInner(r.b),p:ts._goInner(r.p),o:ts._goInner(r.o),q:ts._goInner(r.q),d:ts._goInner(r.d)};u.a&&(u.a.match(/^[+\-]/)&&(u.a="{"+u.a+"}"),o+=u.a+"\\,"),(u.b||u.p)&&(o+="{\\vphantom{X}}",o+="^{\\hphantom{"+(u.b||"")+"}}_{\\hphantom{"+(u.p||"")+"}}",o+="{\\vphantom{X}}",o+="^{\\smash[t]{\\vphantom{2}}\\llap{"+(u.b||"")+"}}",o+="_{\\vphantom{2}\\llap{\\smash[t]{"+(u.p||"")+"}}}"),u.o&&(u.o.match(/^[+\-]/)&&(u.o="{"+u.o+"}"),o+=u.o),r.dType==="kv"?((u.d||u.q)&&(o+="{\\vphantom{X}}"),u.d&&(o+="^{"+u.d+"}"),u.q&&(o+="_{\\smash[t]{"+u.q+"}}")):r.dType==="oxidation"?(u.d&&(o+="{\\vphantom{X}}",o+="^{"+u.d+"}"),u.q&&(o+="{\\vphantom{X}}",o+="_{\\smash[t]{"+u.q+"}}")):(u.q&&(o+="{\\vphantom{X}}",o+="_{\\smash[t]{"+u.q+"}}"),u.d&&(o+="{\\vphantom{X}}",o+="^{"+u.d+"}"));break;case"rm":o="\\mathrm{"+r.p1+"}";break;case"text":r.p1.match(/[\^_]/)?(r.p1=r.p1.replace(" ","~").replace("-","\\text{-}"),o="\\mathrm{"+r.p1+"}"):o="\\text{"+r.p1+"}";break;case"roman numeral":o="\\mathrm{"+r.p1+"}";break;case"state of aggregation":o="\\mskip2mu "+ts._goInner(r.p1);break;case"state of aggregation subscript":o="\\mskip1mu "+ts._goInner(r.p1);break;case"bond":if(o=ts._getBond(r.kind_),!o)throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+r.kind_+")"];break;case"frac":var d="\\frac{"+r.p1+"}{"+r.p2+"}";o="\\mathchoice{\\textstyle"+d+"}{"+d+"}{"+d+"}{"+d+"}";break;case"pu-frac":var g="\\frac{"+ts._goInner(r.p1)+"}{"+ts._goInner(r.p2)+"}";o="\\mathchoice{\\textstyle"+g+"}{"+g+"}{"+g+"}{"+g+"}";break;case"tex-math":o=r.p1+" ";break;case"frac-ce":o="\\frac{"+ts._goInner(r.p1)+"}{"+ts._goInner(r.p2)+"}";break;case"overset":o="\\overset{"+ts._goInner(r.p1)+"}{"+ts._goInner(r.p2)+"}";break;case"underset":o="\\underset{"+ts._goInner(r.p1)+"}{"+ts._goInner(r.p2)+"}";break;case"underbrace":o="\\underbrace{"+ts._goInner(r.p1)+"}_{"+ts._goInner(r.p2)+"}";break;case"color":o="{\\color{"+r.color1+"}{"+ts._goInner(r.color2)+"}}";break;case"color0":o="\\color{"+r.color+"}";break;case"arrow":var b={rd:ts._goInner(r.rd),rq:ts._goInner(r.rq)},M=ts._getArrow(r.r);b.rd||b.rq?r.r==="<=>"||r.r==="<=>>"||r.r==="<<=>"||r.r==="<-->"?(M="\\long"+M,b.rd&&(M="\\overset{"+b.rd+"}{"+M+"}"),b.rq&&(r.r==="<-->"?M="\\underset{\\lower2mu{"+b.rq+"}}{"+M+"}":M="\\underset{\\lower6mu{"+b.rq+"}}{"+M+"}"),M=" {}\\mathrel{"+M+"}{} "):(b.rq&&(M+="[{"+b.rq+"}]"),M+="{"+b.rd+"}",M=" {}\\mathrel{\\x"+M+"}{} "):M=" {}\\mathrel{\\long"+M+"}{} ",o=M;break;case"operator":o=ts._getOperator(r.kind_);break;case"1st-level escape":o=r.p1+" ";break;case"space":o=" ";break;case"entitySkip":o="~";break;case"pu-space-1":o="~";break;case"pu-space-2":o="\\mkern3mu ";break;case"1000 separator":o="\\mkern2mu ";break;case"commaDecimal":o="{,}";break;case"comma enumeration L":o="{"+r.p1+"}\\mkern6mu ";break;case"comma enumeration M":o="{"+r.p1+"}\\mkern3mu ";break;case"comma enumeration S":o="{"+r.p1+"}\\mkern1mu ";break;case"hyphen":o="\\text{-}";break;case"addition compound":o="\\,{\\cdot}\\,";break;case"electron dot":o="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":o="{\\times}";break;case"prime":o="\\prime ";break;case"cdot":o="\\cdot ";break;case"tight cdot":o="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":o="\\times ";break;case"circa":o="{\\sim}";break;case"^":o="uparrow";break;case"v":o="downarrow";break;case"ellipsis":o="\\ldots ";break;case"/":o="/";break;case" / ":o="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return o},_getArrow:function(r){switch(r){case"->":return"rightarrow";case"\u2192":return"rightarrow";case"\u27F6":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<-->":return"leftrightarrows";case"<=>":return"rightleftharpoons";case"\u21CC":return"rightleftharpoons";case"<=>>":return"Rightleftharpoons";case"<<=>":return"Leftrightharpoons";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(r){switch(r){case"-":return"{-}";case"1":return"{-}";case"=":return"{=}";case"2":return"{=}";case"#":return"{\\equiv}";case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";case"~=":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"~--":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"-~-":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(r){switch(r){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":return" {}\\approx{} ";case"$\\approx$":return" {}\\approx{} ";case"v":return" \\downarrow{} ";case"(v)":return" \\downarrow{} ";case"^":return" \\uparrow{} ";case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}};function id(r){}function zv(r){}var Xf=class S2 extends oi{constructor(o){super(rt(Q({},o),{type:"delim"})),this.value=o.delim,this.size=o.size}static fromJson(o){return new S2(o)}toJson(){return rt(Q({},super.toJson()),{delim:this.value,size:this.size})}render(o){return new zi(this.value,{type:"middle"})}_serialize(o){if(!(o.expandMacro||o.skipStyles||o.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const u=we(this.command,this.mode);return u!=null&&u.serialize?u.serialize(this,o):Vo(this.command,this.value)}},Kd=class M2 extends oi{constructor(o){super(rt(Q({},o),{type:"sizeddelim",value:o.delim})),this.delimType=o.delimType,this.size=o.size}static fromJson(o){return new M2(o)}toJson(){return rt(Q({},super.toJson()),{delim:this.value,size:this.size,delimType:this.delimType})}render(o){let u=ie(this.value,this.size,o,{classes:{open:"mopen",close:"mclose"}[this.delimType],type:this.delimType,isSelected:this.isSelected});return u?(u=this.bind(o,u),this.caret&&(u.caret=this.caret),u):null}_serialize(o){if(!(o.expandMacro||o.skipStyles||o.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const u=we(this.command,this.mode);return u!=null&&u.serialize?u.serialize(this,o):Vo(this.command,this.value)}},Eu=class C2 extends oi{constructor(o,u,d,g){var b,M;super({type:"enclose",command:o,style:g.style}),this.body=u,this.backgroundcolor=g.backgroundcolor,d.updiagonalarrow&&(d.updiagonalstrike=!1),d.box&&(d.left=!1,d.right=!1,d.bottom=!1,d.top=!1),this.notation=d,this.shadow=(b=g.shadow)!=null?b:"none",this.strokeWidth=(M=g.strokeWidth)!=null?M:"0.06em",this.strokeWidth||(this.strokeWidth="0.06em"),this.strokeStyle=g.strokeStyle,this.svgStrokeStyle=g.svgStrokeStyle,this.strokeColor=g.strokeColor,this.borderStyle=g.borderStyle,this.padding=g.padding,this.captureSelection=!1}static fromJson(o){return new C2(o.command,o.body,o.notation,o)}toJson(){return rt(Q({},super.toJson()),{notation:this.notation,shadow:this.shadow,strokeWidth:this.strokeWidth,strokeStyle:this.strokeStyle,svgStrokeStyle:this.svgStrokeStyle,strokeColor:this.strokeColor,borderStyle:this.borderStyle,padding:this.padding})}_serialize(o){var u;if(!(o.expandMacro||o.skipStyles||o.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const d=we(this.command,this.mode);if(d!=null&&d.serialize)return d.serialize(this,o);let g=(u=this.command)!=null?u:"";if(this.command==="\\enclose"){g+="{"+Object.keys(this.notation).join(" ")+"}";let b="",M="";this.backgroundcolor&&this.backgroundcolor!=="transparent"&&(b+=M+'mathbackground="'+this.backgroundcolor+'"',M=","),this.shadow&&this.shadow!=="auto"&&(b+=M+'shadow="'+this.shadow+'"',M=","),this.strokeWidth||this.strokeStyle!=="solid"?(b+=M+this.borderStyle,M=","):this.strokeColor&&this.strokeColor!=="currentColor"&&(b+=M+'mathcolor="'+this.strokeColor+'"',M=","),b&&(g+=`[${b}]`)}return Vo(g,this.bodyToLatex(o))}render(o){const u=new Dr({parent:o},this.style),d=oi.createBox(u,this.body);if(!d)return null;const g=Vd(this.borderStyle),b=u.toEm(!this.padding||this.padding==="auto"?{register:"fboxsep"}:{string:this.padding});d.setStyle("position","relative"),d.setStyle("display","inline-block"),d.setStyle("top",b,"em"),d.setStyle("height",d.height+d.depth,"em"),d.setStyle("width",d.width,"em");const M=new zi(null,{classes:"ML__notation"});let N=d.height+d.depth+2*b;const I=d.width+2*b;let F="";if(this.notation.horizontalstrike&&(F+=this.line(3,50,97,50)),this.notation.verticalstrike&&(F+=this.line(50,3,50,97)),this.notation.updiagonalstrike&&(F+=this.line(3,97,97,3)),this.notation.downdiagonalstrike&&(F+=this.line(3,3,97,97)),this.notation.updiagonalarrow){F+=this.line(b.toString(),(b+d.depth+d.height).toString(),(b+d.width).toString(),b.toString());const zt=.03*Math.sqrt(I*I+N*N)*1,Ne=d.width*zt,Bi=(d.depth+d.height)*zt,Ee=b+d.width;let hi=b;hi+Bi-.4*Ne<0&&(hi=.4*Ne-Bi),F+='<polygon points="',F+=`${Ee},${hi} ${Ee-Ne-.4*Bi},${hi+Bi-.4*Ne} `,F+=`${Ee-.7*Ne},${hi+.7*Bi} ${Ee-Ne+.4*Bi},${hi+Bi+.4*Ne} `,F+=`${Ee},${hi}`,F+=`" stroke='none' fill="${this.strokeColor}"`,F+="/>"}let $=0;if(this.notation.phasorangle){const gt=su(u),_t=(d.height+d.depth+2*gt+b).toString(),zt=(d.height+d.depth)/2;F+=this.line(b.toString(),_t,(b+zt+d.width).toString(),_t),F+=this.line(b.toString(),_t,(b+zt).toString(),(b-gt).toString()),N+=gt,$=zt,d.left+=N/2-b}if(this.notation.longdiv){const gt=su(u);N+=gt,F+=this.line(b.toString(),b.toString(),(b+d.width).toString(),b.toString());const _t=.3;$=_t+gt,d.left+=_t+gt,d.setTop(b+gt),F+='<path d="',F+=`M ${b} ${b} a${_t} ${(d.depth+d.height+2*gt)/2}, 0, 1, 1, 0 ${d.depth+d.height+2*gt} "`,F+=` stroke-width="${Yf(u)}" stroke="${this.strokeColor}" fill="none"`,F+="/>"}if(M.width=d.width+2*b+$,M.height=d.height+b,M.depth=d.depth+b,M.setStyle("box-sizing","border-box"),M.setStyle("left",`calc(-${g} / 2 )`),M.setStyle("height",`${Math.floor(100*N)/100}em`),M.setStyle("top",`calc(${g} / 2 )`),this.backgroundcolor&&M.setStyle("background-color",this.backgroundcolor),this.notation.box&&M.setStyle("border","1px solid red"),this.notation.actuarial&&(M.setStyle("border-top",this.borderStyle),M.setStyle("border-right",this.borderStyle)),this.notation.madruwb&&(M.setStyle("border-bottom",this.borderStyle),M.setStyle("border-right",this.borderStyle)),this.notation.roundedbox&&(M.setStyle("border-radius","8px"),M.setStyle("border",this.borderStyle)),this.notation.circle&&(M.setStyle("border-radius","50%"),M.setStyle("border",this.borderStyle)),this.notation.top&&M.setStyle("border-top",this.borderStyle),this.notation.left&&M.setStyle("border-left",this.borderStyle),this.notation.right&&M.setStyle("border-right",this.borderStyle),this.notation.bottom&&M.setStyle("border-bottom",this.borderStyle),F){let gt="";this.shadow==="auto"&&(gt+="filter: drop-shadow(0 0 .5px rgba(255, 255, 255, .7)) drop-shadow(1px 1px 2px #333)"),this.shadow!=="none"&&(gt+=`filter: drop-shadow(${this.shadow})`),gt+=` stroke-width="${this.strokeWidth}" stroke="${this.strokeColor}"`,gt+=' stroke-linecap="round"',this.svgStrokeStyle&&(gt+=` stroke-dasharray="${this.svgStrokeStyle}"`),M.svgStyle=gt,M.svgOverlay=F}const it=new zi([M,d]);return it.setStyle("position","relative"),it.setStyle("vertical-align",b,"em"),it.setStyle("height",`${Math.floor(100*(d.height+d.depth+2*b))/100}em`),it.setStyle("display","inline-block"),it.height=M.height,it.depth=M.depth,it.width=M.width-2*b,it.left=b,it.right=b,this.caret&&(it.caret=this.caret),it.wrap(u)}line(o,u,d,g){return`<line x1="${Hd(o)}" y1="${Hd(u)}" x2="${Hd(d)}" y2="${Hd(g)}" vector-effect="non-scaling-stroke"></line>`}};function Hd(r){return typeof r=="number"?`${Math.floor(100*r)/100}%`:r}function Vd(r){if(!r)return"1px";const o=r.match(/([0-9][a-zA-Z\%]+)/);return o===null?"1px":o[1]}function Yf(r){return(Math.floor(100*r.metrics.sqrtRuleThickness/r.scalingFactor)/100/10).toString()+"em"}function su(r){const o=r.isDisplayStyle?Ju:r.metrics.defaultRuleThickness;return r.metrics.defaultRuleThickness+r.scalingFactor*o/4}var Bs=class k2 extends oi{constructor(o,u,d){var g,b;super(rt(Q({},d),{type:"genfrac",displayContainsHighlight:!0})),this.above=o,this.below=u,this.hasBarLine=(g=d==null?void 0:d.hasBarLine)!=null?g:!0,this.continuousFraction=(b=d==null?void 0:d.continuousFraction)!=null?b:!1,this.numerPrefix=d==null?void 0:d.numerPrefix,this.denomPrefix=d==null?void 0:d.denomPrefix,this.mathstyleName=d==null?void 0:d.mathstyleName,this.leftDelim=d==null?void 0:d.leftDelim,this.rightDelim=d==null?void 0:d.rightDelim,this.fractionNavigationOrder=d==null?void 0:d.fractionNavigationOrder}static fromJson(o){return new k2(o.above,o.below,o)}toJson(){const o={};return this.continuousFraction&&(o.continuousFraction=!0),this.numerPrefix&&(o.numerPrefix=this.numerPrefix),this.denomPrefix&&(o.denomPrefix=this.denomPrefix),this.leftDelim&&(o.leftDelim=this.leftDelim),this.rightDelim&&(o.rightDelim=this.rightDelim),this.hasBarLine||(o.hasBarLine=!1),this.mathstyleName&&(o.mathstyleName=this.mathstyleName),this.fractionNavigationOrder&&(o.fractionNavigationOrder=this.fractionNavigationOrder),Q(Q({},super.toJson()),o)}get children(){if(this._children)return this._children;const o=[];if(this.fractionNavigationOrder==="denominator-numerator"){for(const u of this.below)o.push(...u.children),o.push(u);for(const u of this.above)o.push(...u.children),o.push(u)}else{for(const u of this.above)o.push(...u.children),o.push(u);for(const u of this.below)o.push(...u.children),o.push(u)}return this._children=o,o}render(o){var u,d;const g=new Dr({parent:o,mathstyle:this.mathstyleName},this.style),b=g.metrics,M=new Dr({parent:g,mathstyle:this.continuousFraction?"":"numerator"},this.style),N=this.numerPrefix?new zi([new zi(this.numerPrefix),oi.createBox(M,this.above)],{isTight:M.isTight,type:"ignore"}):(u=oi.createBox(M,this.above,{type:"ignore"}))!=null?u:new zi(null,{type:"ignore"}),I=new Dr({parent:g,mathstyle:this.continuousFraction?"":"denominator"},this.style),F=this.denomPrefix?new zi([new zi(this.denomPrefix),oi.createBox(I,this.below,{type:"ignore"})]):(d=oi.createBox(I,this.below,{type:"ignore"}))!=null?d:new zi(null,{type:"ignore"}),$=this.hasBarLine?b.defaultRuleThickness:0;let it,gt=0,_t;g.isDisplayStyle?(it=M.metrics.num1,gt=$>0?3*$:7*$,_t=I.metrics.denom1):($>0?(it=M.metrics.num2,gt=$):(it=M.metrics.num3,gt=3*b.defaultRuleThickness),_t=I.metrics.denom2);const zt=[];this.isSelected&&zt.push("ML__selected");const Ne=N.depth,Bi=F.height;let Ee;if($<=0){const En=it-Ne-(Bi-_t);En<gt&&(it+=(gt-En)/2,_t+=(gt-En)/2),Ee=new to({individualShift:[{box:N,shift:-it,classes:[...zt,"ML__center"]},{box:F,shift:_t,classes:[...zt,"ML__center"]}]}).wrap(g)}else{const En=new zi(null,{classes:"ML__frac-line",mode:this.mode,style:this.style});En.softWidth=Math.max(N.width,F.width),En.height=$/2,En.depth=$/2;const Fr=la+$/2;it<gt+Ne+Fr&&(it=gt+Ne+Fr);const Po=la-$/2;_t<gt+Bi-Po&&(_t=gt+Bi-Po),Ee=new to({individualShift:[{box:F,shift:_t,classes:[...zt,"ML__center"]},{box:En,shift:-Po,classes:zt},{box:N,shift:-it,classes:[...zt,"ML__center"]}]}).wrap(g)}const hi=g.isDisplayStyle?b.delim1:b.delim2,$i=this.leftDelim?this.bind(o,un("open",this.leftDelim,hi,!0,o,{style:this.style,mode:this.mode,isSelected:this.isSelected})):dn(g,"open");let xi=null;this.continuousFraction?xi=new zi(null,{type:"close"}):this.rightDelim?xi=this.bind(o,un("close",this.rightDelim,hi,!0,o,{style:this.style,mode:this.mode,isSelected:this.isSelected})):xi=dn(g,"close");const bn=new zi([$i,Ee,xi],{isTight:g.isTight,type:"inner",classes:"mfrac"}),Rn=this.bind(o,bn);return this.caret&&(Rn.caret=this.caret),this.attachSupsub(o,{base:Rn})}},Ea=class L2 extends oi{constructor(o,u){var d;super({type:"latex",value:o,mode:"latex"}),this.isSuggestion=(d=u==null?void 0:u.isSuggestion)!=null?d:!1,this.isError=!1}static fromJson(o){const u=new L2(o.value);return o.isSuggestion&&(u.isSuggestion=!0),o.isError&&(u.isError=!0),u}toJson(){const o={};return this.isSuggestion&&(o.isSuggestion=!0),this.isError&&(o.isError=!0),Q({type:"latex",value:this.value},o)}get computedStyle(){return{}}render(o){const u=new zi(this.value,{classes:this.isSuggestion?"ML__suggestion":this.isError?"ML__error":"",type:"latex",maxFontSize:1});return u?(this.caret&&(u.caret=this.caret),this.bind(o,u)):null}},Xp=class E2 extends oi{constructor(o){super({type:"latexgroup",mode:"latex"}),this.body=[...o].map(u=>new Ea(u)),this.skipBoundary=!1}static fromJson(o){return new E2("")}toJson(){return super.toJson()}render(o){const u=oi.createBox(o,this.body);return u?(this.caret&&(u.caret=this.caret),this.bind(o,u)):null}_serialize(o){var u,d;return(d=(u=this.body)==null?void 0:u.map(g=>g.value).join(""))!=null?d:""}},Sg=class _2 extends oi{constructor(o,u){super(rt(Q({},u),{type:"extensible-symbol",isFunction:u==null?void 0:u.isFunction})),this.value=o,this.variant=u==null?void 0:u.variant,this.subsupPlacement=u==null?void 0:u.limits}static fromJson(o){return new _2(o.symbol,o)}toJson(){const o=super.toJson();return this.variant&&(o.variant=this.variant),this.subsupPlacement&&(o.limits=this.subsupPlacement),this.isExtensibleSymbol&&(o.isExtensibleSymbol=!0),this.value&&(o.symbol=this.value),o}render(o){var u;const d=o.isDisplayStyle&&this.value!=="\\smallint",g=new zi(this.value,{fontFamily:d?"Size2-Regular":"Size1-Regular",classes:"op-symbol "+(d?"large-op":"small-op"),type:"op",maxFontSize:o.scalingFactor,isSelected:this.isSelected});if(!g)return null;g.right=g.italic;const b=(g.height-g.depth)/2-la*o.scalingFactor,M=g.italic;g.setTop(b);let N=g;if(this.superscript||this.subscript){const I=(u=this.subsupPlacement)!=null?u:"auto";N=I==="over-under"||I==="auto"&&o.isDisplayStyle?this.attachLimits(o,{base:g,baseShift:b,slant:M}):this.attachSupsub(o,{base:g})}return new zi(this.bind(o,N),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"op-group"}).wrap(o)}_serialize(o){if(!(o.expandMacro||o.skipStyles||o.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const u=we(this.command,this.mode);if(u!=null&&u.serialize)return u.serialize(this,o);const d=[];return d.push(this.command),this.explicitSubsupPlacement&&(this.subsupPlacement==="over-under"&&d.push("\\limits"),this.subsupPlacement==="adjacent"&&d.push("\\nolimits"),this.subsupPlacement==="auto"&&d.push("\\displaylimits")),d.push(this.supsubToLatex(o)),fr(d)}},lh=class T2 extends oi{constructor(o){const u=o.body;super(rt(Q({},o),{type:"overlap",body:typeof u=="string"?[new oi({value:u})]:u,style:o==null?void 0:o.style})),this.skipBoundary=!0,this.align=o==null?void 0:o.align,this.boxType=o==null?void 0:o.boxType}static fromJson(o){return new T2(o)}toJson(){const o={};return this.align&&(o.align=this.align),this.boxType&&(o.boxType=this.boxType),Q(Q({},super.toJson()),o)}render(o){const u=oi.createBox(o,this.body,{classes:"inner"});return u?(this.caret&&(u.caret=this.caret),this.bind(o,new zi([u,new zi(null,{classes:"fix"})],{classes:this.align==="right"?"rlap":"llap",type:this.boxType}))):null}},au=class P2 extends oi{constructor(o){var u,d,g,b;super({type:"overunder",command:o.command,style:o.style,mode:o.mode,body:o.body,skipBoundary:(u=o.skipBoundary)!=null?u:!0}),this.subsupPlacement=o.supsubPlacement,this.svgAbove=o.svgAbove,this.svgBelow=o.svgBelow,this.svgBody=o.svgBody,this.above=o.above,this.below=o.below,this.boxType=(d=o.boxType)!=null?d:"ord",this.paddedBody=(g=o.paddedBody)!=null?g:!1,this.paddedLabels=(b=o.paddedLabels)!=null?b:!1}static fromJson(o){return new P2(o)}toJson(){const o=super.toJson();return this.skipBoundary||(o.skipBoundary=!1),this.subsupPlacement&&(o.subsupPlacement=this.subsupPlacement),this.svgAbove&&(o.svgAbove=this.svgAbove),this.svgBelow&&(o.svgBelow=this.svgBelow),this.svgBody&&(o.svgBody=this.svgBody),this.boxType!=="ord"&&(o.boxType=this.boxType),this.paddedBody&&(o.paddedBody=!0),this.paddedLabels&&(o.paddedLabels=!0),o}render(o){let u=this.svgBody?jl(this.svgBody):oi.createBox(o,this.body,{type:"ignore"});const d=new Dr({parent:o,mathstyle:"scriptstyle"},this.style);let g=null;this.svgAbove?g=jl(this.svgAbove):this.above&&(g=oi.createBox(d,this.above,{type:"ignore"}));let b=null;this.svgBelow?b=jl(this.svgBelow):this.below&&(b=oi.createBox(d,this.below,{type:"ignore"})),this.paddedBody&&(u=new zi([dn(o,"open"),u,dn(o,"close")],{type:"ignore"}));let M=Xy(o,{base:u,above:g,below:b,type:this.boxType==="bin"||this.boxType==="rel"?this.boxType:"ord",paddedAboveBelow:this.paddedLabels});return M?(this.subsupPlacement==="over-under"?M=this.attachLimits(o,{base:M,type:M.type}):M=this.attachSupsub(o,{base:M}),this.caret&&(M.caret=this.caret),this.bind(o,M)):null}};function Xy(r,o){if(!o.base)return null;if(!o.above&&!o.below){const N=new zi(o.base,{type:o.type});return N.setStyle("position","relative"),N}let u=0;o.above&&(u=r.metrics.bigOpSpacing5);let d=null;const g=o.base,b=0,M=["ML__center"];if(o.paddedAboveBelow&&M.push("ML__label_padding"),o.below&&o.above){const N=r.metrics.bigOpSpacing5+o.below.height+o.below.depth+g.depth+b;d=new to({bottom:N,children:[r.metrics.bigOpSpacing5,{box:o.below,classes:M},{box:g,classes:["ML__center"]},u,{box:o.above,classes:M},r.metrics.bigOpSpacing5]})}else o.below?d=new to({top:g.height-b,children:[r.metrics.bigOpSpacing5,{box:o.below,classes:M},{box:g,classes:["ML__center"]}]}):o.above&&(d=new to({bottom:g.depth+b,children:[{box:g,classes:["ML__center"]},u,{box:o.above,classes:M},r.metrics.bigOpSpacing5]}));return new zi(d,{type:o.type})}var Yp=class N2 extends oi{constructor(o){var u,d,g,b;super(rt(Q({},o),{type:"phantom"})),this.captureSelection=!0,this.isInvisible=(u=o.isInvisible)!=null?u:!1,this.smashDepth=(d=o.smashDepth)!=null?d:!1,this.smashHeight=(g=o.smashHeight)!=null?g:!1,this.smashWidth=(b=o.smashWidth)!=null?b:!1}static fromJson(o){return new N2(o)}toJson(){const o={};return this.isInvisible&&(o.isInvisible=!0),this.smashDepth&&(o.smashDepth=!0),this.smashHeight&&(o.smashHeight=!0),this.smashWidth&&(o.smashWidth=!0),Q(Q({},super.toJson()),o)}render(o){const u=new Dr({parent:o,isPhantom:!0});if(!this.smashDepth&&!this.smashHeight&&!this.smashWidth)return console.assert(this.isInvisible),oi.createBox(u,this.body,{classes:"inner"});const d=oi.createBox(this.isInvisible?u:o,this.body);if(!d)return null;if(this.smashWidth){const g=new zi(null,{classes:"fix"});return new zi([d,g],{classes:"rlap"}).wrap(o)}if(!this.smashHeight&&!this.smashDepth)return d;if(this.smashHeight&&(d.height=0),this.smashDepth&&(d.depth=0),d.children)for(const g of d.children)this.smashHeight&&(g.height=0),this.smashDepth&&(g.depth=0);return new to({firstBaseline:[{box:d}]},{type:d.type}).wrap(o)}},Jf=class A2 extends oi{constructor(o){var u;super(Q({type:"spacing"},o)),this.width=o==null?void 0:o.width,this._braced=(u=o==null?void 0:o.braced)!=null?u:!1}static fromJson(o){return new A2(o)}toJson(){const o=super.toJson();return this.width!==void 0&&(o.width=this.width),this._braced&&(o.braced=!0),o}render(o){var u;if(this.command==="space")return new zi(this.mode==="math"?null:" ");let d;if(this.width!==void 0)d=new zi(null,{classes:"mspace"}),d.left=o.toEm(this.width);else{const g=(u={"\\qquad":"qquad","\\quad":"quad","\\enspace":"enspace","\\;":"thickspace","\\:":"mediumspace","\\>":"mediumspace","\\,":"thinspace","\\!":"negativethinspace"}[this.command])!=null?u:"mediumspace";d=new zi(null,{classes:g})}return d=this.bind(o,d),this.caret&&(d.caret=this.caret),d}_serialize(o){var u;if(!o.expandMacro&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const d=we(this.command,this.mode);if(d!=null&&d.serialize)return d.serialize(this,o);const g=(u=this.command)!=null?u:"";return this.width===void 0?g:this._braced&&!("register"in this.width)?`${g}{${Ls(this.width)}}`:`${g}${Ls(this.width)}`}},Jp=class D2 extends oi{constructor(o){var u;super(rt(Q({},o),{type:"surd",mode:(u=o.mode)!=null?u:"math",style:o.style,displayContainsHighlight:!0,body:o.body})),this.above=o.index}static fromJson(o){return new D2(rt(Q({},o),{index:o.above}))}_serialize(o){if(!(o.expandMacro||o.skipStyles||o.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const u=we(this.command,this.mode);if(u!=null&&u.serialize)return u.serialize(this,o);const d=this.command,g=this.bodyToLatex(o);return this.above&&!this.hasEmptyBranch("above")?Vo(`${d}[${this.aboveToLatex(o)}]`,g):/^[0-9]$/.test(g)?`${d}${g}`:Vo(d,g)}get children(){if(this._children)return this._children;const o=[];if(this.above)for(const u of this.above)o.push(...u.children),o.push(u);if(this.body)for(const u of this.body)o.push(...u.children),o.push(u);return this._children=o,o}render(o){var u;const d=new Dr({parent:o,mathstyle:"cramp"},this.style),g=(u=oi.createBox(d,this.body,{type:"inner"}))!=null?u:new zi(null),b=d.scalingFactor,M=d.metrics.defaultRuleThickness/b,N=o.isDisplayStyle?Ju:M,I=new zi(null,{classes:"ML__sqrt-line",style:this.style});I.height=M,I.softWidth=g.width;let F=b*(M+N/4);const it=Math.max(b*2*N,g.height+g.depth)+F+M,gt=new Dr({parent:o},this.style),_t=this.bind(gt,new zi(un("inner","\\surd",it,!1,gt,{isSelected:this.isSelected}),{isSelected:this.isSelected,classes:"ML__sqrt-sign",style:this.style}));if(!_t)return null;const zt=_t.height+_t.depth-M;zt>g.height+g.depth+F&&(F=(F+zt-(g.height+g.depth))/2),_t.setTop(_t.height-g.height-F);const Ne=this.bind(o,new to({firstBaseline:[{box:new zi(g)},F-2*M,{box:I},M]})),Bi=oi.createBox(new Dr({parent:o,mathstyle:"scriptscriptstyle"}),this.above,{type:"ignore"});if(!Bi){const $i=new zi([_t,Ne],{classes:this.containsCaret?"ML__contains-caret":"",type:"inner"});return $i.setStyle("display","inline-block"),$i.setStyle("height",$i.height+$i.depth,"em"),this.caret&&($i.caret=this.caret),this.bind(o,$i)}const Ee=new to({shift:-.6*(Math.max(_t.height,Ne.height)-Math.max(_t.depth,Ne.depth)),children:[{box:Bi}]}),hi=new zi([new zi(Ee,{classes:"ML__sqrt-index",type:"ignore"}),_t,Ne],{type:"inner",classes:this.containsCaret?"ML__contains-caret":""});return hi.height=_t.height,hi.depth=_t.depth,this.caret&&(hi.caret=this.caret),this.bind(o,hi)}},Mg=class extends zi{constructor(r){super(null,{type:"skip"}),this._width=r}toMarkup(){return`<span style="display:inline-block;width:${Math.ceil(this.width*100)/100}em"></span>`}};function Vl(r,o){if(!r.parent)return;const u=r.parent.children,d=u.indexOf(r);let g=d-1;for(;g>=0&&u[g].type==="ignore";)g-=1;if(g<0&&r.parent.parent&&r.parent.type==="lift"){Vl(r.parent,o);return}d>0&&u[d-1].type==="skip"?u[d-1].width+=o:u.splice(d,0,new Mg(o))}var zh={ord:{op:3,bin:4,rel:5,inner:3},op:{ord:3,op:3,rel:5,inner:3},bin:{ord:4,op:4,open:4,inner:4},rel:{ord:5,op:5,open:5,inner:5},close:{op:3,bin:4,rel:5,inner:3},punct:{ord:3,op:3,rel:3,open:3,punct:3,inner:3},inner:{ord:3,op:3,bin:4,rel:5,open:3,punct:3,inner:3}},Cg={ord:{op:3},op:{ord:3,op:3},close:{op:3},inner:{op:3}};function Tl(r){cm(r,(o,u)=>{u.type==="bin"&&(!o||/^(middle|bin|op|rel|open|punct)$/.test(o.type))&&(u.type="ord"),(o==null?void 0:o.type)==="bin"&&/^(rel|close|punct)$/.test(u.type)&&(o.type="ord"),u.type!=="ignore"&&(o=u)})}function uh(r,o){if(!r.children)return r;const u=r.children;Tl(u);const d=o.getRegisterAsEm("thinmuskip"),g=o.getRegisterAsEm("medmuskip"),b=o.getRegisterAsEm("thickmuskip");return cm(u,(M,N)=>{var I,F,$;if(!M)return;const it=M.type,gt=N.isTight?(I=Cg[it])!=null?I:null:(F=zh[it])!=null?F:null,_t=($=gt==null?void 0:gt[N.type])!=null?$:null;_t===3&&Vl(N,d),_t===4&&Vl(N,g),_t===5&&Vl(N,b)}),r}function cm(r,o,u=void 0){if(!r)return u;r=[...r];for(const d of r)d.type==="lift"?u=cm(d.children,o,u):d.type==="ignore"?cm(d.children,o):(o(u,d),cm(d.children,o),u=d);return u}var qf=class I2 extends oi{constructor(o){super({type:"tooltip",command:o.command,mode:o.mode,style:o.style,body:o.body,displayContainsHighlight:!0}),this.tooltip=new oi({type:"root",mode:o.content,body:o.tooltip,style:{}}),this.skipBoundary=!0,this.captureSelection=!1}static fromJson(o){return new I2(rt(Q({},o),{tooltip:nd(o.tooltip)}))}toJson(){var o;const u=(o=this.tooltip.body)==null?void 0:o.filter(d=>d.type!=="first").map(d=>d.toJson());return rt(Q({},super.toJson()),{tooltip:u})}render(o){const u=oi.createBox(new Dr,this.body);if(!u)return null;const d=new Dr({parent:o,mathstyle:"displaystyle"},{fontSize:qu}),g=Dh(uh(new zi(this.tooltip.render(d),{classes:"ML__tooltip-content"}),d)),b=new zi([g,u],{classes:"ML__tooltip-container"});return this.caret&&(b.caret=this.caret),this.bind(o,b)}},Tn=class O2 extends oi{constructor(o,u){super(rt(Q({},u),{type:"operator",isFunction:u==null?void 0:u.isFunction})),this.value=o,this.variant=u==null?void 0:u.variant,this.variantStyle=u==null?void 0:u.variantStyle,this.subsupPlacement=u==null?void 0:u.limits}static fromJson(o){return new O2(o.symbol,o)}toJson(){const o=super.toJson();return this.variant&&(o.variant=this.variant),this.variantStyle&&(o.variantStyle=this.variantStyle),this.subsupPlacement&&(o.limits=this.subsupPlacement),this.value&&(o.symbol=this.value),o}render(o){var u;const d=new zi(this.value,{type:"op",mode:"math",maxFontSize:o.scalingFactor,style:{variant:this.variant,variantStyle:this.variantStyle},isSelected:this.isSelected,letterShapeStyle:o.letterShapeStyle});let g=d;if(this.superscript||this.subscript){const b=(u=this.subsupPlacement)!=null?u:"auto";g=b==="over-under"||b==="auto"&&o.isDisplayStyle?this.attachLimits(o,{base:d}):this.attachSupsub(o,{base:d})}return new zi(this.bind(o,g),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"op-group"}).wrap(o)}_serialize(o){if(!(o.expandMacro||o.skipStyles||o.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const u=we(this.command,this.mode);if(u!=null&&u.serialize)return u.serialize(this,o);const d=[this.command];return this.explicitSubsupPlacement&&(this.subsupPlacement==="over-under"&&d.push("\\limits"),this.subsupPlacement==="adjacent"&&d.push("\\nolimits"),this.subsupPlacement==="auto"&&d.push("\\displaylimits")),d.push(this.supsubToLatex(o)),fr(d)}};function nd(r){if(pt(r))return r.map(d=>nd(d));if(typeof r=="string")return oi.fromJson(r);r=Q({},r);for(const d of Rh)r[d]&&(r[d]=nd(r[d]));r.args&&(r.args=Yy(r.args)),r.array&&(r.array=nd(r.array));const o=r.type;let u;o==="accent"&&(u=p.fromJson(r)),o==="array"&&(u=rr.fromJson(r)),o==="box"&&(u=Qo.fromJson(r)),o==="chem"&&(u=Rv.fromJson(r)),o==="composition"&&(u=Qs.fromJson(r)),o==="delim"&&(u=Xf.fromJson(r)),o==="enclose"&&(u=Eu.fromJson(r)),o==="error"&&(u=La.fromJson(r)),o==="extensible-symbol"&&(u=Sg.fromJson(r)),o==="genfrac"&&(u=Bs.fromJson(r)),o==="group"&&(u=Wo.fromJson(r)),o==="latex"&&(u=Ea.fromJson(r)),o==="latexgroup"&&(u=Xp.fromJson(r)),o==="leftright"&&(u=Kr.fromJson(r)),o==="macro"&&(u=$d.fromJson(r)),o==="macro-argument"&&(u=_l.fromJson(r)),o==="operator"&&(u=Tn.fromJson(r)),o==="overlap"&&(u=lh.fromJson(r)),o==="overunder"&&(u=au.fromJson(r)),o==="placeholder"&&(u=Dn.fromJson(r)),o==="prompt"&&(u=Ja.fromJson(r)),o==="phantom"&&(u=Yp.fromJson(r)),o==="sizeddelim"&&(u=Kd.fromJson(r)),o==="spacing"&&(u=Jf.fromJson(r)),o==="subsup"&&(u=ha.fromJson(r)),o==="surd"&&(u=Jp.fromJson(r)),o==="text"&&(u=nh.fromJson(r)),o==="tooltip"&&(u=qf.fromJson(r)),u||(console.assert(!o||["first","mbin","mrel","mclose","minner","mop","mopen","mord","mpunct","root","space"].includes(o),`MathLive 0.98.5: an unexpected atom type "${o}" was encountered. Add new atom constructors to \`fromJson()\` in "atom.ts"`),u=oi.fromJson(r));for(const d of Rh)r[d]&&u.setChildren(r[d],d);return r.verbatimLatex!==void 0&&(u.verbatimLatex=r.verbatimLatex),r.subsupPlacement&&(u.subsupPlacement=r.subsupPlacement),r.explicitSubsupPlacement&&(u.explicitSubsupPlacement=!0),r.isFunction&&(u.isFunction=!0),r.isExtensibleSymbol&&(u.isExtensibleSymbol=!0),r.skipBoundary&&(u.skipBoundary=!0),r.captureSelection&&(u.captureSelection=!0),u}function Yy(r){if(r&&Array.isArray(r))return r.map(o=>o==="<null>"?null:typeof o=="object"&&"group"in o?{group:o.group.map(u=>nd(u))}:typeof o=="object"&&"atoms"in o?o.atoms.map(u=>nd(u)):o)}var kg={main:["Main-Regular","ML__cmr"],"main-italic":["Main-Italic","ML__cmr ML__it"],"main-bold":["Main-Bold","ML__cmr ML__bold"],"main-bolditalic":["Main-BoldItalic","ML__cmr ML__bold ML__it"],normal:["Main-Regular","ML__cmr"],"normal-bold":["Main-Bold","ML__mathbf"],"normal-italic":["Math-Italic","ML__mathit"],"normal-bolditalic":["Math-BoldItalic","ML__mathbfit"],ams:["AMS-Regular","ML__ams"],"ams-bold":["AMS-Regular","ML__ams"],"ams-italic":["AMS-Regular","ML__ams"],"ams-bolditalic":["AMS-Regular","ML__ams"],"sans-serif":["SansSerif-Regular","ML__sans"],"sans-serif-bold":["SansSerif-Regular","ML__sans ML__bold"],"sans-serif-italic":["SansSerif-Regular","ML__sans"],"sans-serif-bolditalic":["SansSerif-Regular","ML__sans"],calligraphic:["Caligraphic-Regular","ML__cal"],"calligraphic-bold":["Caligraphic-Regular","ML__cal ML__bold"],"calligraphic-italic":["Caligraphic-Regular","ML__cal ML__it"],"calligraphic-bolditalic":["Caligraphic-Regular","ML__cal ML__bold ML__it"],script:["Script-Regular","ML__script"],"script-bold":["Script-Regular","ML__script ML__bold"],"script-italic":["Script-Regular","ML__script ML__it"],"script-bolditalic":["Script-Regular","ML__script ML__bold ML__it"],fraktur:["Fraktur-Regular","ML__frak"],"fraktur-bold":["Fraktur-Regular","ML__frak"],"fraktur-italic":["Fraktur-Regular","ML__frak"],"fraktur-bolditalic":["Fraktur-Regular","ML__frak"],monospace:["Typewriter-Regular","ML__tt"],"monospace-bold":["Typewriter-Regular","ML__tt ML__bold"],"monospace-italic":["Typewriter-Regular","ML__tt ML__it"],"monospace-bolditalic":["Typewriter-Regular","ML__tt ML__bold ML__it"],"double-struck":["AMS-Regular","ML__bb"],"double-struck-bold":["AMS-Regular","ML__bb"],"double-struck-italic":["AMS-Regular","ML__bb"],"double-struck-bolditalic":["AMS-Regular","ML__bb"]},Wd={"double-struck":/^[A-Z ]$/,script:/^[A-Z ]$/,calligraphic:/^[\dA-Z ]$/,fraktur:/^[\dA-Za-z ]$|^[!"#$%&'()*+,\-./:;=?[]^]$/,monospace:/^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/,"sans-serif":/^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/},Qf=/^[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5]$/,jh=/^[\u0393|\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A6\u03A8\u03A9]$/,jv=[/^[a-z]$/,/^[A-Z]$/,Qf,jh],$v={iso:["it","it","it","it"],tex:["it","it","it","up"],french:["it","up","up","up"],upright:["up","up","up","up"]},Kv=class extends cl{constructor(){super("math")}createAtom(r,o,u){var d,g,b,M;if(o===null)return new oi({type:"mord",mode:"math",command:r,value:r,style:u});const N=window.MathfieldElement.isFunction((d=o.command)!=null?d:r);if(o.definitionType==="symbol"){const F=new oi({type:(g=o.type)!=null?g:"mord",mode:"math",command:(b=o.command)!=null?b:r,value:String.fromCodePoint(o.codepoint),style:u});return N&&(F.isFunction=!0),r.startsWith("\\")&&(F.verbatimLatex=r),F}const I=new oi({type:"mord",mode:"math",command:(M=o.command)!=null?M:r,value:r,style:u});return N&&(I.isFunction=!0),r.startsWith("\\")&&(I.verbatimLatex=r),I}serialize(r,o){const u=Hv(r,rt(Q({},o),{defaultMode:"math"}));return u.length===0||o.defaultMode!=="text"?u:["$ ",...u," $"]}getFont(r,o){console.assert(o.variant!==void 0);let{variant:u}=o,{variantStyle:d}=o;u==="normal"&&!d&&/[\u00A3\u0131\u0237]/.test(r.value)&&(u="main",d="italic"),u==="normal"&&!d&&r.value.length===1&&jv.forEach((N,I)=>{var F;N.test(r.value)&&$v[(F=o.letterShapeStyle)!=null?F:"tex"][I]==="it"&&(d="italic")}),d==="up"&&(d=void 0);const g=d?u+"-"+d:u;console.assert(kg[g]!==void 0);const[b,M]=kg[g];return Wd[u]&&!Wd[u].test(r.value)?(r.value=ze(r.value,u,d),null):(Qf.test(r.value)&&(r.classes+=" lcGreek"),M&&(r.classes+=" "+M),b)}};function Hv(r,o){const{parent:u}=r[0],d=Vv(u);return os(r,"variant").map(g=>{const b=Vv(g[0]);let M="";b&&b!==d&&(M={calligraphic:"\\mathcal",fraktur:"\\mathfrak","double-struck":"\\mathbb",script:"\\mathscr",monospace:"\\mathtt","sans-serif":"\\mathsf",normal:"\\mathrm","normal-italic":"\\mathnormal","normal-bold":"\\mathbf","normal-bolditalic":"\\mathbfit",ams:"","ams-italic":"\\mathit","ams-bold":"\\mathbf","ams-bolditalic":"\\mathbfit",main:"","main-italic":"\\mathit","main-bold":"\\mathbf","main-bolditalic":"\\mathbfit"}[b],console.assert(M!==void 0));const N=fr(g.map(I=>I._serialize(o)));return M?Vo(M,N):N})}function Vv(r){if(!r)return"";const{style:o}=r;if(o.variant===void 0)return"";let u=o.variant;return!["calligraphic","fraktur","double-struck","script","monospace","sans-serif"].includes(o.variant)&&o.variantStyle&&o.variantStyle!=="up"&&(u+="-"+o.variantStyle),u}new Kv;function tp(r,o){return r.map(u=>u._serialize(o))}function Wv(r,o){return os(r,"fontShape").map(u=>{const d=tp(u,o),{fontShape:g}=u[0].style;let b="";return g==="it"&&(b="\\textit"),g==="sl"&&(b="\\textsl"),g==="sc"&&(b="\\textsc"),g==="n"&&(b="\\textup"),!b&&g?`{${Vo("\\fontshape",g)}${fr(d)}}`:b?Vo(b,fr(d)):fr(d)})}function Uv(r,o){return os(r,"fontSeries").map(u=>{const d=Wv(u,o),{fontSeries:g}=u[0].style;let b="";return g==="b"&&(b="\\textbf"),g==="l"&&(b="\\textlf"),g==="m"&&(b="\\textmd"),g&&!b?`{${Vo("\\fontseries",g)}${fr(d)}}`:b?Vo(b,fr(d)):fr(d)})}function Lg(r,o){return os(r,"fontSize").map(u=>{var d,g;const b=Uv(u,o),M=(g=["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][(d=u[0].style.fontSize)!=null?d:""])!=null?g:"";return M?`${M} ${fr(b)}`:fr(b)})}function qp(r,o,u){return os(r,"fontFamily").map(d=>{var g,b;const M=Lg(d,o),N=(b={roman:"textrm",monospace:"texttt","sans-serif":"textsf"}[(g=d[0].style.fontFamily)!=null?g:""])!=null?b:"";return N?`\\${N}{${fr(M)}}`:d[0].style.fontFamily?`{\\fontfamily{${d[0].style.fontFamily}} ${fr(M)}}`:u?`\\text{${fr(M)}}`:fr(M)})}var Eg={roman:"","sans-serif":"ML__sans",monospace:"ML__tt"},or=class extends cl{constructor(){super("text")}createAtom(r,o,u){return o&&o.definitionType==="symbol"?new nh(r,String.fromCodePoint(o.codepoint),u!=null?u:{}):null}serialize(r,o){return qp(r,rt(Q({},o),{defaultMode:"text"}),o.defaultMode!=="text")}getFont(r,o){var u,d,g,b,M;const{fontFamily:N}=o;if(Eg[N]?r.classes+=" "+Eg[N]:N&&r.setStyle("font-family",N),o.fontShape&&(r.classes+=" ",r.classes+=(u={it:"ML__it",sl:"ML__shape_sl",sc:"ML__shape_sc",ol:"ML__shape_ol"}[o.fontShape])!=null?u:""),o.fontSeries){const I=o.fontSeries.match(/(.?[lbm])?(.?[cx])?/);I&&(r.classes+=" ",r.classes+=(g={ul:"ML__series_ul",el:"ML__series_el",l:"ML__series_l",sl:"ML__series_sl",m:"",sb:"ML__series_sb",b:"ML__bold",eb:"ML__series_eb",ub:"ML__series_ub"}[(d=I[1])!=null?d:""])!=null?g:"",r.classes+=" ",r.classes+=(M={uc:"ML__series_uc",ec:"ML__series_ec",c:"ML__series_c",sc:"ML__series_sc",n:"",sx:"ML__series_sx",x:"ML__series_x",ex:"ML__series_ex",ux:"ML__series_ux"}[(b=I[2])!=null?b:""])!=null?M:"")}return"Main-Regular"}};new or;var qa=class extends cl{constructor(){super("latex")}createAtom(r){return new Ea(r)}serialize(r,o){return r.filter(u=>u instanceof Ea&&!u.isSuggestion).map(u=>u.value)}getFont(){return null}};new qa;var ta={id:"dvorak",locale:"en",displayName:"Dvorak",virtualLayout:"dvorak",platform:"",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["x","X","\u2248","\u02DB"],KeyC:["j","J","\u2206","\xD4"],KeyD:["e","E","\xB4","\xB4"],KeyE:[".",">","\u2265","\u02D8"],KeyF:["u","U","\xA8","\xA8"],KeyG:["i","I","\u02C6","\u02C6"],KeyH:["d","D","\u2202","\xCE"],KeyI:["c","C","\xE7","\xC7"],KeyJ:["h","H","\u02D9","\xD3"],KeyK:["t","T","\u2020","\u02C7"],KeyL:["n","N","\u02DC","\u02DC"],KeyM:["m","M","\xB5","\xC2"],KeyN:["b","B","\u222B","\u0131"],KeyO:["r","R","\xAE","\u2030"],KeyP:["l","L","\xAC","\xD2"],KeyQ:["'",'"',"\xE6","\xC6"],KeyR:["p","P","\u03C0","\u220F"],KeyS:["o","O","\xF8","\xD8"],KeyT:["y","Y","\xA5","\xC1"],KeyU:["g","G","\xA9","\u02DD"],KeyV:["k","K","\u02DA","\uF8FF"],KeyW:[",","<","\u2264","\xAF"],KeyX:["q","Q","\u0153","\u0152"],KeyY:["f","F","\u0192","\xCF"],KeyZ:[";",":","\u2026","\xDA"],Digit1:["1","!","\xA1","\u2044"],Digit2:["2","@","\u2122","\u20AC"],Digit3:["3","#","\xA3","\u2039"],Digit4:["4","$","\xA2","\u203A"],Digit5:["5","%","\u221E","\uFB01"],Digit6:["6","^","\xA7","\uFB02"],Digit7:["7","&","\xB6","\u2021"],Digit8:["8","*","\u2022","\xB0"],Digit9:["9","(","\xAA","\xB7"],Digit0:["0",")","\xBA","\u201A"],Space:[" "," "," "," "],Minus:["[","{","\u201C","\u201D"],Equal:["]","}","\u2018","\u2019"],BracketLeft:["/","?","\xF7","\xBF"],BracketRight:["=","+","\u2260","\xB1"],Backslash:["\\","|","\xAB","\xBB"],Semicolon:["s","S","\xDF","\xCD"],Quote:["-","_","\u2013","\u2014"],Backquote:["`","~","`","`"],Comma:["w","W","\u2211","\u201E"],Period:["v","V","\u221A","\u25CA"],Slash:["z","Z","\u03A9","\xB8"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[".",".",".","."],IntlBackslash:["\xA7","\xB1","\xA7","\xB1"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}},lu={id:"apple.en-intl",displayName:"English (international)",virtualLayout:"qwerty",platform:"apple",locale:"en",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\u222B","\u0131"],KeyC:["c","C","\xE7","\xC7"],KeyD:["d","D","\u2202","\xCE"],KeyE:["e","E","\xB4","\xB4"],KeyF:["f","F","\u0192","\xCF"],KeyG:["g","G","\xA9","\u02DD"],KeyH:["h","H","\u02D9","\xD3"],KeyI:["i","I","\u02C6","\u02C6"],KeyJ:["j","J","\u2206","\xD4"],KeyK:["k","K","\u02DA","\uF8FF"],KeyL:["l","L","\xAC","\xD2"],KeyM:["m","M","\xB5","\xC2"],KeyN:["n","N","\u02DC","\u02DC"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\u0153","\u0152"],KeyR:["r","R","\xAE","\u2030"],KeyS:["s","S","\xDF","\xCD"],KeyT:["t","T","\u2020","\u02C7"],KeyU:["u","U","\xA8","\xA8"],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\u2211","\u201E"],KeyX:["x","X","\u2248","\u02DB"],KeyY:["y","Y","\xA5","\xC1"],KeyZ:["z","Z","\u03A9","\xB8"],Digit1:["1","!","\xA1","\u2044"],Digit2:["2","@","\u2122","\u20AC"],Digit3:["3","#","\xA3","\u2039"],Digit4:["4","$","\xA2","\u203A"],Digit5:["5","%","\u221E","\uFB01"],Digit6:["6","^","\xA7","\uFB02"],Digit7:["7","&","\xB6","\u2021"],Digit8:["8","*","\u2022","\xB0"],Digit9:["9","(","\xAA","\xB7"],Digit0:["0",")","\xBA","\u201A"],Space:[" "," "," "," "],Minus:["-","_","\u2013","\u2014"],Equal:["=","+","\u2260","\xB1"],BracketLeft:["[","{","\u201C","\u201D"],BracketRight:["]","}","\u2018","\u2019"],Backslash:["\\","|","\xAB","\xBB"],Semicolon:[";",":","\u2026","\xDA"],Quote:["'",'"',"\xE6","\xC6"],Backquote:["`","\u02DC","`","`"],Comma:[",","<","\u2264","\xAF"],Period:[".",">","\u2265","\u02D8"],Slash:["/","?","\xF7","\xBF"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[".",".",".","."],IntlBackslash:["\xA7","\xB1","\xA7","\xB1"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}},ep={id:"windows.en-intl",displayName:"English (international)",platform:"windows",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","\xE1","\xC1"],KeyB:["b","B","",""],KeyC:["c","C","\xA9","\xA2"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\xE9","\xC9"],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","\xED","\xCD"],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","\xF8","\xD8"],KeyM:["m","M","\xB5",""],KeyN:["n","N","\xF1","\xD1"],KeyO:["o","O","\xF3","\xD3"],KeyP:["p","P","\xF6","\xD6"],KeyQ:["q","Q","\xE4","\xC4"],KeyR:["r","R","\xAE",""],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\xFE","\xDE"],KeyU:["u","U","\xFA","\xDA"],KeyV:["v","V","",""],KeyW:["w","W","\xE5","\xC5"],KeyX:["x","X","",""],KeyY:["y","Y","\xFC","\xDC"],KeyZ:["z","Z","\xE6","\xC6"],Digit1:["1","!","\xA1","\xB9"],Digit2:["2","@","\xB2",""],Digit3:["3","#","\xB3",""],Digit4:["4","$","\xA4","\xA3"],Digit5:["5","%","\u20AC",""],Digit6:["6","^","\xBC",""],Digit7:["7","&","\xBD",""],Digit8:["8","*","\xBE",""],Digit9:["9","(","\u2018",""],Digit0:["0",")","\u2019",""],Space:[" "," ","",""],Minus:["-","_","\xA5",""],Equal:["=","+","\xD7","\xF7"],BracketLeft:["[","{","\xAB",""],BracketRight:["]","}","\xBB",""],Backslash:["\\","|","\xAC","\xA6"],Semicolon:[";",":","\xB6","\xB0"],Quote:["'",'"',"\xB4","\xA8"],Backquote:["`","~","",""],Comma:[",","<","\xE7","\xC7"],Period:[".",">","",""],Slash:["/","?","\xBF",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["\\","|","",""]}},$h={id:"linux.en",displayName:"English",platform:"linux",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","a","A"],KeyB:["b","B","b","B"],KeyC:["c","C","c","C"],KeyD:["d","D","d","D"],KeyE:["e","E","e","E"],KeyF:["f","F","f","F"],KeyG:["g","G","g","G"],KeyH:["h","H","h","H"],KeyI:["i","I","i","I"],KeyJ:["j","J","j","J"],KeyK:["k","K","k","K"],KeyL:["l","L","l","L"],KeyM:["m","M","m","M"],KeyN:["n","N","n","N"],KeyO:["o","O","o","O"],KeyP:["p","P","p","P"],KeyQ:["q","Q","q","Q"],KeyR:["r","R","r","R"],KeyS:["s","S","s","S"],KeyT:["t","T","t","T"],KeyU:["u","U","u","U"],KeyV:["v","V","v","V"],KeyW:["w","W","w","W"],KeyX:["x","X","x","X"],KeyY:["y","Y","y","Y"],KeyZ:["z","Z","z","Z"],Digit1:["1","!","1","!"],Digit2:["2","@","2","@"],Digit3:["3","#","3","#"],Digit4:["4","$","4","$"],Digit5:["5","%","5","%"],Digit6:["6","^","6","^"],Digit7:["7","&","7","&"],Digit8:["8","*","8","*"],Digit9:["9","(","9","("],Digit0:["0",")","0",")"],Space:[" "," "," "," "],Minus:["-","_","-","_"],Equal:["=","+","=","+"],BracketLeft:["[","{","[","{"],BracketRight:["]","}","]","}"],Backslash:["\\","|","\\","|"],Semicolon:[";",":",";",":"],Quote:["'",'"',"'",'"'],Backquote:["`","~","`","~"],Comma:[",","<",",","<"],Period:[".",">",".",">"],Slash:["/","?","/","?"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}},Kh={id:"apple.french",locale:"fr",displayName:"French",platform:"apple",virtualLayout:"azerty",score:0,mapping:{KeyA:["q","Q","\u2021","\u03A9"],KeyB:["b","B","\xDF","\u222B"],KeyC:["c","C","\xA9","\xA2"],KeyD:["d","D","\u2202","\u2206"],KeyE:["e","E","\xEA","\xCA"],KeyF:["f","F","\u0192","\xB7"],KeyG:["g","G","\uFB01","\uFB02"],KeyH:["h","H","\xCC","\xCE"],KeyI:["i","I","\xEE","\xEF"],KeyJ:["j","J","\xCF","\xCD"],KeyK:["k","K","\xC8","\xCB"],KeyL:["l","L","\xAC","|"],KeyM:[",","?","\u221E","\xBF"],KeyN:["n","N","~","\u0131"],KeyO:["o","O","\u0153","\u0152"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["a","A","\xE6","\xC6"],KeyR:["r","R","\xAE","\u201A"],KeyS:["s","S","\xD2","\u2211"],KeyT:["t","T","\u2020","\u2122"],KeyU:["u","U","\xBA","\xAA"],KeyV:["v","V","\u25CA","\u221A"],KeyW:["z","Z","\xC2","\xC5"],KeyX:["x","X","\u2248","\u2044"],KeyY:["y","Y","\xDA","\u0178"],KeyZ:["w","W","\u2039","\u203A"],Digit1:["&","1","\uF8FF","\xB4"],Digit2:["\xE9","2","\xEB","\u201E"],Digit3:['"',"3","\u201C","\u201D"],Digit4:["'","4","\u2018","\u2019"],Digit5:["(","5","{","["],Digit6:["\xA7","6","\xB6","\xE5"],Digit7:["\xE8","7","\xAB","\xBB"],Digit8:["!","8","\xA1","\xDB"],Digit9:["\xE7","9","\xC7","\xC1"],Digit0:["\xE0","0","\xF8","\xD8"],Space:[" "," "," "," "],Minus:[")","\xB0","}","]"],Equal:["-","_","\u2014","\u2013"],BracketLeft:["^","\xA8","\xF4","\xD4"],BracketRight:["$","*","\u20AC","\xA5"],Backslash:["`","\xA3","@","#"],Semicolon:["m","M","\xB5","\xD3"],Quote:["\xF9","%","\xD9","\u2030"],Backquote:["<",">","\u2264","\u2265"],Comma:[";",".","\u2026","\u2022"],Period:[":","/","\xF7","\\"],Slash:["=","+","\u2260","\xB1"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",".",",","."],IntlBackslash:["@","#","\u2022","\u0178"],NumpadEqual:["=","=","=","="]}},fl={id:"windows.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"windows",score:0,mapping:{KeyA:["q","Q","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:[",","?","",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["a","A","",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["z","Z","",""],KeyX:["x","X","",""],KeyY:["y","Y","",""],KeyZ:["w","W","",""],Digit1:["&","1","",""],Digit2:["\xE9","2","~",""],Digit3:['"',"3","#",""],Digit4:["'","4","{",""],Digit5:["(","5","[",""],Digit6:["-","6","|",""],Digit7:["\xE8","7","`",""],Digit8:["_","8","\\",""],Digit9:["\xE7","9","^",""],Digit0:["\xE0","0","@",""],Space:[" "," ","",""],Minus:[")","\xB0","]",""],Equal:["=","+","}",""],BracketLeft:["^","\xA8","",""],BracketRight:["$","\xA3","\xA4",""],Backslash:["*","\xB5","",""],Semicolon:["m","M","",""],Quote:["\xF9","%","",""],Backquote:["\xB2","","",""],Comma:[";",".","",""],Period:[":","/","",""],Slash:["!","\xA7","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}},Qp={id:"linux.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"linux",score:0,mapping:{KeyA:["q","Q","@","\u03A9"],KeyB:["b","B","\u201D","\u2019"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\xA2"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0309","\u031B"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:[",","?","\u0301","\u030B"],KeyN:["n","N","n","N"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["a","A","\xE6","\xC6"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201C","\u2018"],KeyW:["z","Z","\xAB","<"],KeyX:["x","X","\xBB",">"],KeyY:["y","Y","\u2190","\xA5"],KeyZ:["w","W","\u0142","\u0141"],Digit1:["&","1","\xB9","\xA1"],Digit2:["\xE9","2","~","\u215B"],Digit3:['"',"3","#","\xA3"],Digit4:["'","4","{","$"],Digit5:["(","5","[","\u215C"],Digit6:["-","6","|","\u215D"],Digit7:["\xE8","7","`","\u215E"],Digit8:["_","8","\\","\u2122"],Digit9:["\xE7","9","^","\xB1"],Digit0:["\xE0","0","@","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:[")","\xB0","]","\xBF"],Equal:["=","+","}","\u0328"],BracketLeft:["\u0302","\u0308","\u0308","\u030A"],BracketRight:["$","\xA3","\xA4","\u0304"],Backslash:["*","\xB5","\u0300","\u0306"],Semicolon:["m","M","\xB5","\xBA"],Quote:["\xF9","%","\u0302","\u030C"],Backquote:["\xB2","~","\xAC","\xAC"],Comma:[";",".","\u2500","\xD7"],Period:[":","/","\xB7","\xF7"],Slash:["!","\xA7","\u0323","\u0307"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"]}},t0={id:"apple.german",locale:"de",displayName:"German",virtualLayout:"qwertz",platform:"apple",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\u222B","\u2039"],KeyC:["c","C","\xE7","\xC7"],KeyD:["d","D","\u2202","\u2122"],KeyE:["e","E","\u20AC","\u2030"],KeyF:["f","F","\u0192","\xCF"],KeyG:["g","G","\xA9","\xCC"],KeyH:["h","H","\xAA","\xD3"],KeyI:["i","I","\u2044","\xDB"],KeyJ:["j","J","\xBA","\u0131"],KeyK:["k","K","\u2206","\u02C6"],KeyL:["l","L","@","\uFB02"],KeyM:["m","M","\xB5","\u02D8"],KeyN:["n","N","~","\u203A"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\xAB","\xBB"],KeyR:["r","R","\xAE","\xB8"],KeyS:["s","S","\u201A","\xCD"],KeyT:["t","T","\u2020","\u02DD"],KeyU:["u","U","\xA8","\xC1"],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\u2211","\u201E"],KeyX:["x","X","\u2248","\xD9"],KeyY:["z","Z","\u03A9","\u02C7"],KeyZ:["y","Y","\xA5","\u2021"],Digit1:["1","!","\xA1","\xAC"],Digit2:["2",'"',"\u201C","\u201D"],Digit3:["3","\xA7","\xB6","#"],Digit4:["4","$","\xA2","\xA3"],Digit5:["5","%","[","\uFB01"],Digit6:["6","&","]","^"],Digit7:["7","/","|","\\"],Digit8:["8","(","{","\u02DC"],Digit9:["9",")","}","\xB7"],Digit0:["0","=","\u2260","\xAF"],Space:[" "," "," "," "],Minus:["\xDF","?","\xBF","\u02D9"],Equal:["\xB4","`","'","\u02DA"],BracketLeft:["\xFC","\xDC","\u2022","\xB0"],BracketRight:["+","*","\xB1","\uF8FF"],Backslash:["#","'","\u2018","\u2019"],Semicolon:["\xF6","\xD6","\u0153","\u0152"],Quote:["\xE4","\xC4","\xE6","\xC6"],Backquote:["<",">","\u2264","\u2265"],Comma:[",",";","\u221E","\u02DB"],Period:[".",":","\u2026","\xF7"],Slash:["-","_","\u2013","\u2014"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",",",".","."],IntlBackslash:["^","\xB0","\u201E","\u201C"],NumpadEqual:["=","=","=","="]}},Jy={id:"windows.german",locale:"de",displayName:"German",platform:"windows",virtualLayout:"qwertz",score:0,mapping:{KeyA:["a","A","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:["m","M","\xB5",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["q","Q","@",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["w","W","",""],KeyX:["x","X","",""],KeyY:["z","Z","",""],KeyZ:["y","Y","",""],Digit1:["1","!","",""],Digit2:["2",'"',"\xB2",""],Digit3:["3","\xA7","\xB3",""],Digit4:["4","$","",""],Digit5:["5","%","",""],Digit6:["6","&","",""],Digit7:["7","/","{",""],Digit8:["8","(","[",""],Digit9:["9",")","]",""],Digit0:["0","=","}",""],Space:[" "," ","",""],Minus:["\xDF","?","\\","\u1E9E"],Equal:["\xB4","`","",""],BracketLeft:["\xFC","\xDC","",""],BracketRight:["+","*","~",""],Backslash:["#","'","",""],Semicolon:["\xF6","\xD6","",""],Quote:["\xE4","\xC4","",""],Backquote:["^","\xB0","",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","|",""]}},So={id:"linux.german",locale:"de",displayName:"German",platform:"windows",virtualLayout:"qwertz",score:0,mapping:{KeyA:["a","A","\xE6","\xC6"],KeyB:["b","B","\u201C","\u2018"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\u20AC"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0323","\u0307"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:["m","M","\xB5","\xBA"],KeyN:["n","N","\u201D","\u2019"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["q","Q","@","\u03A9"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\u017F","\u1E9E"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201E","\u201A"],KeyW:["w","W","\u0142","\u0141"],KeyX:["x","X","\xAB","\u2039"],KeyY:["z","Z","\u2190","\xA5"],KeyZ:["y","Y","\xBB","\u203A"],Digit1:["1","!","\xB9","\xA1"],Digit2:["2",'"',"\xB2","\u215B"],Digit3:["3","\xA7","\xB3","\xA3"],Digit4:["4","$","\xBC","\xA4"],Digit5:["5","%","\xBD","\u215C"],Digit6:["6","&","\xAC","\u215D"],Digit7:["7","/","{","\u215E"],Digit8:["8","(","[","\u2122"],Digit9:["9",")","]","\xB1"],Digit0:["0","=","}","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["\xDF","?","\\","\xBF"],Equal:["\u0301","\u0300","\u0327","\u0328"],BracketLeft:["\xFC","\xDC","\u0308","\u030A"],BracketRight:["+","*","~","\xAF"],Backslash:["#","'","\u2019","\u0306"],Semicolon:["\xF6","\xD6","\u030B","\u0323"],Quote:["\xE4","\xC4","\u0302","\u030C"],Backquote:["\u0302","\xB0","\u2032","\u2033"],Comma:[",",";","\xB7","\xD7"],Period:[".",":","\u2026","\xF7"],Slash:["-","_","\u2013","\u2014"],PrintScreen:["","","",""],PageUp:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["","1","","1"],Numpad2:["","2","","2"],Numpad3:["","3","","3"],Numpad4:["","4","","4"],Numpad5:["","5","","5"],Numpad6:["","6","","6"],Numpad7:["","7","","7"],Numpad8:["","8","","8"],Numpad9:["","9","","9"],Numpad0:["","0","","0"],NumpadDecimal:["",",","",","],IntlBackslash:["<",">","|","\u0331"],AltRight:["\r","\r","\r","\r"],MetaRight:[".",".",".","."]}},_g={id:"apple.spanish",locale:"es",displayName:"Spanish ISO",platform:"apple",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\xDF",""],KeyC:["c","C","\xA9"," "],KeyD:["d","D","\u2202","\u2206"],KeyE:["e","E","\u20AC","\u20AC"],KeyF:["f","F","\u0192","\uFB01"],KeyG:["g","G","\uF8FF","\uFB02"],KeyH:["h","H","\u2122"," "],KeyI:["i","I"," "," "],KeyJ:["j","J","\xB6","\xAF"],KeyK:["k","K","\xA7","\u02C7"],KeyL:["l","L"," ","\u02D8"],KeyM:["m","M","\xB5","\u02DA"],KeyN:["n","N"," ","\u02D9"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\u0153","\u0152"],KeyR:["r","R","\xAE"," "],KeyS:["s","S","\u222B"," "],KeyT:["t","T","\u2020","\u2021"],KeyU:["u","U"," "," "],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\xE6","\xC6"],KeyX:["x","X","\u2211","\u203A"],KeyY:["y","Y","\xA5"," "],KeyZ:["z","Z","\u03A9","\u2039"],Digit1:["1","!","|","\u0131"],Digit2:["2",'"',"@","\u02DD"],Digit3:["3","\xB7","#","\u2022"],Digit4:["4","$","\xA2","\xA3"],Digit5:["5","%","\u221E","\u2030"],Digit6:["6","&","\xAC"," "],Digit7:["7","/","\xF7","\u2044"],Digit8:["8","(","\u201C","\u2018"],Digit9:["9",")","\u201D","\u2019"],Digit0:["0","=","\u2260","\u2248"],Space:[" "," "," "," "],Minus:["'","?","\xB4","\xB8"],Equal:["\xA1","\xBF","\u201A","\u02DB"],BracketLeft:["`","^","[","\u02C6"],BracketRight:["+","*","]","\xB1"],Backslash:["\xE7","\xC7","}","\xBB"],Semicolon:["\xF1","\xD1","~","\u02DC"],Quote:["\xB4","\xA8","{","\xAB"],Backquote:["<",">","\u2264","\u2265"],Comma:[",",";","\u201E",""],Period:[".",":","\u2026","\u2026"],Slash:["-","_","\u2013","\u2014"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[",",",",",",","],IntlBackslash:["\xBA","\xAA","\\","\xB0"]}},Tg={id:"windows.spanish",locale:"es",displayName:"Spanish",platform:"windows",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:["m","M","",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["q","Q","",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["w","W","",""],KeyX:["x","X","",""],KeyY:["y","Y","",""],KeyZ:["z","Z","",""],Digit1:["1","!","|",""],Digit2:["2",'"',"@",""],Digit3:["3","\xB7","#",""],Digit4:["4","$","~",""],Digit5:["5","%","\u20AC",""],Digit6:["6","&","\xAC",""],Digit7:["7","/","",""],Digit8:["8","(","",""],Digit9:["9",")","",""],Digit0:["0","=","",""],Space:[" "," ","",""],Minus:["'","?","",""],Equal:["\xA1","\xBF","",""],BracketLeft:["`","^","[",""],BracketRight:["+","*","]",""],Backslash:["\xE7","\xC7","}",""],Semicolon:["\xF1","\xD1","",""],Quote:["\xB4","\xA8","{",""],Backquote:["\xBA","\xAA","\\",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}},Pg={id:"linux.spanish",locale:"es",displayName:"Spanish",platform:"linux",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","\xE6","\xC6"],KeyB:["b","B","\u201D","\u2019"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\xA2"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0309","\u031B"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:["m","M","\xB5","\xBA"],KeyN:["n","N","n","N"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["q","Q","@","\u03A9"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201C","\u2018"],KeyW:["w","W","\u0142","\u0141"],KeyX:["x","X","\xBB",">"],KeyY:["y","Y","\u2190","\xA5"],KeyZ:["z","Z","\xAB","<"],Digit1:["1","!","|","\xA1"],Digit2:["2",'"',"@","\u215B"],Digit3:["3","\xB7","#","\xA3"],Digit4:["4","$","~","$"],Digit5:["5","%","\xBD","\u215C"],Digit6:["6","&","\xAC","\u215D"],Digit7:["7","/","{","\u215E"],Digit8:["8","(","[","\u2122"],Digit9:["9",")","]","\xB1"],Digit0:["0","=","}","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["'","?","\\","\xBF"],Equal:["\xA1","\xBF","\u0303","~"],BracketLeft:["\u0300","\u0302","[","\u030A"],BracketRight:["+","*","]","\u0304"],Backslash:["\xE7","\xC7","}","\u0306"],Semicolon:["\xF1","\xD1","~","\u030B"],Quote:["\u0301","\u0308","{","{"],Backquote:["\xBA","\xAA","\\","\\"],Comma:[",",";","\u2500","\xD7"],Period:[".",":","\xB7","\xF7"],Slash:["-","_","\u0323","\u0307"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadEnter:["\r","\r","\r","\r"],Numpad1:["","1","","1"],Numpad2:["","2","","2"],Numpad3:["","3","","3"],Numpad4:["","4","","4"],Numpad5:["","5","","5"],Numpad6:["","6","","6"],Numpad7:["","7","","7"],Numpad8:["","8","","8"],Numpad9:["","9","","9"],Numpad0:["","0","","0"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}};function dm(r){const o=r.split("+"),u={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:o.pop()};return o.includes("shift")&&(u.shift=!0),o.includes("alt")&&(u.alt=!0),o.includes("ctrl")&&(u.ctrl=!0),o.includes("cmd")&&(u.cmd=!0),o.includes("win")&&(u.win=!0),o.includes("meta")&&(u.meta=!0),u}function Ud(r){let o="";return r.shift&&(o+="shift+"),r.alt&&(o+="alt+"),r.ctrl&&(o+="ctrl+"),r.cmd&&(o+="cmd+"),r.win&&(o+="win+"),r.meta&&(o+="meta+"),o+r.key}var Ng={enter:"[Enter]",escape:"[Escape]",backspace:"[Backspace]",tab:"[Tab]",space:"[Space]",pausebreak:"[Pause]",insert:"[Insert]",home:"[Home]",pageup:"[PageUp]",delete:"[Delete]",end:"[End]",pagedown:"[PageDown]",right:"[ArrowRight]",left:"[ArrowLeft]",down:"[ArrowDown]",up:"[ArrowUp]",numpad0:"[Numpad0]",numpad1:"[Numpad1]",numpad2:"[Numpad2]",numpad3:"[Numpad3]",numpad4:"[Numpad4]",numpad5:"[Numpad5]",numpad6:"[Numpad6]",numpad7:"[Numpad7]",numpad8:"[Numpad8]",numpad9:"[Numpad9]",numpad_divide:"[NumpadDivide]",numpad_multiply:"[NumpadMultiply]",numpad_subtract:"[NumpadSubtract]",numpad_add:"[NumpadAdd]",numpad_decimal:"[NumpadDecimal]",numpad_separator:"[NumpadComma]",capslock:"[Capslock]",f1:"[F1]",f2:"[F2]",f3:"[F3]",f4:"[F4]",f5:"[F5]",f6:"[F6]",f7:"[F7]",f8:"[F8]",f9:"[F9]",f10:"[F10]",f11:"[F11]",f12:"[F12]",f13:"[F13]",f14:"[F14]",f15:"[F15]",f16:"[F16]",f17:"[F17]",f18:"[F18]",f19:"[F19]"},Zd=[],Gd;function e0(){switch(Ht()){case"macos":case"ios":return"apple";case"windows":return"windows"}return"linux"}function Pl(r){(!r.platform||r.platform===e0())&&Zd.push(r)}function fm(r,o){var u;const d={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:""};if(!r)return d;for(const[g,b]of Object.entries(o.mapping)){if(b[0]===r)return d.key=`[${g}]`,d;if(b[1]===r)return d.shift=!0,d.key=`[${g}]`,d;if(b[2]===r)return d.alt=!0,d.key=`[${g}]`,d;if(b[3]===r)return d.shift=!0,d.alt=!0,d.key=`[${g}]`,d}return d.key=(u=Ng[r])!=null?u:"",d}function Ag(r){if(r.code)return r;const o=Object.entries(rd().mapping);let u=!1,d=!1,g="";for(let b=0;b<4;b++){for(const[M,N]of o)if(N[b]===r.key){g=M,b===3?(u=!0,d=!0):b===2?u=!0:b===1&&(d=!0);break}if(g)break}return new KeyboardEvent(r.type,rt(Q({},r),{altKey:u,shiftKey:d,code:g}))}function Dg(r){var o,u;if(!r||r.key==="Unidentified"||r.key==="Dead")return;const d=r.shiftKey&&r.altKey?3:r.altKey?2:r.shiftKey?1:0;for(const g of Zd)((o=g.mapping[r.code])==null?void 0:o[d])===r.key?g.score+=1:(u=g.mapping[r.code])!=null&&u[d]&&(g.score=0);Zd.sort((g,b)=>b.score-g.score)}function qy(r){Gd=Zd.find(o=>r.startsWith(o.locale))}function rd(){return Gd!=null?Gd:Zd[0]}function ne(){switch(e0()){case"apple":return lu;case"windows":return ep;case"linux":return $h}return lu}switch(e0()){case"apple":Pl(lu),Pl(Kh),Pl(_g),Pl(t0);break;case"windows":Pl(ep),Pl(fl),Pl(Tg),Pl(Jy);break;case"linux":Pl($h),Pl(Qp),Pl(Pg),Pl(So);break}Pl(ta);function pm(r){var o;const u=/macos|ios/.test(Ht()),d=r.split("+");let g="";for(const b of d)g&&(g+=u?"\u2009":'<span class="ML__shortcut-join">+</span>'),b.startsWith("[Key")?g+=b.slice(4,5):b.startsWith("Key")?g+=b.slice(3,4):b.startsWith("[Digit")?g+=b.slice(6,7):b.startsWith("Digit")?g+=b.slice(5,6):g+=(o={cmd:"\u2318",meta:u?"\u2318":"Ctrl",shift:u?"\u21E7":"Shift",alt:u?"\u2325":"Alt",ctrl:u?"\u2303":"Ctrl","\n":u?"\u23CE":"Return","[return]":u?"\u23CE":"Return","[enter]":u?"\u2324":"Enter","[tab]":u?"\u21E5":"Tab","[escape]":"Esc","[backspace]":u?"\u232B":"Backspace","[delete]":u?"\u2326":"Del","[pageup]":u?"\u21DE":"Page Up","[pagedown]":u?"\u21DF":"Page Down","[home]":u?"\u2912":"Home","[end]":u?"\u2913":"End","[space]":"Space","[equal]":"=","[minus]":"-","[comma]":",","[slash]":"/","[backslash]":"\\","[bracketleft]":"[","[bracketright]":"]",semicolon:";",period:".",comma:",",minus:"-",equal:"=",quote:"'",backslash:"\\",intlbackslash:"\\",backquote:"`",slash:"/",numpadmultiply:"* &#128290;",numpaddivide:"/ &#128290;",numpadsubtract:"- &#128290;",numpadadd:"+ &#128290;",numpaddecimal:". &#128290;",numpadcomma:", &#128290;",help:"help",left:"\u21E0",up:"\u21E1",right:"\u21E2",down:"\u21E3","[arrowleft]":"\u21E0","[arrowup]":"\u21E1","[arrowright]":"\u21E2","[arrowdown]":"\u21E3"}[b.toLowerCase()])!=null?o:b.toUpperCase();return g}function mm(r){if(r instanceof MouseEvent||r instanceof PointerEvent)return{x:r.clientX,y:r.clientY};if(r instanceof TouchEvent){const o=[...r.touches].reduce((d,g)=>({x:d.x+g.clientX,y:d.y+g.clientY}),{x:0,y:0}),u=r.touches.length;return{x:o.x/u,y:o.y/u}}}function wc(r){const o={alt:!1,control:!1,shift:!1,meta:!1};return(r instanceof MouseEvent||r instanceof PointerEvent||r instanceof TouchEvent||r instanceof KeyboardEvent)&&(r.altKey&&(o.alt=!0),r.ctrlKey&&(o.control=!0),r.metaKey&&(o.meta=!0),r.shiftKey&&(o.shift=!0)),o}function Qy(r,o){return!r&&o||r&&!o?!1:!r||!o?!0:r.alt===o.alt&&r.control===o.control&&r.shift===o.shift&&r.meta===o.meta}var Zv=new Set(["Backquote","Digit0","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9","Minus","Equal","IntlYen","KeyQ","KeyW","KeyE","KeyR","KeyT","KeyY","KeyU","KeyI","KeyO","KeyP","BracketLeft","BracketRight","Backslash","KeyA","KeyS","KeyD","KeyF","KeyG","KeyH","KeyJ","KeyK","KeyL","Semicolon","Quote","IntlBackslash","KeyZ","KeyX","KeyC","KeyV","KeyB","KeyN","KeyM","Comma","Period","Slash","IntlRo","Space","Numpad0","Numpad1","Numpad2","Numpad3","Numpad4","Numpad5","Numpad6","Numpad7","Numpad8","Numpad9","NumpadAdd","NumpadComma","NumpadDecimal","NumpadDivide","NumpadEqual","NumpadHash","NumpadMultiply","NumpadParenLeft","NumpadParenRight","NumpadStar","NumpadSubstract"]);function uu(r){return r.ctrlKey||r.metaKey||["Dead","Process"].includes(r.key)?!1:r.code===""?!0:Zv.has(r.code)}function Hh(){var r;let o=document.activeElement;for(;(r=o==null?void 0:o.shadowRoot)!=null&&r.activeElement;)o=o.shadowRoot.activeElement;return o}var Vh=class Dp{static get scrim(){return Dp._scrim||(Dp._scrim=new Dp),Dp._scrim}static open(o){Dp.scrim.open(o)}static close(){Dp.scrim.close()}static get state(){return Dp.scrim.state}static get element(){return Dp.scrim.element}constructor(o){var u,d;this.lightDismiss=(u=o==null?void 0:o.lightDismiss)!=null?u:!0,this.translucent=(d=o==null?void 0:o.translucent)!=null?d:!1,this.state="closed"}get element(){if(this._element)return this._element;const o=document.createElement("div");return o.setAttribute("role","presentation"),o.style.position="fixed",o.style.contain="content",o.style.top="0",o.style.left="0",o.style.right="0",o.style.bottom="0",o.style.zIndex="var(--scrim-zindex, 10099)",o.style.outline="none",this.translucent?(o.style.background="rgba(255, 255, 255, .2)",o.style.backdropFilter="contrast(40%)"):o.style.background="transparent",this._element=o,o}open(o){var u;if(this.state!=="closed")return;this.state="opening",this.onDismiss=o==null?void 0:o.onDismiss,this.savedActiveElement=Hh();const{element:d}=this;((u=o==null?void 0:o.root)!=null?u:document.body).appendChild(d),d.addEventListener("click",this),document.addEventListener("touchmove",this,!1),document.addEventListener("scroll",this,!1);const g=window.innerWidth-document.documentElement.clientWidth;this.savedMarginRight=document.body.style.marginRight,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden";const b=Number.parseFloat(getComputedStyle(document.body).marginRight);document.body.style.marginRight=`${b+g}px`,o!=null&&o.child&&d.append(o.child),this.state="open"}close(){var o,u,d,g;if(this.state!=="open"){console.assert(this.element.parentElement!==null);return}this.state="closing",typeof this.onDismiss=="function"&&this.onDismiss(),this.onDismiss=void 0;const{element:b}=this;b.removeEventListener("click",this),document.removeEventListener("touchmove",this,!1),document.removeEventListener("scroll",this,!1),b.remove(),document.body.style.overflow=(o=this.savedOverflow)!=null?o:"",document.body.style.marginRight=(u=this.savedMarginRight)!=null?u:"",Hh()!==this.savedActiveElement&&((g=(d=this.savedActiveElement)==null?void 0:d.focus)==null||g.call(d)),b.innerHTML="",this.state="closed"}handleEvent(o){this.lightDismiss&&(o.target===this._element&&o.type==="click"?(this.close(),o.preventDefault(),o.stopPropagation()):o.target===document&&(o.type==="touchmove"||o.type==="scroll")&&(this.close(),o.preventDefault(),o.stopPropagation()))}};function cx(r,o,u){let d=null,g=null,b=!1,M=!1,N=!1;const I=new AbortController,F=I.signal;return r.addEventListener("keydown",$=>{if(b||$.key==="Process"||$.code==="CapsLock"||/(Control|Meta|Alt|Shift)(Left|Right)/.test($.code)){d=null;return}d=$,g=null,u.onKeystroke($)?r.textContent="":d=null},{capture:!0,signal:F}),r.addEventListener("keypress",$=>{b||(d&&g&&u.onKeystroke(d),g=$)},{capture:!0,signal:F}),r.addEventListener("compositionstart",$=>{r.textContent="",b=!0,u.onCompositionStart($.data)},{capture:!0,signal:F}),r.addEventListener("compositionupdate",$=>{b&&u.onCompositionUpdate($.data)},{capture:!0,signal:F}),r.addEventListener("compositionend",$=>{r.textContent="",b&&(b=!1,u.onCompositionEnd($.data))},{capture:!0,signal:F}),r.addEventListener("beforeinput",$=>$.stopImmediatePropagation(),{signal:F}),r.addEventListener("input",$=>{var it;if(!b&&(r.textContent="",$.inputType!=="insertCompositionText")){if($.inputType==="insertFromPaste"){$.preventDefault(),$.stopPropagation();return}u.onInput((it=$.data)!=null?it:""),$.preventDefault(),$.stopPropagation()}},{signal:F}),r.addEventListener("paste",$=>{r.focus({preventScroll:!0}),r.textContent="",u.onPaste($)||$.preventDefault(),$.stopImmediatePropagation()},{signal:F}),r.addEventListener("cut",$=>u.onCut($),{capture:!0,signal:F}),r.addEventListener("copy",$=>u.onCopy($),{capture:!0,signal:F}),r.addEventListener("blur",$=>{var it,gt;if(((gt=(it=$.relatedTarget)==null?void 0:it._mathfield)==null?void 0:gt.element)===o){r.focus({preventScroll:!0}),$.preventDefault(),$.stopPropagation();return}const _t=Vh.state;if(_t==="open"||_t==="opening"){$.preventDefault(),$.stopPropagation();return}if($.relatedTarget===$.target.getRootNode().host){$.preventDefault(),$.stopPropagation();return}N||M||(N=!0,d=null,g=null,u.onBlur(),N=!1)},{capture:!0,signal:F}),r.addEventListener("focus",$=>{N||M||(M=!0,u.onFocus(),M=!1)},{capture:!0,signal:F}),{dispose:()=>I.abort(),cancelComposition:()=>{b&&(r.blur(),requestAnimationFrame(()=>r.focus({preventScroll:!0})))},blur:()=>{typeof r.blur=="function"&&r.blur()},focus:()=>{!M&&typeof r.focus=="function"&&r.focus({preventScroll:!0})},hasFocus:()=>Hh()===r,setAriaLabel:$=>r.setAttribute("aria-label",$),setValue:$=>{var it;r.textContent=$,r.style.left="-1000px",(it=window.getSelection())==null||it.selectAllChildren(r)},moveTo:($,it)=>{r.style.top=`${it}px`,r.style.left=`${$}px`}}}function ip(r){var o;if(!r||!uu(r))return"";let u;return r.key==="Unidentified"&&r.target&&(u=r.target.value),u=(o=u!=null?u:r.key)!=null?o:r.code,/^(Dead|Return|Enter|Tab|Escape|Delete|PageUp|PageDown|Home|End|Help|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)$/.test(u)&&(u=""),u}function Gv(r){r=Ag(r);const o=[];return r.ctrlKey&&o.push("ctrl"),r.metaKey&&o.push("meta"),r.altKey&&o.push("alt"),r.shiftKey&&o.push("shift"),o.length===0?`[${r.code}]`:(o.push(`[${r.code}]`),o.join("+"))}function t1(r){if(Ce()){const o=Ht(),u=r.startsWith("!"),d=r.endsWith(o);if(u&&!d||!u&&d)return!0}return r==="!other"?!1:r==="other"}function bc(r,o,u){if(r.length===0)return"";const d=Ud(dm(Gv(u))),g=Ud({key:u.key,shift:u.shiftKey,alt:u.altKey,ctrl:u.ctrlKey,meta:u.metaKey||u.ctrlKey&&/macos|ios/.test(Ht()),cmd:!1,win:!1});for(let b=r.length-1;b>=0;b--)if((r[b].key===d||r[b].key===g)&&(!r[b].ifMode||r[b].ifMode===o))return r[b].command;return""}function Ig(r){let o=r;return pt(o)&&(o=o.length>0?o[0]+"("+o.slice(1).join("")+")":""),o}function Xv(r,o){let u=[];if(typeof o=="string"){const b=Qc[o];pt(b)?u=b.slice():b&&u.push(b)}const d=Ig(o),g=new RegExp("^"+d.replace("\\","\\\\").replace("|","\\|").replace("*","\\*").replace("$","\\$").replace("^","\\^")+"([^*a-zA-Z]|$)");for(const b of r)g.test(Ig(b.command))&&u.push(b.key);return u.map(pm)}function Yv(r,o){if(r.ifPlatform&&!/^!?(macos|windows|android|ios|chromeos|other)$/.test(r.ifPlatform))throw new Error(`Unexpected platform "${r.ifPlatform}" for keybinding ${r.key}`);if(r.ifLayout!==void 0&&(o.score===0||!r.ifLayout.includes(o.id)))return;const u=dm(r.key);let d=r.ifPlatform;if(u.cmd){if(d&&d!=="macos"&&d!=="ios")throw new Error('Unexpected "cmd" modifier with platform "'+d+`"
"cmd" modifier can only be used with macOS or iOS platform.`);d||(d=Ht()==="ios"?"ios":"macos"),u.win=!1,u.cmd=!1,u.meta=!0}if(u.win){if(d&&d!=="windows")throw new Error('Unexpected "win" modifier with platform "'+d+`"
"win" modifier can only be used with Windows platform.`);d="windows",u.win=!1,u.cmd=!1,u.meta=!0}if(d&&!t1(d))return;if(/^\[.+\]$/.test(u.key))return rt(Q({},r),{key:Ud(u)});const g=fm(u.key,o);if(!g)return rt(Q({},r),{key:Ud(u)});if(g.shift&&u.shift||g.alt&&u.alt)throw new Error(`The keybinding ${r.key} (${gm(r.command)}) is conflicting with the key combination ${Ud(g)} using the ${o.displayName} keyboard layout`);return g.shift=g.shift||u.shift,g.alt=g.alt||u.alt,g.meta=u.meta,g.ctrl=u.ctrl,rt(Q({},r),{key:Ud(g)})}function gm(r){if(Array.isArray(r)){const o=[...r];return o.shift()+"("+o.map(u=>typeof u=="string"?`"${u}"`:u.toString()).join(", ")+")"}return r}function e1(r,o){const u=[],d=[];for(const g of r)try{const b=Yv(g,o);if(!b)continue;const M=d.find(N=>N.key===b.key&&N.ifMode===b.ifMode);if(M)throw new Error(`Ambiguous key binding ${g.key} (${gm(g.command)}) matches ${M.key} (${gm(M.command)}) with the ${o.displayName} keyboard layout`);d.push(b)}catch(b){b instanceof Error&&u.push(b.message)}return[d,u]}var i1=class extends Bn{constructor(){super("latex")}createAtom(r){return new Ea(r)}onPaste(r,o){if(!o)return!1;const u=typeof o=="string"?o:o.getData("application/x-latex")||o.getData("text/plain");return u&&r.model.contentWillChange({inputType:"insertFromPaste",data:u})?(r.stopCoalescingUndo(),r.stopRecording(),this.insert(r.model,u)&&(r.startRecording(),r.snapshot("paste"),r.model.contentDidChange({inputType:"insertFromPaste"}),ls(r)),r.startRecording(),!0):!1}insert(r,o,u){if(!r.contentWillChange({data:o,inputType:"insertText"}))return!1;u||(u={}),u.insertionMode||(u.insertionMode="replaceSelection"),u.selectionMode||(u.selectionMode="placeholder");const{silenceNotifications:d}=r;u.silenceNotifications&&(r.silenceNotifications=!0);const g=r.silenceNotifications;r.silenceNotifications=!0,u.insertionMode==="replaceSelection"&&!r.selectionIsCollapsed?r.deleteAtoms(Yo(r.selection)):u.insertionMode==="replaceAll"?(r.root.setChildren([],"body"),r.position=0):u.insertionMode==="insertBefore"?r.collapseSelection("backward"):u.insertionMode==="insertAfter"&&r.collapseSelection("forward");const b=[];for(const I of o)E.test(I)&&b.push(new Ea(I));let M=r.at(r.position);if(M instanceof Xp&&(M=M.lastChild),!(M.parent instanceof Xp)){const I=new Xp("");M.parent.addChildAfter(I,M),M=I.firstChild}const N=M.parent.addChildrenAfter(b,M);return r.silenceNotifications=g,u.selectionMode==="before"||(u.selectionMode==="item"?r.setSelection(r.anchor,r.offsetOf(N)):N&&(r.position=r.offsetOf(N))),r.contentDidChange({data:o,inputType:"insertText"}),r.silenceNotifications=d,!0}};function n1(r){return r.atoms.find(o=>o.type==="latexgroup")}function _a(r){var o,u;const d=r.atoms.find(g=>g.type==="latexgroup");return d?(u=(o=d.body)==null?void 0:o.filter(g=>g.type==="latex"))!=null?u:[]:[]}function r1(r,o){var u;let d=0,g=!1;const b=Number.isFinite(o==null?void 0:o.before)?(u=o==null?void 0:o.before)!=null?u:0:r.lastOffset;for(;d<=b&&!g;){const I=r.at(d);g=I instanceof Ea&&I.isSuggestion,g||d++}if(!g)return[void 0,void 0];let M=d,N=!1;for(;M<=b&&!N;){const I=r.at(M);N=!(I instanceof Ea&&I.isSuggestion),N||M++}return[d-1,M-1]}new i1;function Xd(r){const o=_a(r.model).filter(u=>u.isSuggestion);if(o.length!==0){r.model.position=r.model.offsetOf(o[0].leftSibling);for(const u of o)u.parent.removeChild(u)}}function i0(r,o){var u;const{model:d}=r;Xd(r);for(const $ of _a(d))$.isError=!1;if(!d.selectionIsCollapsed||r.options.popoverPolicy==="off"){Ta(r);return}const g=[];let b=d.at(d.position);for(;b&&b instanceof Ea&&/^[a-zA-Z\*]$/.test(b.value);)b=b.leftSibling;if(b&&b instanceof Ea&&b.value==="\\")for(g.push(b),b=b.rightSibling;b&&b instanceof Ea&&/^[a-zA-Z\*]$/.test(b.value);)g.push(b),b=b.rightSibling;const M=g.map($=>$.value).join(""),N=Ae(r,M);if(N.length===0){if(/^\\[a-zA-Z\*]+$/.test(M))for(const $ of g)$.isError=!0;Ta(r);return}const I=(u=o==null?void 0:o.atIndex)!=null?u:0;r.suggestionIndex=I<0?N.length-1:I%N.length;const F=N[r.suggestionIndex];if(F!==M){const $=g[g.length-1];$.parent.addChildrenAfter([...F.slice(M.length-F.length)].map(it=>new Ea(it,{isSuggestion:!0})),$),qd(r,{interactive:!0})}_u(r,N)}function vm(r){const[o,u]=r1(r,{before:r.position});if(o===void 0||u===void 0)return!1;let d=!1;return r.getAtoms([o,u]).forEach(g=>{g.isSuggestion&&(g.isSuggestion=!1,d=!0)}),d}function Yd(r,o="accept",u){var d,g;Ta(r);const b=n1(r.model);if(!b)return!1;if(o==="accept-suggestion"||o==="accept-all"){const F=_a(r.model).filter($=>$.isSuggestion);if(F.length!==0){for(const $ of F)$.isSuggestion=!1;r.model.position=r.model.offsetOf(F[F.length-1])}if(o==="accept-suggestion")return F.length!==0}const N=_a(r.model).filter(F=>!F.isSuggestion).map(F=>F.value).join(""),I=b.leftSibling;return b.parent.removeChild(b),r.model.position=r.model.offsetOf(I),r.switchMode((d=u==null?void 0:u.mode)!=null?d:"math"),o==="reject"||(Bn.insert(r.model,N,{selectionMode:(g=u==null?void 0:u.selectItem)!=null&&g?"item":"placeholder",format:"latex",mode:"math"}),r.snapshot(),r.model.announce("replacement"),r.switchMode("math")),!0}function n0(r){var o;let u=document.getElementById(r);return u?u.dataset.refcount=Number(Number.parseInt((o=u.dataset.refcount)!=null?o:"0")+1).toString():(u=document.createElement("div"),u.setAttribute("aria-hidden","true"),u.dataset.refcount="1",u.id=r,document.body.append(u)),u}function ym(r){var o;const u=document.getElementById(r);if(!u)return;const d=Number.parseInt((o=u.getAttribute("data-refcount"))!=null?o:"0");d<=1?u.remove():u.dataset.refcount=Number(d-1).toString()}function Og(r,o){const u=new Dr({from:r.context}),d=new oi({mode:"math",type:"root",body:vs(o,{context:u})}),g=Dh(uh(new zi(d.render(u),{classes:"ML__base"}),u));return Id(g,{classes:"ML__latex"}).toMarkup()}function _u(r,o){var u;if(o.length===0){Ta(r);return}let d="";for(const[b,M]of o.entries()){const N=M,I=Og(r,M),F=Xv(r.keybindings,N).join("<br>");d+=`<li role="button" data-command="${N}" ${b===r.suggestionIndex?"class=ML__popover__current":""}><span class="ML__popover__latex">${N}</span><span class="ML__popover__command">${I}</span>`,F&&(d+=`<span class="ML__popover__keybinding">${F}</span>`),d+="</li>"}const g=Wh(r,`<ul>${d}</ul>`);Bg()&&((u=g.querySelector(".ML__popover__current"))==null||u.scrollIntoView({block:"nearest",inline:"nearest"})),setTimeout(()=>{var b;g&&!Bg()&&(g.classList.add("is-visible"),xm(r),(b=g.querySelector(".ML__popover__current"))==null||b.scrollIntoView({block:"nearest",inline:"nearest"}))},32)}function Bg(){const r=document.getElementById("mathlive-suggestion-popover");return r?r.classList.contains("is-visible"):!1}function xm(r,o){var u;if(!r.element||r.element.mathfield!==r||!Bg())return;if(((u=r.model.at(r.model.position))==null?void 0:u.type)!=="latex"){Ta(r);return}if(o!=null&&o.deferred){setTimeout(()=>xm(r),32);return}const d=ku(r.field);if(!d)return;const g=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,b=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,M=window.innerWidth-document.documentElement.clientWidth,N=window.innerHeight-document.documentElement.clientHeight,I=window.mathVirtualKeyboard.boundingRect.height,F=document.getElementById("mathlive-suggestion-popover");d.x+F.offsetWidth/2>b-M?F.style.left=`${b-F.offsetWidth-M}px`:d.x-F.offsetWidth/2<0?F.style.left="0":F.style.left=`${d.x-F.offsetWidth/2}px`;const $=d.y-d.height;g-N-I-d.y<$?(F.classList.add("ML__popover--reverse-direction"),F.classList.remove("top-tip"),F.classList.add("bottom-tip"),F.style.top=`${d.y-d.height-F.offsetHeight-15}px`):(F.classList.remove("ML__popover--reverse-direction"),F.classList.add("top-tip"),F.classList.remove("bottom-tip"),F.style.top=`${d.y+15}px`)}function Ta(r){r.suggestionIndex=0;const o=document.getElementById("mathlive-suggestion-popover");o&&(o.classList.remove("is-visible"),o.innerHTML="")}function Wh(r,o){let u=document.getElementById("mathlive-suggestion-popover");return u||(u=n0("mathlive-suggestion-popover"),Hl("suggestion-popover"),Hl("core"),u.addEventListener("pointerdown",d=>d.preventDefault()),u.addEventListener("click",d=>{let g=d.target;for(;g&&!g.dataset.command;)g=g.parentElement;g&&(Yd(r,"reject"),Bn.insert(r.model,g.dataset.command,{selectionMode:"placeholder",format:"latex",mode:"math"}),r.dirty=!0,r.focus())})),u.innerHTML=window.MathfieldElement.createHTML(o),u}function pl(){document.getElementById("mathlive-suggestion-popover")&&(ym("mathlive-suggestion-popover"),h("suggestion-popover"),h("core"))}function vo(){const r=String(new Error().stack).replace(/^Error.*\n/,"").split(`
`);if(r.length===0)return console.error(`Can't use relative paths to specify assets location because the sourcefile location could not be determined (unexpected stack trace format "${new Error().stack}").`),"";let o=r[1],u=o.match(/http.*\.ts[\?:]/);return u&&(o=r[2]),u=o.match(/(https?:.*):[0-9]+:[0-9]+/),u||(u=o.match(/at (.*(\.ts))[\?:]/),u||(u=o.match(/at (.*(\.mjs|\.js))[\?:]/))),u?u[1]:(console.error(r),console.error(`Can't use relative paths to specify assets location because the source file location could not be determined (unexpected location "${o}").`),"")}var np=null,wm,Fg,rp=((Fg=(wm=globalThis==null?void 0:globalThis.document)==null?void 0:wm.currentScript)==null?void 0:Fg.src)||vo();function bm(r){return $0(this,null,function*(){if(/^(?:[a-z+]+:)?\/\//i.test(r))return new URL(r).href;if(np===null)try{const o=yield fetch(rp,{method:"HEAD"});o.status===200&&(np=o.url)}catch(o){console.error(`Invalid URL "${r}" (relative to "${rp}")`)}return new URL(r,np!=null?np:rp).href})}function Xi(r,o,u={}){return new FontFace(r,`url(${o}.woff2) format('woff2')`,u)}var Pa="not-loaded";function r0(){return $0(this,null,function*(){return Pa="not-loaded",o0()})}function o0(){return $0(this,null,function*(){var r;if(Pa!=="not-loaded")return;if(Pa="loading",(r=getComputedStyle(document.documentElement).getPropertyValue("--ML__static-fonts"))!=null?r:!1){Pa="ready";return}if(document.body.classList.remove("ML__fonts-did-not-load"),"fonts"in document){const u=["KaTeX_Main","KaTeX_Math","KaTeX_AMS","KaTeX_Caligraphic","KaTeX_Fraktur","KaTeX_SansSerif","KaTeX_Script","KaTeX_Typewriter","KaTeX_Size1","KaTeX_Size2","KaTeX_Size3","KaTeX_Size4"],d=Array.from(document.fonts).map(M=>M.family);if(u.every(M=>d.includes(M))){Pa="ready";return}if(!window.MathfieldElement.fontsDirectory){Pa="not-loaded";return}const g=yield bm(window.MathfieldElement.fontsDirectory);if(!g){document.body.classList.add("ML__fonts-did-not-load"),Pa="error";return}const b=[["KaTeX_Main-Regular"],["KaTeX_Main-BoldItalic",{style:"italic",weight:"bold"}],["KaTeX_Main-Bold",{weight:"bold"}],["KaTeX_Main-Italic",{style:"italic"}],["KaTeX_Math-Italic",{style:"italic"}],["KaTeX_Math-BoldItalic",{style:"italic",weight:"bold"}],["KaTeX_AMS-Regular"],["KaTeX_Caligraphic-Regular"],["KaTeX_Caligraphic-Bold",{weight:"bold"}],["KaTeX_Fraktur-Regular"],["KaTeX_Fraktur-Bold",{weight:"bold"}],["KaTeX_SansSerif-Regular"],["KaTeX_SansSerif-Bold",{weight:"bold"}],["KaTeX_SansSerif-Italic",{style:"italic"}],["KaTeX_Script-Regular"],["KaTeX_Typewriter-Regular"],["KaTeX_Size1-Regular"],["KaTeX_Size2-Regular"],["KaTeX_Size3-Regular"],["KaTeX_Size4-Regular"]].map(M=>Xi(M[0].replace(/-[a-zA-Z]+$/,""),`${g}/${M[0]}`,M[1]));try{(yield Promise.all(b.map(N=>{try{return N.load()}catch(I){}}))).forEach(N=>document.fonts.add(N)),Pa="ready";return}catch(M){console.error(`MathLive 0.98.5: The math fonts could not be loaded from "${g}"`,{cause:M}),document.body.classList.add("ML__fonts-did-not-load")}Pa="error"}})}function Rg(r){let o=0;for(let u=0;u<r.length;u++)o=o*31+r.charCodeAt(u),o=o|0;return Math.abs(o)}function ls(r,o){r&&(r.dirty||(r.dirty=!0,requestAnimationFrame(()=>{Jo(r)&&r.dirty&&(r.atomBoundsCache=new Map,qd(r,o),r.atomBoundsCache=void 0)})))}function Jd(r,o){var u;o=o!=null?o:{};const d=new Dr({from:rt(Q({},r.context),{atomIdsSettings:{seed:o.forHighlighting?Rg(oi.serialize([r.model.root],{expandMacro:!1,defaultMode:r.options.defaultMode})):"random",groupNumbers:(u=o.forHighlighting)!=null?u:!1},letterShapeStyle:r.options.letterShapeStyle}),mathstyle:r.options.defaultMode==="inline-math"?"textstyle":"displaystyle"}),g=r.model.root.render(d);return Id(uh(g,d),{classes:r.hasEditablePrompts?"ML__latex ML__prompting":"ML__latex",attributes:{translate:"no","aria-hidden":"true"}})}function Jv(r,o){const{model:u}=r;u.root.caret=void 0,u.root.isSelected=!1,u.root.containsCaret=!0;for(const g of u.atoms)g.caret=void 0,g.isSelected=!1,g.containsCaret=!1;if(u.selectionIsCollapsed){const g=u.at(u.position);g.caret=r.model.mode;let b=g.parent;for(;b;)b.containsCaret=!0,b=b.parent}else{const g=u.getAtoms(u.selection,{includeChildren:!0});for(const b of g)b.isSelected=!0}return Jd(r,o).toMarkup()}function qd(r,o){if(!Jo(r))return;o!=null||(o={});const u=r.element.querySelector("[part=virtual-keyboard-toggle]");u&&(u.style.display=r.hasEditableContent?"":"none");const d=r.field;if(!d)return;const g=r.isSelectionEditable&&r.hasFocus(),b=d.classList.contains("ML__focused");b&&!g?d.classList.remove("ML__focused"):!b&&g&&d.classList.add("ML__focused");let M=Jv(r,o);const N=r.element.querySelector("[part=menu-toggle]");if(N&&(r.model.atoms.length<=1||r.disabled||r.readOnly&&!r.hasEditableContent||r.userSelect==="none"?N.style.display="none":N.style.display=""),r.model.atoms.length<=1){const I=r.options.contentPlaceholder;I&&(M+=`<span part=placeholder class="ML__content-placeholder">${hs(I)}</span>`)}d.innerHTML=window.MathfieldElement.createHTML(M),Wl(r,o.interactive),r.dirty=!1}function Wl(r,o){const u=r.field;if(!u)return;for(const N of u.querySelectorAll(".ML__selection, .ML__contains-highlight"))N.remove();!(o!=null&&o)&&Pa!=="error"&&Pa!=="ready"&&setTimeout(()=>{Pa==="ready"?Wl(r):setTimeout(()=>Wl(r),128)},32);const d=r.model,g=u.offsetWidth,b=u.getBoundingClientRect().width;let M=Math.floor(b)/g;if(M=isNaN(M)?1:M,d.selectionIsCollapsed){xm(r,{deferred:!0});let N=d.at(d.position);for(;N&&N.type!=="prompt"&&!(N.containsCaret&&N.displayContainsHighlight);)N=N.parent;if(N!=null&&N.containsCaret&&N.displayContainsHighlight){const I=Wp(r,td(r,N),M);if(I){I.left/=M,I.right/=M,I.top/=M,I.bottom/=M;const F=document.createElement("div");F.classList.add("ML__contains-highlight"),F.style.position="absolute",F.style.left=`${I.left+1}px`,F.style.top=`${Math.ceil(I.top)}px`,F.style.width=`${Math.ceil(I.right-I.left)}px`,F.style.height=`${Math.ceil(I.bottom-I.top)}px`,u.insertBefore(F,u.childNodes[0])}}return}for(const N of qv(Zp(r,{excludeAtomsWithBackground:!0}))){N.left/=M,N.right/=M,N.top/=M,N.bottom/=M;const I=document.createElement("div");I.classList.add("ML__selection"),I.style.position="absolute",I.style.left=`${N.left}px`,I.style.top=`${N.top}px`,I.style.width=`${Math.ceil(N.right-N.left)}px`,I.style.height=`${Math.ceil(N.bottom-N.top-1)}px`,u.insertBefore(I,u.childNodes[0])}}function qv(r){let o=[];for(const u of r){let d=!1;for(const g of o)if(u.left===g.left&&u.right===g.right&&u.top===g.top&&u.bottom===g.bottom){d=!0;break}d||o.push(u)}r=o,o=[];for(const u of r){let d=0;for(const g of r)if(u.left>=g.left&&u.right<=g.right&&u.top>=g.top&&u.bottom<=g.bottom&&(d+=1,d>1))break;d===1&&o.push(u)}return o}var zg=3,Wn;function bs(r,o){o=Q({target:"mathfield",canUndo:!1,audioFeedback:void 0,changeContent:!1,changeSelection:!1},o!=null?o:{}),Wn||(Wn={});for(const u of Object.keys(r))console.assert(!Wn[u],"Selector already defined: ",u),Wn[u]=rt(Q({},o),{fn:r[u]})}function jg(r){let o;if(Array.isArray(r)){if(r[0]==="performWithFeedback")return jg(r[1]);o=r[0]}else o=r;return o=o.replace(/-\w/g,u=>u[1].toUpperCase()),Wn[o]}function Sc(r){var o;return(o=jg(r))==null?void 0:o.target}function Qv(r,o){var u;if(!o)return!1;let d,g=[],b=!1,M=!1;pt(o)?(d=o[0],g=o.slice(1)):d=o,d=d.replace(/-\w/g,F=>F[1].toUpperCase());const N=Wn[d],I=N==null?void 0:N.target;if(I==="model"){if(!r.isSelectionEditable&&(N!=null&&N.changeContent))return r.model.announce("plonk"),!1;/^(delete|add)/.test(d)&&(d!=="deleteBackward"&&r.flushInlineShortcutBuffer(),r.snapshot(d)),/^complete/.test(d)||Xd(r),Wn[d].fn(r.model,...g),i0(r),M=!0,b=!0}else if(I==="virtual-keyboard")M=(u=window.mathVirtualKeyboard.executeCommand(o))!=null?u:!1,b=!0;else if(Wn[d]){if(!r.isSelectionEditable&&(N!=null&&N.changeContent))return r.model.announce("plonk"),!1;/^(undo|redo)/.test(d)&&r.flushInlineShortcutBuffer(),M=Wn[d].fn(r,...g),b=!0}else throw new Error(`Unknown command "${d}"`);return I!=="virtual-keyboard"&&(!r.model.selectionIsCollapsed||N!=null&&N.changeSelection&&o!=="deleteBackward")&&(r.flushInlineShortcutBuffer(),N!=null&&N.changeContent||r.stopCoalescingUndo(),r.defaultStyle={}),M&&ls(r),b}function s0(r,o){var u;if(!r)return!1;r.focus(),N0.keypressVibration&&Jt()&&navigator.vibrate(zg);const d=jg(o);window.MathfieldElement.playSound((u=d==null?void 0:d.audioFeedback)!=null?u:"keypress");const g=r.executeCommand(o);return r.scrollIntoView(),g}bs({performWithFeedback:(r,o)=>s0(r,o)});function Ul(r){return i0(r,{atIndex:r.suggestionIndex+1}),!1}function Sm(r){return i0(r,{atIndex:r.suggestionIndex-1}),!1}bs({complete:Yd},{target:"mathfield",audioFeedback:"return",canUndo:!0,changeContent:!0,changeSelection:!0}),bs({nextSuggestion:Ul,previousSuggestion:Sm},{target:"mathfield",audioFeedback:"keypress",changeSelection:!0});var Mm="mathlive#virtual-keyboard-message";function $g(r){var o;return r.type!=="message"?!1:((o=r.data)==null?void 0:o.type)===Mm}var Kg=class B2{constructor(){this.targetOrigin=window.origin,this.originValidator="none",this._boundingRect=new DOMRect(0,0,0,0),this._isShifted=!1,window.addEventListener("message",this),this.sendMessage("proxy-created"),this.listeners={}}static get singleton(){return this._singleton||(this._singleton=new B2),this._singleton}set alphabeticLayout(o){this.sendMessage("update-setting",{alphabeticLayout:o})}set layouts(o){this.sendMessage("update-setting",{layouts:o})}get normalizedLayouts(){return[]}set editToolbar(o){this.sendMessage("update-setting",{editToolbar:o})}set actionKeycap(o){this.sendMessage("update-setting",{actionKeycap:o})}set shiftKeycap(o){this.sendMessage("update-setting",{shiftKeycap:o})}set backspaceKeycap(o){this.sendMessage("update-setting",{backspaceKeycap:o})}set tabKeycap(o){this.sendMessage("update-setting",{tabKeycap:o})}set container(o){throw new Error("Container inside an iframe cannot be changed")}show(o){this.sendMessage("show",o)}hide(o){this.sendMessage("hide",o)}get isShifted(){return this._isShifted}get visible(){return this._boundingRect.height>0}set visible(o){o?this.show():this.hide()}get boundingRect(){return this._boundingRect}executeCommand(o){return this.sendMessage("execute-command",{command:o}),!0}updateToolbar(o){this.sendMessage("update-toolbar",o)}update(o){this.sendMessage("update-setting",o)}connect(){this.sendMessage("connect")}disconnect(){this.sendMessage("disconnect")}addEventListener(o,u,d){this.listeners[o]||(this.listeners[o]=new Set),this.listeners[o].has(u)||this.listeners[o].add(u)}dispatchEvent(o){return!this.listeners[o.type]||this.listeners[o.type].size===0?!0:(this.listeners[o.type].forEach(u=>{typeof u=="function"?u(o):u==null||u.handleEvent(o)}),!o.defaultPrevented)}removeEventListener(o,u,d){this.listeners[o]&&this.listeners[o].delete(u)}handleEvent(o){if($g(o)){if(!ah(o.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${o.origin}) cannot be handled`,"SecurityError");this.handleMessage(o.data)}}handleMessage(o){const{action:u}=o;if(u==="execute-command"){const{command:d}=o;Sc(d)==="virtual-keyboard"&&this.executeCommand(d);return}if(u==="synchronize-proxy"){this._boundingRect=o.boundingRect,this._isShifted=o.isShifted;return}if(u==="geometry-changed"){this._boundingRect=o.boundingRect,this.dispatchEvent(new Event("geometrychange"));return}}sendMessage(o,u={}){if(!window.top)throw new DOMException("A frame does not have access to the top window and can\u2018t communicate with the keyboard. Review virtualKeyboardTargetOrigin and originValidator on mathfields embedded in an iframe","SecurityError");window.top.postMessage(Q({type:Mm,action:o},u),this.targetOrigin)}},Cm={numeric:{label:"123",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.numeric",rows:[[{latex:"x",shift:"y",variants:["y","z","t","r","x^2","x^n","x^{#?}","x_n","x_i","x_{#?}",{latex:"f(#?)",class:"small"},{latex:"g(#?)",class:"small"}]},{latex:"n",shift:"a",variants:["i","j","p","k","a","u"]},"[separator-5]","[7]","[8]","[9]","[/]","[separator-5]",{latex:"\\exponentialE",shift:"\\ln",variants:["\\exp","\\times 10^{#?}","\\ln","\\log_{10}","\\log"]},{latex:"\\imaginaryI",variants:["\\Re","\\Im","\\imaginaryJ","\\Vert #0 \\Vert"]},{latex:"\\pi",shift:"\\sin",variants:["\\prod",{latex:"\\theta",aside:"theta"},{latex:"\\rho",aside:"rho"},{latex:"\\tau",aside:"tau"},"\\sin","\\cos","\\tan"]}],[{label:"<",latex:"<",class:"hide-shift",shift:{latex:"\\le",label:"\u2264"}},{label:">",latex:">",class:"hide-shift",shift:{latex:"\\ge",label:"\u2265"}},"[separator-5]","[4]","[5]","[6]","[*]","[separator-5]",{class:"hide-shift",latex:"#@^2}",shift:"#@^{\\prime}}"},{latex:"#@^{#0}}",class:"hide-shift",shift:"#@_{#?}"},{class:"hide-shift",latex:"\\sqrt{#0}",shift:{latex:"\\sqrt[#0]{#?}}"}}],["[(]","[)]","[separator-5]","[1]","[2]","[3]","[-]","[separator-5]",{latex:"\\int^{\\infty}_{0}\\!#?\\,\\mathrm{d}x",class:"small hide-shift",shift:"\\int",variants:[{latex:"\\int_{#?}^{#?}",class:"small"},{latex:"\\int",class:"small"},{latex:"\\iint",class:"small"},{latex:"\\iiint",class:"small"},{latex:"\\oint",class:"small"},"\\mathrm{d}x",{latex:"\\dfrac{\\mathrm{d}}{\\mathrm{d} x}",class:"small"},{latex:"\\frac{\\partial}{\\partial x}",class:"small"},"\\partial"]},{class:"hide-shift",latex:"\\forall",shift:"\\exists"},{label:"[backspace]",width:1}],[{label:"[shift]",width:2},"[separator-5]","[0]","[.]","[=]","[+]","[separator-5]","[left]","[right]",{label:"[action]",width:1}]]},greek:{label:"&alpha;&beta;&gamma;",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.greek",rows:[[{label:"<i>&#x03c6;</i>",class:"MLK__tex hide-shift",insert:"\\varphi",aside:"phi var.",shift:"\\Phi"},{label:"<i>&#x03c2;</i>",class:"MLK__tex hide-shift",insert:"\\varsigma",aside:"sigma var.",shift:"\\Sigma"},{label:"<i>&#x03f5;</i>",class:"MLK__tex hide-shift",insert:"\\epsilon",aside:"espilon",shift:'\\char"0190'},{label:"<i>&rho;</i>",class:"MLK__tex hide-shift",insert:"\\rho",aside:"rho",shift:'\\char"3A1'},{label:"<i>&tau;</i>",class:"MLK__tex hide-shift",insert:"\\tau",aside:"tau",shift:'\\char"3A4'},{label:"<i>&upsilon;</i>",class:"MLK__tex hide-shift",insert:"\\upsilon",aside:"upsilon",shift:"\\Upsilon"},{label:"<i>&theta;</i>",class:"MLK__tex hide-shift",insert:"\\theta",aside:"theta",shift:"\\Theta"},{label:"<i>&iota;</i>",class:"MLK__tex hide-shift",insert:"\\iota",aside:"iota",shift:'\\char"399'},{label:"<i>&omicron;</i>",class:"MLK__tex hide-shift",insert:"\\omicron",aside:"omicron",shift:'\\char"39F'},{label:"<i>&pi;</i>",class:"MLK__tex hide-shift",insert:"\\pi",aside:"pi",shift:"\\Pi"}],["[separator-5]",{label:"<i>&alpha;</i>",class:"MLK__tex hide-shift",insert:"\\alpha",aside:"alpha",shift:'\\char"391'},{label:"<i>&sigma;</i>",class:"MLK__tex hide-shift",insert:"\\sigma",aside:"sigma",shift:"\\Sigma"},{label:"<i>&delta;</i>",class:"MLK__tex hide-shift",insert:"\\delta",aside:"delta",shift:"\\Delta"},{latex:"\\phi",class:"MLK__tex hide-shift",insert:"\\phi",aside:"phi",shift:"\\Phi"},{label:"<i>&gamma;</i>",class:"MLK__tex hide-shift",insert:"\\gamma",aside:"gamma",shift:"\\Gamma"},{label:"<i>&eta;</i>",class:"MLK__tex hide-shift",insert:"\\eta",aside:"eta",shift:'\\char"397'},{label:"<i>&xi;</i>",class:"MLK__tex hide-shift",insert:"\\xi",aside:"xi",shift:"\\Xi"},{label:"<i>&kappa;</i>",class:"MLK__tex hide-shift",insert:"\\kappa",aside:"kappa",shift:"\\Kappa"},{label:"<i>&lambda;</i>",class:"MLK__tex hide-shift",insert:"\\lambda",aside:"lambda",shift:"\\Lambda"},"[separator-5]"],["[shift]",{label:"<i>&zeta;</i>",class:"MLK__tex hide-shift",insert:"\\zeta",aside:"zeta",shift:'\\char"396'},{label:"<i>&chi;</i>",class:"MLK__tex hide-shift",insert:"\\chi",aside:"chi",shift:'\\char"3A7'},{label:"<i>&psi;</i>",class:"MLK__tex hide-shift",insert:"\\psi",aside:"zeta",shift:"\\Psi"},{label:"<i>&omega;</i>",class:"MLK__tex hide-shift",insert:"\\omega",aside:"omega",shift:"\\Omega"},{label:"<i>&beta;</i>",class:"MLK__tex hide-shift",insert:"\\beta",aside:"beta",shift:'\\char"392'},{label:"<i>&nu;</i>",class:"MLK__tex hide-shift",insert:"\\nu",aside:"nu",shift:'\\char"39D'},{label:"<i>&mu;</i>",class:"MLK__tex hide-shift",insert:"\\mu",aside:"mu",shift:'\\char"39C'},"[backspace]"],["[separator]",{label:"<i>&#x03b5;</i>",class:"MLK__tex",insert:"\\varepsilon",aside:"espilon var."},{label:"<i>&#x03d1;</i>",class:"MLK__tex",insert:"\\vartheta",aside:"theta var."},{label:"<i>&#x3f0;</i>",class:"MLK__tex",insert:"\\varkappa",aside:"kappa var."},{label:"<i>&#x03d6;</i>",class:"MLK__tex",insert:"\\varpi",aside:"pi var."},{label:"<i>&#x03f1;</i>",class:"MLK__tex",insert:"\\varrho",aside:"rho var."},"[left]","[right]","[action]"]]},symbols:{label:"&infin;\u2260\u2208",labelClass:"MLK__tex",tooltip:"keyboard.tooltip.symbols",rows:[[{latex:"\\sin",shift:"\\sin^{-1}",variants:[{class:"small",latex:"\\sinh"},{class:"small",latex:"\\sin^{-1}"},{class:"small",latex:"\\arsinh"}]},"\\ln",{latex:"\\mathrm{abs}",insert:"\\mathrm{abs}\\left(#0\\right)"},{latex:"\\rarr",shift:"\\rArr",variants:[{latex:"\\implies",aside:"implies"},{latex:"\\to",aside:"to"},"\\dashv",{latex:"\\roundimplies",aside:"round implies"}]},{latex:"\\exists",variants:["\\nexists"],shift:"\\nexists"},{latex:"\\in",shift:"\\notin",variants:["\\notin","\\owns"]},"\\cup",{latex:"\\overrightarrow{#@}",shift:"\\overleftarrow{#@}",variants:["\\overleftarrow{#@}","\\bar{#@}","\\vec{#@}","\\hat{#@}","\\check{#@}","\\dot{#@}","\\ddot{#@}","\\mathring{#@}","\\breve{#@}","\\acute{#@}","\\tilde{#@}","\\grave{#@}"]},{class:"small",latex:"\\lim_{#?}",shift:"\\lim_{x\\to\\infty}",variants:[{class:"small",latex:"\\liminf_{#?}"},{class:"small",latex:"\\limsup_{#?}"}]},"\\exponentialE"],[{latex:"\\cos",shift:"\\cos^{-1}",variants:[{class:"small",latex:"\\cosh"},{class:"small",latex:"\\cos^{-1}"},{class:"small",latex:"\\arcosh"}]},{latex:"\\log",shift:"\\log_{10}",variants:["\\log_{#0}","\\log_{10}"]},"\\left\\vert#0\\right\\vert",{latex:"\\larr",shift:"\\lArr",variants:[{latex:"\\impliedby",aside:"implied by"},{latex:"\\gets",aside:"gets"},"\\lArr","\\vdash",{latex:"\\models",aside:"models"}]},{latex:"\\forall",shift:"\\lnot",variants:[{latex:"\\land",aside:"and"},{latex:"\\lor",aside:"or"},{latex:"\\oplus",aside:"xor"},{latex:"\\lnot",aside:"not"},{latex:"\\downarrow",aside:"nor"},{latex:"\\uparrow",aside:"nand"},{latex:"\\curlywedge",aside:"nor"},{latex:"\\bar\\curlywedge",aside:"nand"}]},{latex:"\\ni",shift:"\\not\\owns"},"\\cap",{latex:"\\overline{#@}",shift:"\\underline{#@}",variants:["\\overbrace{#@}","\\overlinesegment{#@}","\\overleftrightarrow{#@}","\\overrightarrow{#@}","\\overleftarrow{#@}","\\overgroup{#@}","\\underbrace{#@}","\\underlinesegment{#@}","\\underleftrightarrow{#@}","\\underrightarrow{#@}","\\underleftarrow{#@}","\\undergroup{#@}"]},{class:"hide-shift",latex:"\\int",shift:"\\iint",variants:[{latex:"\\int_{#?}^{#?}",class:"small"},{latex:"\\int",class:"small"},{latex:"\\smallint",class:"small"},{latex:"\\iint",class:"small"},{latex:"\\iiint",class:"small"},{latex:"\\oint",class:"small"},"\\intop","\\iiint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\ointctrclockwise","\\intctrclockwise"]},{latex:"\\pi",shift:"\\tau",variants:["\\tau"]}],[{latex:"\\tan",shift:"\\tan^{-1}",variants:[{class:"small",latex:"\\tanh"},{class:"small",latex:"\\tan^{-1}"},{class:"small",latex:"\\artanh"},{class:"small",latex:"\\arctan"},{class:"small",latex:"\\arctg"},{class:"small",latex:"\\tg"}]},{latex:"\\exp",insert:"\\exp\\left(#0\\right)",variants:["\\exponentialE^{#0}"]},"\\left\\Vert#0\\right\\Vert",{latex:"\\lrArr",shift:"\\leftrightarrow",variants:[{latex:"\\iff",aside:"if and only if"},"\\leftrightarrow","\\leftrightarrows","\\Leftrightarrow",{latex:"^\\biconditional",aside:"biconditional"}]},{latex:"\\vert",shift:"!"},{latex:"#@^{\\complement}",aside:"complement",variants:[{latex:"\\setminus",aside:"set minus"},{latex:"\\smallsetminus",aside:"small set minus"}]},{latex:"\\subset",shift:"\\subseteq",variants:["\\subset","\\subseteq","\\subsetneq","\\varsubsetneq","\\subsetneqq","\\nsubset","\\nsubseteq","\\supset","\\supseteq","\\supsetneq","\\supsetneqq","\\nsupset","\\nsupseteq"]},{latex:"#@^{\\prime}",shift:"#@^{\\doubleprime}",variants:["#@^{\\doubleprime}","#@\\degree"]},{latex:"\\mathrm{d}",shift:"\\partial",variants:["\\mathrm{d}x",{latex:"\\dfrac{\\mathrm{d}}{\\mathrm{d} x}",class:"small"},{latex:"\\frac{\\partial}{\\partial x}",class:"small"},"\\partial"]},{latex:"\\infty",variants:["\\aleph_0","\\aleph_1","\\omega","\\mathfrak{m}"]}],[{label:"[shift]",width:2},{class:"box",latex:",",shift:";",variants:[";","?"]},{class:"box",latex:"\\colon",shift:"\\Colon",variants:[{latex:"\\Colon",aside:"such that",class:"box"},{latex:":",aside:"ratio",class:"box"},{latex:"\\vdots",aside:"",class:"box"},{latex:"\\ddots",aside:"",class:"box"},{latex:"\\ldotp",aside:"low dot",class:"box"},{latex:"\\cdotp",aside:"center dot",class:"box"},{latex:"\\ldots",aside:"low ellipsis",class:"box"},{latex:"\\cdots",aside:"center ellipsis",class:"box"},{latex:"\\therefore",aside:"therefore",class:"box"},{latex:"\\because",aside:"because",class:"box"}]},{class:"box",latex:"\\cdot",aside:"centered dot",shift:"\\ast",variants:["\\circ","\\bigcirc","\\bullet","\\odot","\\oslash","\\circledcirc","\\ast","\\star","\\times","\\doteq","\\doteqdot"]},"[separator]","[left]","[right]",{label:"[backspace]",width:1,class:"action hide-shift"},{label:"[action]",width:1}]]},compact:{label:"compact",rows:[["[+]","[-]","[*]","[/]","[=]","[.]","[(]","[)]","\\sqrt{#0}","#@^{#?}"],["[1]","[2]","[3]","[4]","[5]","[6]","[7]","[8]","[9]","[0]"],["[hr]"],["[undo]","[redo]","[separator]","[separator]","[separator]","[left]","[right]",{label:"[backspace]",class:"action hide-shift"},"[hide-keyboard]"]]},minimalist:{label:"minimalist",layers:[{style:`
.minimalist-backdrop {
display: flex;
justify-content: center;
}
.minimalist-container {
--keycap-height: 40px;
--keycap-max-width: 53px;
--keycap-small-font-size: 12px;
background: var(--keyboard-background);
padding: 20px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
border: 1px solid var(--keyboard-border);
box-shadow: 0 0 32px rgb(0 0 0 / 30%);
}
`,backdrop:"minimalist-backdrop",container:"minimalist-container",rows:[["+","-","\\times",{latex:"\\frac{#@}{#0}",class:"small"},"=","[.]","(",")",{latex:"\\sqrt{#0}",class:"small"},{latex:"#@^{#?}",class:"small"}],["1","2","3","4","5","6","7","8","9","0"],["[hr]"],["[undo]","[redo]","[separator]","[separator]","[separator]","[left]","[right]",{label:"[backspace]",class:"action hide-shift"},"[hide-keyboard]"]]}]},"numeric-only":{label:"123",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.numeric",id:"numeric-only",rows:[["7","8","9","[separator]",{label:"[backspace]",width:2}],["4","5","6","[separator]","[separator]","[separator]"],["1","2","3","[separator]","[separator]","[separator]"],["0",{label:"[.]",variants:[]},"-","[separator]","[left]","[right]"]]}},a0={0:["\\varnothing","\\infty"],1:["\\frac{1}{#@}","#@^{-1}","\\times 10^{#?}","\\phi","\\imaginaryI"],2:["\\frac{1}{2}","#@^2","\\sqrt2","\\exponentialE"],3:["\\frac{1}{3}","#@^3","\\sqrt3","\\pi"],4:["\\frac{1}{4}","#@^4"],5:["\\frac{1}{5}","#@^5","\\sqrt5"],6:["\\frac{1}{6}","#@^6"],7:["\\frac{1}{7}","#@^7"],8:["\\frac{1}{8}","#@^8"],9:["\\frac{1}{9}","#@^9"],".":[".",",",";","\\colon"],",":["{,}",".",";","\\colon"],a:[{latex:"\\aleph",aside:"aleph"},{latex:"\\forall",aside:"for all"},"\xE0","\xE1","\xE2","\xE4","\xE6"],b:[{latex:"\\beth",aside:"beth"}],c:[{latex:"\\C",aside:"set of complex numbers"},"\xE7"],d:[{latex:"\\daleth",aside:"daleth"}],e:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn\u2019t"},"\xE8","\xE9","\xEA","\xEB"],g:[{latex:"\\gimel",aside:"gimel"}],h:[{latex:"\\hbar",aside:"h bar"},{latex:"\\hslash",aside:"h slash"}],i:[{latex:"\\imaginaryI",aside:"imaginary i"},"\xEC","\xED","\xEE","\xEF"],j:[{latex:"\\imaginaryJ",aside:"imaginary j"}],l:[{latex:"\\ell",aside:"ell"}],n:[{latex:"\\mathbb{N}",aside:"set of natural numbers"},"\xF1"],o:["\xF8","\u0153","\xF2","\xF3","\xF4","\xF6","\u0153"],p:[{latex:"\\mathbb{P}",aside:"set of primes"}],q:[{latex:"\\mathbb{Q}",aside:"set of rational numbers"}],r:[{latex:"\\mathbb{R}",aside:"set of real numbers"}],u:["\xF9","\xFA","\xFB","\xFC"],z:[{latex:"\\mathbb{Z}",aside:"set of integers"}],y:["\xFD","\xFF"],space:[{latex:'\\char"203A\\!\\char"2039',insert:"\\!",aside:"negative thin space<br>\u207B\xB3\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\,\\char"2039',insert:"\\,",aside:"thin space<br>\xB3\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\:\\char"2039',insert:"\\:",aside:"medium space<br>\u2074\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\;\\char"2039',insert:"\\;",aside:"thick space<br>\u2075\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\ \\char"2039',insert:"\\ ",aside:"\u2153 em"},{latex:'\\char"203A\\enspace\\char"2039',insert:"\\enspace",aside:"\xBD em"},{latex:'\\char"203A\\quad\\char"2039',insert:"\\quad",aside:"1 em"},{latex:'\\char"203A\\qquad\\char"2039',insert:"\\qquad",aside:"2 em"}]},l0;function Hg(r,o){var u,d,g;const b=tf.singleton;if(!b)return;const M=Zl(r),N=(d=(u=b.getKeycap(M==null?void 0:M.id))==null?void 0:u.variants)!=null?d:"";if(typeof N=="string"&&!km(N)||Array.isArray(N)&&N.length===0){o==null||o();return}const I={};let F="";for(const Ne of Lm(N)){const Bi=iy(Ne),Ee=Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36);I[Ee]=Bi;const[hi,$i]=sp(Bi);F+=`<div id=${Ee} class="item ${$i}">${hi}</div>`}const $=document.createElement("div");$.setAttribute("aria-hidden","true"),$.className="MLK__variant-panel",$.style.height="auto";const it=Object.keys(I).length;let gt=5;it===1?gt=1:it===2||it===4?gt=2:it===3||it===5||it===6?gt=3:it>=7&&it<14&&(gt=4),$.style.width=`calc(var(--variant-keycap-length) * ${gt} + 12px)`,$.innerHTML=N0.createHTML(F),Vh.open({root:(g=b==null?void 0:b.container)==null?void 0:g.querySelector(".ML__keyboard"),child:$}),l0=new AbortController;const{signal:_t}=l0,zt=r==null?void 0:r.getBoundingClientRect();if(zt){zt.top-$.clientHeight<0&&($.style.width="auto",it<=6?$.style.height="56px":it<=12?$.style.height="108px":it<=18?$.style.height="205px":$.classList.add("compact"));const Ne=Math.max(0,Math.min(window.innerWidth-$.offsetWidth,(zt.left+zt.right-$.offsetWidth)/2)),Bi=zt.top-$.clientHeight+5;$.style.transform=`translate(${Ne}px, ${Bi}px)`,$.classList.add("is-visible"),requestAnimationFrame(()=>{$.addEventListener("pointerup",Ee=>{const hi=Zl(Ee.target);!(hi!=null&&hi.id)||!I[hi.id]||(Qd(I[hi.id]),u0(),o==null||o(),Ee.preventDefault())},{capture:!0,passive:!1,signal:_t}),$.addEventListener("pointerenter",Ee=>{const hi=Zl(Ee.target);!(hi!=null&&hi.id)||!I[hi.id]||hi.classList.add("is-active")},{capture:!0,signal:_t}),$.addEventListener("pointerleave",Ee=>{const hi=Zl(Ee.target);!(hi!=null&&hi.id)||!I[hi.id]||hi.classList.remove("is-active")},{capture:!0,signal:_t}),window.addEventListener("pointercancel",()=>{u0(),o==null||o()},{signal:_t}),window.addEventListener("pointerup",()=>{u0(),o==null||o()},{signal:_t})})}}function u0(){l0==null||l0.abort(),l0=null,Vh.state==="open"&&Vh.close()}function ty(r){if(r==="foreground-color"){const o=[];for(const u of Object.keys(Bt))o.push({class:"swatch-button",label:'<span style="border: 3px solid '+Bt[u]+'"></span>',command:["applyStyle",{color:u}]});return o}if(r==="background-color"){const o=[];for(const u of Object.keys(Et))o.push({class:"swatch-button",label:'<span style="background:'+Et[u]+'"></span>',command:["applyStyle",{backgroundColor:u}]});return o}}function km(r){return a0[r]!==void 0}function Lm(r){var o;return typeof r!="string"?r:(a0[r]||(a0[r]=(o=ty(r))!=null?o:[]),a0[r])}function o1(r){return typeof r=="string"?r:Object.entries(r).map(([o,u])=>`${o}:${u} !important`).join(";")}function dx(r){return Object.keys(r).map(o=>`${o} {${o1(r[o])}}`).join("")}function op(r){if(!r)return"";const o=new Dr,u=new oi({mode:"math",type:"root",body:vs(r,{context:o,args:g=>g==="@"?"{\\class{ML__box-placeholder}{\\blacksquare}}":"\\placeholder{}"})}),d=Dh(uh(new zi(u.render(o),{classes:"ML__base"}),o));return Id(d,{classes:"ML__latex"}).toMarkup()}function h0(r){var o;if(Array.isArray(r))return r.map(d=>h0(d)).flat();const u=typeof r=="string"?{markup:r}:r;return"rows"in u&&Array.isArray(u.rows)&&(u.rows=u.rows.map(d=>d.map(g=>iy(g)))),(o=u.id)!=null||(u.id="ML__layer_"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36)),[u]}function Vg(){var r,o;let d=window.mathVirtualKeyboard.alphabeticLayout;if(d==="auto"){const N=rd();N&&(d=N.virtualLayout),(!d||d==="auto")&&(d=(r={fr:"azerty",be:"azerty",al:"qwertz",ba:"qwertz",cz:"qwertz",de:"qwertz",hu:"qwertz",sk:"qwertz",ch:"qwertz"}[$t.locale.slice(0,2)])!=null?r:"qwerty")}const g={qwerty:["qwertyuiop"," asdfghjkl ","^zxcvbnm~"],azerty:["azertyuiop","qsdfghjklm","^ wxcvbn ~"],qwertz:["qwertzuiop"," asdfghjkl ","^yxcvbnm~"],dvorak:["^ pyfgcrl ","aoeuidhtns","qjkxbmwvz~"],colemak:[" qwfpgjluy ","arstdhneio","^zxcvbkm~"]},b=(o=g[d])!=null?o:g.qwerty,M=d==="azerty"?[[{label:"1",variants:"1"},{label:"2",shift:{latex:"\xE9"},variants:"2"},{label:"3",shift:{latex:"\xF9"},variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{label:"(",latex:"("},variants:"5"},{label:"6",shift:{label:")",latex:")"},variants:"6"},{label:"7",shift:{latex:"\xE8"},variants:"7"},{label:"8",shift:{latex:"\xEA"},variants:"8"},{label:"9",shift:{latex:"\xE7"},variants:"9"},{label:"0",shift:{latex:"\xE0"},variants:"0"}]]:[[{label:"1",variants:"1"},{label:"2",variants:"2"},{label:"3",variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{latex:"\\frac{#@}{#?}"},variants:"5"},{label:"6",shift:{latex:"#@^#?"},variants:"6"},{label:"7",variants:"7"},{label:"8",shift:{latex:"\\times"},variants:"8"},{label:"9",shift:{label:"(",latex:"("},variants:"9"},{label:"0",shift:{label:")",latex:")"},variants:"0"}]];for(const N of b){const I=[];for(const F of N)/[a-z]/.test(F)?I.push({label:F,class:"hide-shift",shift:{label:F.toUpperCase()},variants:km(F)?F:void 0}):F==="~"?d!=="dvorak"?I.push("[backspace]"):I.push({label:"[backspace]",width:1}):F==="^"?I.push("[shift]"):F===" "&&I.push("[separator-5]");M.push(I)}return M.push(["[-]","[+]","[=]",{label:" ",width:1.5},{label:",",shift:";",variants:".",class:"hide-shift"},"[.]","[left]","[right]",{label:"[action]",width:1.5}]),{label:"abc",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.alphabetic",layers:h0({rows:M})}}function Wg(r){if(r==="alphabetic")return Vg();if(typeof r=="string")return console.assert(Cm[r]!==void 0,`MathLive 0.98.5: unknown keyboard layout "${r}"`),Wg(Cm[r]);let o;if("rows"in r&&Array.isArray(r.rows)){console.assert(!("layers"in r||"markup"in r),'MathLive 0.98.5: when providing a "rows" property, "layers" and "markup" are ignored');const g=r,{rows:b}=g,M=be(g,["rows"]);o=rt(Q({},M),{layers:h0({rows:r.rows})})}else if("markup"in r&&typeof r.markup=="string"){const g=r,{markup:b}=g,M=be(g,["markup"]);o=rt(Q({},M),{layers:h0(r.markup)})}else o=Q({},r),"layers"in r?o.layers=h0(r.layers):console.error('MathLive 0.98.5: provide either a "rows", "markup" or "layers" property');let u=!1,d=!1;for(const g of o.layers)if(g.rows)for(const b of g.rows.flat()){sd(b)&&(u=!0);const M=b.command;typeof M=="string"&&["undo","redo","cut","copy","paste"].includes(M)&&(d=!0)}return(!("displayShiftedKeycaps"in r)||r.displayShiftedKeycaps===void 0)&&(o.displayShiftedKeycaps=u),(!("displayEditToolbar"in r)||r.displayEditToolbar===void 0)&&(o.displayEditToolbar=!d),o}function Em(r,o){var u,d;let g='<div class="left">';if(r.normalizedLayouts.length>1)for(const[b,M]of r.normalizedLayouts.entries()){const N=M,I=[b===o?"selected":"layer-switch"];N.tooltip&&I.push("MLK__tooltip"),N.labelClass&&I.push(...N.labelClass.split(" ")),g+=`<div class="${I.join(" ")}"`,N.tooltip&&(g+=" data-tooltip='"+((u=Xt(N.tooltip))!=null?u:N.tooltip)+"' "),b!==o&&(g+=`data-layer="${N.layers[0].id}"`),g+=`>${(d=N.label)!=null?d:"untitled"}</div>`}return g+="</div>",g}function s1(r,o){let u="";if(r.editToolbar==="none")return"";const g=[];o.selectionIsCollapsed?g.push("undo","redo","pasteFromClipboard"):g.push("cutToClipboard","copyToClipboard","pasteFromClipboard");const b={undo:`<div class='action ${o.canUndo===!1?"disabled":""}'
data-command='"undo"'
data-tooltip='${Xt("tooltip.undo")}'>
<svg><use xlink:href='#svg-undo' /></svg>
</div>`,redo:`<div class='action ${o.canRedo===!1?"disabled":""}'
data-command='"redo"'
data-tooltip='${Xt("tooltip.redo")}'>
<svg><use xlink:href='#svg-redo' /></svg>
</div>`,cutToClipboard:`
<div class='action'
data-command='"cutToClipboard"'
data-tooltip='${Xt("tooltip.cut to clipboard")}'>
<svg><use xlink:href='#svg-cut' /></svg>
</div>
`,copyToClipboard:`
<div class='action'
data-command='"copyToClipboard"'
data-tooltip='${Xt("tooltip.copy to clipboard")}'>
<svg><use xlink:href='#svg-copy' /></svg>
</div>
`,pasteFromClipboard:`
<div class='action'
data-command='"pasteFromClipboard"'
data-tooltip='${Xt("tooltip.paste from clipboard")}'>
<svg><use xlink:href='#svg-paste' /></svg>
</div>
`};return u+=g.map(M=>b[M]).join(""),u}function ca(r){for(const o of r)Ug(o)}function Ug(r){const o=tf.singleton;if(!o)return;const u={};if(!r.id){if(r.hasAttribute("data-label")&&(u.label=r.dataset.label),r.hasAttribute("data-latex")&&(u.latex=r.dataset.latex),r.hasAttribute("data-key")&&(u.key=r.dataset.key),r.hasAttribute("data-insert")&&(u.insert=r.dataset.insert),r.hasAttribute("data-variants")&&(u.variants=r.dataset.variants),r.hasAttribute("data-aside")&&(u.aside=r.dataset.aside),r.className&&(u.class=r.className),!u.label&&!u.latex&&!u.key&&!u.insert&&(u.latex=r.innerText,u.label=r.innerHTML),r.hasAttribute("data-command"))try{u.command=JSON.parse(r.dataset.command)}catch(d){}r.id=o.registerKeycap(u)}if(!r.innerHTML){const[d,g]=sp(u);r.innerHTML=window.MathfieldElement.createHTML(d)}}function ey(){Hl("virtual-keyboard"),Hl("core"),o0()}function hh(){h("core"),h("virtual-keyboard")}var da=`<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="svg-delete-backward" viewBox="0 0 576 512">
<path d="M432.1 208.1L385.9 256L432.1 303C442.3 312.4 442.3 327.6 432.1 336.1C423.6 346.3 408.4 346.3 399 336.1L352 289.9L304.1 336.1C295.6 346.3 280.4 346.3 271 336.1C261.7 327.6 261.7 312.4 271 303L318.1 256L271 208.1C261.7 199.6 261.7 184.4 271 175C280.4 165.7 295.6 165.7 304.1 175L352 222.1L399 175C408.4 165.7 423.6 165.7 432.1 175C442.3 184.4 442.3 199.6 432.1 208.1V208.1zM512 64C547.3 64 576 92.65 576 128V384C576 419.3 547.3 448 512 448H205.3C188.3 448 172 441.3 160 429.3L9.372 278.6C3.371 272.6 0 264.5 0 256C0 247.5 3.372 239.4 9.372 233.4L160 82.75C172 70.74 188.3 64 205.3 64L512 64zM528 128C528 119.2 520.8 112 512 112H205.3C201 112 196.9 113.7 193.9 116.7L54.63 256L193.9 395.3C196.9 398.3 201 400 205.3 400H512C520.8 400 528 392.8 528 384V128z"/>
</symbol>
<symbol id="svg-shift" viewBox="0 0 384 512">
<path d="M2.438 252.3C7.391 264.2 19.06 272 32 272h80v160c0 26.51 21.49 48 48 48h64C250.5 480 272 458.5 272 432v-160H352c12.94 0 24.61-7.797 29.56-19.75c4.953-11.97 2.219-25.72-6.938-34.88l-160-176C208.4 35.13 200.2 32 192 32S175.6 35.13 169.4 41.38l-160 176C.2188 226.5-2.516 240.3 2.438 252.3zM192 86.63L313.4 224H224v208H160V224H70.63L192 86.63z"/>
</symbol>
<symbol id="svg-commit" viewBox="0 0 512 512">
<path d="M135 432.1l-128-128C2.344 300.3 0 294.2 0 288s2.344-12.28 7.031-16.97l128-128c9.375-9.375 24.56-9.375 33.94 0s9.375 24.56 0 33.94L81.94 264H464v-208C464 42.75 474.8 32 488 32S512 42.75 512 56V288c0 13.25-10.75 24-24 24H81.94l87.03 87.03c9.375 9.375 9.375 24.56 0 33.94S144.4 442.3 135 432.1z"/>
</symbol>
<symbol id="circle-plus" viewBox="0 0 512 512"><path d="M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM232 344c0 13.3 10.7 24 24 24s24-10.7 24-24V280h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H280V168c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H168c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"/></symbol>
<symbol id="svg-command" viewBox="0 0 640 512">
<path d="M34.495 36.465l211.051 211.05c4.686 4.686 4.686 12.284 0 16.971L34.495 475.535c-4.686 4.686-12.284 4.686-16.97 0l-7.071-7.07c-4.686-4.686-4.686-12.284 0-16.971L205.947 256 10.454 60.506c-4.686-4.686-4.686-12.284 0-16.971l7.071-7.07c4.686-4.687 12.284-4.687 16.97 0zM640 468v-10c0-6.627-5.373-12-12-12H300c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h328c6.627 0 12-5.373 12-12z"/>
</symbol>
<symbol id="svg-undo" viewBox="0 0 512 512">
<path d="M20 8h10c6.627 0 12 5.373 12 12v110.625C85.196 57.047 165.239 7.715 256.793 8.001 393.18 8.428 504.213 120.009 504 256.396 503.786 393.181 392.834 504 256 504c-63.926 0-122.202-24.187-166.178-63.908-5.113-4.618-5.354-12.561-.482-17.433l7.069-7.069c4.503-4.503 11.749-4.714 16.482-.454C150.782 449.238 200.935 470 256 470c117.744 0 214-95.331 214-214 0-117.744-95.331-214-214-214-82.862 0-154.737 47.077-190.289 116H180c6.627 0 12 5.373 12 12v10c0 6.627-5.373 12-12 12H20c-6.627 0-12-5.373-12-12V20c0-6.627 5.373-12 12-12z"/>
</symbol>
<symbol id="svg-redo" viewBox="0 0 512 512">
<path d="M492 8h-10c-6.627 0-12 5.373-12 12v110.625C426.804 57.047 346.761 7.715 255.207 8.001 118.82 8.428 7.787 120.009 8 256.396 8.214 393.181 119.166 504 256 504c63.926 0 122.202-24.187 166.178-63.908 5.113-4.618 5.354-12.561.482-17.433l-7.069-7.069c-4.503-4.503-11.749-4.714-16.482-.454C361.218 449.238 311.065 470 256 470c-117.744 0-214-95.331-214-214 0-117.744 95.331-214 214-214 82.862 0 154.737 47.077 190.289 116H332c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h160c6.627 0 12-5.373 12-12V20c0-6.627-5.373-12-12-12z"/>
</symbol>
<symbol id="svg-arrow-left" viewBox="0 0 320 512">
<path d="M206.7 464.6l-183.1-191.1C18.22 267.1 16 261.1 16 256s2.219-11.97 6.688-16.59l183.1-191.1c9.152-9.594 24.34-9.906 33.9-.7187c9.625 9.125 9.938 24.37 .7187 33.91L73.24 256l168 175.4c9.219 9.5 8.906 24.78-.7187 33.91C231 474.5 215.8 474.2 206.7 464.6z"/>
</symbol>
<symbol id="svg-arrow-right" viewBox="0 0 320 512">
<path d="M113.3 47.41l183.1 191.1c4.469 4.625 6.688 10.62 6.688 16.59s-2.219 11.97-6.688 16.59l-183.1 191.1c-9.152 9.594-24.34 9.906-33.9 .7187c-9.625-9.125-9.938-24.38-.7187-33.91l168-175.4L78.71 80.6c-9.219-9.5-8.906-24.78 .7187-33.91C88.99 37.5 104.2 37.82 113.3 47.41z"/>
</symbol>
<symbol id="svg-tab" viewBox="0 0 448 512">
<path d="M32 217.1c0-8.8 7.2-16 16-16h144v-93.9c0-7.1 8.6-10.7 13.6-5.7l143.5 143.1c6.3 6.3 6.3 16.4 0 22.7L205.6 410.4c-5 5-13.6 1.5-13.6-5.7v-93.9H48c-8.8 0-16-7.2-16-16v-77.7m-32 0v77.7c0 26.5 21.5 48 48 48h112v61.9c0 35.5 43 53.5 68.2 28.3l143.6-143c18.8-18.8 18.8-49.2 0-68L228.2 78.9c-25.1-25.1-68.2-7.3-68.2 28.3v61.9H48c-26.5 0-48 21.6-48 48zM436 64h-8c-6.6 0-12 5.4-12 12v360c0 6.6 5.4 12 12 12h8c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12z"/>
</symbol>
<symbol id="svg-paste" viewBox="0 0 512 512"><path d="M160 32c11.6 0 21.3 8.2 23.5 19.2C185 58.6 191.6 64 199.2 64H208c8.8 0 16 7.2 16 16V96H96V80c0-8.8 7.2-16 16-16h8.8c7.6 0 14.2-5.4 15.7-12.8C138.7 40.2 148.4 32 160 32zM64 64h2.7C65 69 64 74.4 64 80V96c0 17.7 14.3 32 32 32H224c17.7 0 32-14.3 32-32V80c0-5.6-1-11-2.7-16H256c17.7 0 32 14.3 32 32h32c0-35.3-28.7-64-64-64H210.6c-9-18.9-28.3-32-50.6-32s-41.6 13.1-50.6 32H64C28.7 32 0 60.7 0 96V384c0 35.3 28.7 64 64 64H192V416H64c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32zM288 480c-17.7 0-32-14.3-32-32V192c0-17.7 14.3-32 32-32h96v56c0 22.1 17.9 40 40 40h56V448c0 17.7-14.3 32-32 32H288zM416 165.3L474.7 224H424c-4.4 0-8-3.6-8-8V165.3zM448 512c35.3 0 64-28.7 64-64V235.9c0-12.7-5.1-24.9-14.1-33.9l-59.9-59.9c-9-9-21.2-14.1-33.9-14.1H288c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H448z"/></symbol>
<symbol id="svg-cut" viewBox="0 0 512 512"><path d="M485.6 444.2L333.6 314.9C326.9 309.2 326.1 299.1 331.8 292.4C337.5 285.6 347.6 284.8 354.4 290.5L506.4 419.8C513.1 425.5 513.9 435.6 508.2 442.4C502.5 449.1 492.4 449.9 485.6 444.2zM485.7 67.76C492.5 62.07 502.5 62.94 508.2 69.69C513.9 76.45 513.1 86.55 506.3 92.24L208.5 343.1C218.3 359.7 224 379.2 224 400C224 461.9 173.9 512 112 512C50.14 512 0 461.9 0 400C0 338.1 50.14 288 112 288C141.5 288 168.4 299.4 188.4 318.1L262.2 256L188.4 193.9C168.4 212.6 141.5 224 112 224C50.14 224 0 173.9 0 112C0 50.14 50.14 0 112 0C173.9 0 224 50.14 224 112C224 132.8 218.3 152.3 208.5 168.9L287 235.1L485.7 67.76zM32 112C32 156.2 67.82 192 112 192C156.2 192 192 156.2 192 112C192 67.82 156.2 32 112 32C67.82 32 32 67.82 32 112zM112 480C156.2 480 192 444.2 192 400C192 355.8 156.2 320 112 320C67.82 320 32 355.8 32 400C32 444.2 67.82 480 112 480z"/></symbol>
<symbol id="svg-copy" viewBox="0 0 512 512"><path d="M272 416C263.2 416 256 423.2 256 432V448c0 17.67-14.33 32-32 32H64c-17.67 0-32-14.33-32-32V192c0-17.67 14.33-32 32-32h112C184.8 160 192 152.8 192 144C192 135.2 184.8 128 176 128H63.99c-35.35 0-64 28.65-64 64l.0098 256C0 483.3 28.65 512 64 512h160c35.35 0 64-28.65 64-64v-16C288 423.2 280.8 416 272 416zM502.6 86.63l-77.25-77.25C419.4 3.371 411.2 0 402.7 0H288C252.7 0 224 28.65 224 64v256c0 35.35 28.65 64 64 64h160c35.35 0 64-28.65 64-64V109.3C512 100.8 508.6 92.63 502.6 86.63zM416 45.25L466.7 96H416V45.25zM480 320c0 17.67-14.33 32-32 32h-160c-17.67 0-32-14.33-32-32V64c0-17.67 14.33-32 32-32h96l.0026 64c0 17.67 14.33 32 32 32H480V320z"/>
</symbol>
<symbol id="svg-angle-double-right" viewBox="0 0 512 512"><path d="M470.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256 265.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L210.7 256 73.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z"/>
</symbol>
<symbol id="svg-angle-double-left" viewBox="0 0 512 512"><path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L301.3 256 438.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z"/>
</symbol>
<symbol id="svg-trash" viewBox="0 0 448 512">
<path d="M336 64l-33.6-44.8C293.3 7.1 279.1 0 264 0h-80c-15.1 0-29.3 7.1-38.4 19.2L112 64H24C10.7 64 0 74.7 0 88v2c0 3.3 2.7 6 6 6h26v368c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V96h26c3.3 0 6-2.7 6-6v-2c0-13.3-10.7-24-24-24h-88zM184 32h80c5 0 9.8 2.4 12.8 6.4L296 64H152l19.2-25.6c3-4 7.8-6.4 12.8-6.4zm200 432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V96h320v368zm-176-44V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm-80 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm160 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12z"/>
</symbol>
<symbol id="svg-keyboard-down" viewBox="0 0 576 512"><path d="M64 48c-8.8 0-16 7.2-16 16V240c0 8.8 7.2 16 16 16H512c8.8 0 16-7.2 16-16V64c0-8.8-7.2-16-16-16H64zM0 64C0 28.7 28.7 0 64 0H512c35.3 0 64 28.7 64 64V240c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zM159 359c9.4-9.4 24.6-9.4 33.9 0l95 95 95-95c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L305 505c-4.5 4.5-10.6 7-17 7s-12.5-2.5-17-7L159 393c-9.4-9.4-9.4-24.6 0-33.9zm1-167c0-8.8 7.2-16 16-16H400c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V192zM120 88h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H120c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H200c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H280c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H360c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H440c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16z"/></symbol>
</svg>`;function c0(r){r.resetKeycapRegistry(),ey();const o=document.createElement("div");o.className="ML__keyboard";const u=document.createElement("div");u.className="MLK__plate",u.innerHTML=window.MathfieldElement.createHTML(da+r.normalizedLayouts.map((M,N)=>d0(r,M,N)).join(""));const d=document.createElement("div");d.className="MLK__backdrop",d.appendChild(u),o.appendChild(d),o.addEventListener("pointerdown",l1,{passive:!1});const g=o.querySelectorAll(".ML__edit-toolbar");if(g)for(const M of g)M.addEventListener("click",N=>{var I,F;let $=N.target,it="";for(;$&&!it;)it=(I=$==null?void 0:$.getAttribute("data-command"))!=null?I:"",$=(F=$==null?void 0:$.parentElement)!=null?F:null;it&&r.executeCommand(JSON.parse(it))});ca(o.querySelectorAll(".MLK__keycap, .action, .fnbutton, .bigfnbutton"));const b=o.querySelectorAll(".MLK__layer");console.assert(b.length>0,"No virtual keyboards available");for(const M of b)M.addEventListener("pointerdown",N=>N.preventDefault());return r.currentLayer=r.latentLayer,o}function d0(r,o,u){const d=[];if(!("layers"in o))return"";for(const g of o.layers)d.push(`<div tabindex="-1" class="MLK__layer" id="${g.id}">`),(r.normalizedLayouts.length>1||o.displayEditToolbar)&&(d.push("<div class='MLK__toolbar' role='toolbar'>"),d.push(Em(r,u)),o.displayEditToolbar&&d.push('<div class="ML__edit-toolbar right"></div>'),d.push("</div>")),d.push(a1(r,g)),d.push("</div>");return d.join("")}function a1(r,o){if(typeof o=="string")return o;let u="";if(typeof o.style=="string"?u+=`<style>${o.style}</style>`:typeof o.style=="object"&&(u+=`<style>${dx(o.style)}</style>`),o.backdrop&&(u+=`<div class='${o.backdrop}'>`),o.container&&(u+=`<div class='${o.container}'>`),o.rows){u+="<div class=MLK__rows>";for(const d of o.rows){u+="<div dir='ltr' class=MLK__row>";for(const g of d)if(g){const b=r.registerKeycap(g),[M,N]=sp(g);/(^|\s)separator/.test(N)?u+=`<div class="${N}"`:u+=`<div tabindex="-1" id="${b}" class="${N}"`,g.tooltip&&(u+=` data-tooltip="${g.tooltip}"`),u+=`>${M}</div>`}u+="</div>"}u+="</div>"}else o.markup&&(u+=o.markup);return o.container&&(u+="</div>"),o.backdrop&&(u+="</div>"),u}function sp(r,o={shifted:!1}){var u,d,g,b,M,N,I;let F="",$=(u=r.class)!=null?u:"";if(o.shifted&&sd(r)&&($+=" is-active"),o.shifted&&"shift"in r)typeof r.shift=="string"?F=op(r.shift):typeof r.shift=="object"&&(F=r.shift.label?r.shift.label:(d=op(r.shift.latex||r.shift.insert||"")||r.shift.key)!=null?d:""),typeof r.shift=="object"&&($=(b=(g=r.shift.class)!=null?g:r.class)!=null?b:"");else{if(F=r.label?r.label:(M=op(r.latex||r.insert||"")||r.key)!=null?M:"",r.shift){let it;typeof r.shift=="string"?it=op(r.shift):r.shift.label?it=r.shift.label:it=(N=op(r.shift.latex||r.shift.insert||"")||r.shift.key)!=null?N:"",F+=`<span class="MLK__shift">${it}</span>`}r.aside&&(F+=`<aside>${r.aside}</aside>`)}return r.layer&&!/layer-switch/.test($)&&($+=" layer-switch"),/(^|\s)(separator|action|shift|fnbutton|bigfnbutton)($|\s)/.test($)||($+=" MLK__keycap"),!/\bw[0-9]+\b/.test($)&&r.width&&($+=(I={0:" w0",.5:" w5",1.5:" w15",2:" w20",5:" w50"}[r.width])!=null?I:""),[F,$||"MLK__keycap"]}var ap={"[left]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-left /></svg>",command:["performWithFeedback","moveToPreviousChar"],shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-left /></svg>",command:["performWithFeedback","extendSelectionBackward"]}},"[right]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-right /></svg>",command:["performWithFeedback","moveToNextChar"],shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-right /></svg>",command:["performWithFeedback","extendSelectionForward"]}},"[up]":{class:"action hide-shift",label:"\u2191",command:["performWithFeedback","moveUp"],shift:{label:"\u219F",command:["performWithFeedback","extendSelectionUpward"]}},"[down]":{class:"action hide-shift",label:"\u2193",command:["performWithFeedback","moveDown"],shift:{label:"\u21A1",command:["performWithFeedback","extendSelectionDownward"]}},"[return]":{class:"action hide-shift",command:["performWithFeedback","commit"],shift:{command:["performWithFeedback","addRowAfter"]},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[action]":{class:"action hide-shift",command:["performWithFeedback","commit"],shift:{label:"<svg class=svg-glyph><use xlink:href=#circle-plus /></svg>",command:["performWithFeedback","addRowAfter"]},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[hr]":{class:"separator horizontal-rule"},"[hide-keyboard]":{class:"action",command:["hideVirtualKeyboard"],width:1.5,label:"<svg class=svg-glyph-lg><use xlink:href=#svg-keyboard-down /></svg>"},"[.]":{variants:".",command:["performWithFeedback","insertDecimalSeparator"],shift:",",class:"big-op hide-shift",label:"."},"[,]":{variants:",",command:["performWithFeedback","insertDecimalSeparator"],shift:".",class:"big-op hide-shift",label:","},"[+]":{variants:[{latex:"\\sum_{#0}^{#0}",class:"small"},"\\oplus"],latex:"+",label:"+",class:"big-op hide-shift",shift:{latex:"\\sum",insert:"\\sum",class:"small"}},"[-]":{variants:["\\pm","\\ominus"],latex:"-",label:"&#x2212;",shift:"\\pm",class:"big-op hide-shift"},"[/]":{class:"big-op hide-shift",shift:{class:"",latex:"\\frac{1}{#@}"},variants:["/","\\div","\\%","\\oslash"],latex:"\\frac{#@}{#?}",label:"&divide;"},"[*]":{variants:[{latex:"\\prod_{#0}^{#0}",class:"small"},"\\otimes","\\cdot"],latex:"\\cdot",label:"&times;",shift:{latex:"\\times"},class:"big-op hide-shift"},"[=]":{variants:["\\neq","\\equiv","\\varpropto","\\thickapprox","\\lt","\\gt","\\le","\\ge"],latex:"=",label:"=",shift:{label:"\u2260",latex:"\\ne"},class:"big-op hide-shift"},"[backspace]":{class:"action bottom right hide-shift",width:1.5,command:["performWithFeedback","deleteBackward"],label:"<svg class=svg-glyph><use xlink:href=#svg-delete-backward /></svg>",shift:{class:"action warning",label:"<svg class=svg-glyph><use xlink:href=#svg-trash /></svg>",command:"deleteAll"}},"[undo]":{class:"ghost if-can-undo",command:"undo",label:"<svg class=svg-glyph><use xlink:href=#svg-undo /></svg>",tooltip:"tooltip.undo"},"[redo]":{class:"ghost if-can-redo",command:"redo",label:"<svg class=svg-glyph><use xlink:href=#svg-redo /></svg>",tooltip:"tooltip.redo"},"[(]":{variants:[{latex:"\\lbrack",key:"["},"\\langle","\\lfloor","\\lceil",{latex:"\\lbrace",key:"{"}],key:"(",label:"(",shift:{label:"[",key:"["},class:"hide-shift"},"[)]":{variants:[{latex:"\\rbrack",key:"]"},"\\rangle","\\rfloor","\\rceil",{latex:"\\rbrace",key:"]"}],key:")",label:")",shift:{label:"]",latex:"\\rbrack"},class:"hide-shift"},"[0]":{variants:"0",latex:"0",label:"0",shift:"\\infty",class:"hide-shift"},"[1]":{variants:"1",latex:"1",label:"1",shift:"#@^{-1}",class:"hide-shift"},"[2]":{variants:"2",latex:"2",label:"2",shift:"#@^2",class:"hide-shift"},"[3]":{variants:"3",latex:"3",label:"3",shift:"#@^3",class:"hide-shift"},"[4]":{variants:"4",latex:"4",label:"4",shift:"#@^4",class:"hide-shift"},"[5]":{variants:"5",latex:"5",label:"5",shift:"#@^5",class:"hide-shift"},"[6]":{variants:"6",latex:"6",label:"6",shift:"#@^6",class:"hide-shift"},"[7]":{variants:"7",latex:"7",label:"7",shift:"#@^7",class:"hide-shift"},"[8]":{variants:"8",latex:"8",label:"8",shift:"#@^8",class:"hide-shift"},"[9]":{variants:"9",latex:"9",label:"9",shift:"#@^9",class:"hide-shift"},"[separator-5]":{class:"separator",width:.5},"[separator]":{class:"separator"},"[separator-10]":{class:"separator"},"[separator-15]":{class:"separator",width:1.5},"[separator-20]":{class:"separator",width:2},"[separator-50]":{class:"separator",width:5},"[shift]":{class:"shift bottom left",width:1.5,label:"<span class=caps-lock-indicator></span><svg class=svg-glyph><use xlink:href=#svg-shift /></svg>"},"[foreground-color]":{variants:"foreground-color",command:["applyStyle",{color:"red"}],label:"<span style='border-radius: 50%;width:22px;height:22px; border: 3px solid #cc2428; box-sizing: border-box'>"},"[background-color]":{variants:"background-color",command:["applyStyle",{backgroundColor:"yellow"}],label:"<span style='border-radius: 50%;width:22px;height:22px; background:#fff590; box-sizing: border-box'></span>"}};function iy(r){var o;if(typeof r=="string"){if(r==="[.]"&&window.MathfieldElement.decimalSeparator===","&&(r="[,]"),!ap[r])return{latex:r};r={label:r}}let u;return"label"in r&&r.label&&ap[r.label]&&(u=rt(Q(Q({},ap[r.label]),r),{label:ap[r.label].label})),"key"in r&&r.key&&ap[r.key]&&(u=rt(Q(Q({},ap[r.key]),r),{key:ap[r.key].key})),u?(u.command==="insertDecimalSeparator"&&(u.label=(o=window.MathfieldElement.decimalSeparator)!=null?o:"."),r.label==="[action]"&&(u=Q(Q({},u),window.mathVirtualKeyboard.actionKeycap)),r.label==="[shift]"&&(u=Q(Q({},u),window.mathVirtualKeyboard.shiftKeycap)),r.label==="[backspace]"&&(u=Q(Q({},u),window.mathVirtualKeyboard.backspaceKeycap)),r.label==="[tab]"&&(u=Q(Q({},u),window.mathVirtualKeyboard.tabKeycap)),u):r}var f0;function l1(r){var o;if(r.button!==0)return;const u=tf.singleton;if(!u)return;let d=r.target;for(;d&&!d.getAttribute("data-layer");)d=d.parentElement;if(d){u.currentLayer=(o=d.getAttribute("data-layer"))!=null?o:"",r.preventDefault();return}const g=Zl(r.target);if(!(g!=null&&g.id))return;const b=u.getKeycap(g.id);if(!b)return;console.assert(r.type==="pointerdown");const M=new AbortController,N=M.signal;g.classList.add("is-pressed"),g.addEventListener("pointerenter",od(M),{capture:!0,signal:N}),g.addEventListener("pointerleave",od(M),{capture:!0,signal:N}),g.addEventListener("pointercancel",od(M),{signal:N}),g.addEventListener("pointerup",od(M),{signal:N}),sd(b)&&(g.classList.add("is-active"),u.shiftPressCount++),b.variants&&(f0&&clearTimeout(f0),f0=setTimeout(()=>{g.classList.contains("is-pressed")&&(g.classList.remove("is-pressed"),g.classList.add("is-active"),r.target&&"releasePointerCapture"in r.target&&r.target.releasePointerCapture(r.pointerId),Hg(g,()=>{M.abort(),g==null||g.classList.remove("is-active")}))},300)),r.preventDefault()}function od(r){return o=>{const u=Zl(o.target);if(!(u!=null&&u.id))return;const d=tf.singleton;if(!d)return;const g=d.getKeycap(u.id);if(g){if(o.type==="pointerenter"&&o.target===u&&o.isPrimary&&u.classList.add("is-pressed"),o.type==="pointercancel"){u.classList.remove("is-pressed"),sd(g)&&(d.shiftPressCount--,u.classList.toggle("is-active",d.isShifted)),r.abort();return}if(o.type==="pointerleave"&&o.target===u){u.classList.remove("is-pressed"),sd(g)&&(d.shiftPressCount--,u.classList.toggle("is-active",d.isShifted));return}if(o.type==="pointerup"){f0&&clearTimeout(f0),sd(g)?u.classList.toggle("is-active",d.isShifted):u.classList.contains("is-pressed")&&(u.classList.remove("is-pressed"),d.isShifted&&g.shift?typeof g.shift=="string"?d.executeCommand(["insert",g.shift,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]):Qd(g.shift):Qd(g),d.shiftPressCount===1&&!o.shiftKey&&(d.shiftPressCount=0)),r.abort(),o.preventDefault();return}}}}function Qd(r){var o;let u=r.command;!u&&r.insert&&(u=["insert",r.insert,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),!u&&r.key&&(u=["typedText",r.key,{focus:!0,feedback:!0,simulateKeystroke:!0}]),!u&&r.latex&&(u=["insert",r.latex,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),u||(u=["typedText",r.label,{focus:!0,feedback:!0,simulateKeystroke:!0}]),(o=tf.singleton)==null||o.executeCommand(u)}function fx(r){if(r.nodeType!==1)return!1;const o=r.classList;return o.contains("MLK__keycap")||o.contains("shift")||o.contains("action")||o.contains("fnbutton")||o.contains("bigfnbutton")}function Zl(r){if(!r)return;let o=r;for(;o&&!fx(o);)o=o.parentElement;return o!=null?o:void 0}function sd(r){return!!r.class&&/(^|\s)shift($|\s)/.test(r.class)}var tf=class F2{constructor(){this.originalContainerBottomPadding=null,this.keycapRegistry={},this._shiftPressCount=0;var o,u,d;this.targetOrigin=window.origin,this.originValidator="none",this._alphabeticLayout="auto",this._layouts=Object.freeze(["default"]),this._editToolbar="default",this._container=(u=(o=window.document)==null?void 0:o.body)!=null?u:null,this._visible=!1,this._rebuilding=!1,this.observer=new ResizeObserver(g=>{this.adjustBoundingRect(),this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect})}),this.listeners={};try{(d=window.top)==null||d.addEventListener("message",this)}catch(g){window.addEventListener("message",this)}document.body.addEventListener("focusin",g=>{const b=g.target;b!=null&&b.isConnected&&setTimeout(()=>{const M=ny();M&&!M.readOnly&&M.mathVirtualKeyboardPolicy==="auto"&&jt()&&this.show({animate:!0})},300)}),document.addEventListener("focusout",g=>{g.target.mathVirtualKeyboardPolicy!=="manual"&&setTimeout(()=>{ny()||this.hide()},300)})}get currentLayer(){var o,u,d;return(d=(u=(o=this._element)==null?void 0:o.querySelector(".MLK__layer.is-visible"))==null?void 0:u.id)!=null?d:""}set currentLayer(o){var u;if(!this._element){this.latentLayer=o;return}let d=o?this._element.querySelector(`#${o}.MLK__layer`):null;d||(d=this._element.querySelector(".MLK__layer")),d&&((u=this._element.querySelector(".MLK__layer.is-visible"))==null||u.classList.remove("is-visible"),d.classList.add("is-visible")),this.render()}get shiftPressCount(){return this._shiftPressCount}set shiftPressCount(o){var u;this._shiftPressCount=o>2||o<0?0:o,(u=this._element)==null||u.classList.toggle("is-caps-lock",this.shiftPressCount===2),this.render()}get isShifted(){return this._shiftPressCount>0}resetKeycapRegistry(){this.keycapRegistry={}}registerKeycap(o){const u="ML__k"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36);return this.keycapRegistry[u]=o,u}getKeycap(o){return o?this.keycapRegistry[o]:void 0}getLayer(o){const u=this.normalizedLayouts;for(const d of u)for(const g of d.layers)if(g.id===o)return g}get alphabeticLayout(){return this._alphabeticLayout}set alphabeticLayout(o){this._alphabeticLayout=o,this.rebuild()}get actionKeycap(){return this._actionKeycap}set actionKeycap(o){this._actionKeycap=typeof o=="string"?{label:o}:o}get shiftKeycap(){return this._shiftKeycap}set shiftKeycap(o){this._shiftKeycap=typeof o=="string"?{label:o}:o}get backspaceKeycap(){return this._backspaceKeycap}set backspaceKeycap(o){this._backspaceKeycap=typeof o=="string"?{label:o}:o}get tabKeycap(){return this._tabKeycap}set tabKeycap(o){this._tabKeycap=typeof o=="string"?{label:o}:o}get layouts(){return this._layouts}set layouts(o){this.updateNormalizedLayouts(o),this.rebuild()}updateNormalizedLayouts(o){const u=Array.isArray(o)?[...o]:[o],d=u.findIndex(g=>g==="default");d>=0&&u.splice(d,1,"numeric","symbols","alphabetic","greek"),this._layouts=Object.freeze(u),this._normalizedLayouts=u.map(g=>Wg(g))}get normalizedLayouts(){return this._normalizedLayouts||this.updateNormalizedLayouts(this._layouts),this._normalizedLayouts}get editToolbar(){return this._editToolbar}set editToolbar(o){this._editToolbar=o,this.rebuild()}get container(){return this._container}set container(o){this._container=o,this.rebuild()}static get singleton(){if(this._singleton===void 0)try{this._singleton=new F2}catch(o){this._singleton=null}return this._singleton}get style(){return this._style}addEventListener(o,u,d){this.listeners[o]||(this.listeners[o]=new Set),this.listeners[o].has(u)||this.listeners[o].add(u)}dispatchEvent(o){return!this.listeners[o.type]||this.listeners[o.type].size===0?!0:(this.listeners[o.type].forEach(u=>{typeof u=="function"?u(o):u==null||u.handleEvent(o)}),!o.defaultPrevented)}removeEventListener(o,u,d){this.listeners[o]&&this.listeners[o].delete(u)}get element(){return this._element}set element(o){var u;this._element!==o&&((u=this._element)==null||u.remove(),this._element=o)}get visible(){return this._visible}set visible(o){o?this.show():this.hide()}get boundingRect(){var o;if(!this._visible)return new DOMRect;const u=(o=this._element)==null?void 0:o.getElementsByClassName("MLK__plate")[0];return u?u.getBoundingClientRect():new DOMRect}adjustBoundingRect(){var o,u;const d=this.boundingRect.height;if(this.container===document.body){(o=this._element)==null||o.style.setProperty("--_keyboard-height",`calc(${d}px + var(--_padding-top) + var(--_padding-bottom) + env(safe-area-inset-bottom, 0))`);const g=d-1;this.container.style.paddingBottom=this.originalContainerBottomPadding?`calc(${this.originalContainerBottomPadding} + ${g}px)`:`${g}px`}else(u=this._element)==null||u.style.setProperty("--_keyboard-height",`${d}px`)}rebuild(){if(this._rebuilding||!this._element)return;this._rebuilding=!0;const o=this.currentLayer;requestAnimationFrame(()=>{this._rebuilding=!1,this._element&&(this._element.remove(),this._element=void 0),this.visible&&(this.buildAndAttachElement(),this.currentLayer=o,this.render(),this.adjustBoundingRect(),this._element.classList.add("is-visible"))})}render(){if(!this._element)return;const o=this.getLayer(this.currentLayer);this._element.classList.toggle("backdrop-is-transparent",!!(o&&(o.backdrop||o.container)));const u=this._element.querySelectorAll(".MLK__layer.is-visible .MLK__keycap, .MLK__layer.is-visible .action, .fnbutton, .MLK__layer.is-visible .bigfnbutton, .MLK__layer.is-visible .shift");if(u)for(const d of u){const g=this.getKeycap(d.id);if(g){const[b,M]=sp(g,{shifted:this.isShifted});d.innerHTML=window.MathfieldElement.createHTML(b),d.className=M}}}show(o){var u;if(this._visible)return;const d=this.container;if(d&&window.mathVirtualKeyboard&&this.stateWillChange(!0)){if(this._element||(this.buildAndAttachElement(),this.adjustBoundingRect()),!this._visible){const g=this._element.getElementsByClassName("MLK__plate")[0];if(g&&this.observer.observe(g),d===window.document.body){const b=d.style.paddingBottom;this.originalContainerBottomPadding=b;const M=g.offsetHeight-1;d.style.paddingBottom=b?`calc(${b} + ${M}px)`:`${M}px`}window.addEventListener("mouseup",this),window.addEventListener("blur",this),window.addEventListener("keydown",this,{capture:!0}),window.addEventListener("keyup",this,{capture:!0}),(u=this._element)==null||u.classList.toggle("is-caps-lock",this.shiftPressCount===2),this.currentLayer=this.latentLayer}this._visible=!0,o!=null&&o.animate?requestAnimationFrame(()=>{this._element&&(this._element.classList.add("animate"),this._element.addEventListener("transitionend",()=>{var g;return(g=this._element)==null?void 0:g.classList.remove("animate")},{once:!0}),this._element.classList.add("is-visible"),this.stateChanged())}):(this._element.classList.add("is-visible"),this.stateChanged())}}hide(o){var u;const d=this.container;if(d&&this._visible&&this.stateWillChange(!1)){if(this._visible=!1,this._element){this.latentLayer=this.currentLayer;const g=this._element.getElementsByClassName("MLK__plate")[0];g&&this.observer.unobserve(g),window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("keydown",this,{capture:!0}),window.removeEventListener("keyup",this,{capture:!0}),window.removeEventListener("contextmenu",this,{capture:!0}),u0(),hh(),(u=this._element)==null||u.remove(),this._element=void 0,this.originalContainerBottomPadding!==null&&(d.style.paddingBottom=this.originalContainerBottomPadding)}this.stateChanged()}}get height(){var o,u;return(u=(o=this.element)==null?void 0:o.offsetHeight)!=null?u:0}buildAndAttachElement(){var o;console.assert(!this.element),this.element=c0(this),window.addEventListener("contextmenu",this,{capture:!0}),this.element.addEventListener("contextmenu",u=>{u.shiftKey||((u.ctrlKey||u.button===2)&&Hg(u.target),u.preventDefault(),u.stopPropagation())},{capture:!0}),(o=this.container)==null||o.appendChild(this.element)}handleEvent(o){if($g(o)){if(!ah(o.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${o.origin}) cannot be handled`,"SecurityError");o.data.action==="disconnect"?this.connectedMathfieldWindow=void 0:o.data.action!=="update-setting"&&o.data.action!=="proxy-created"&&o.data.action!=="execute-command"&&(console.assert(o.source!==void 0),this.connectedMathfieldWindow=o.source),this.handleMessage(o.data,o.source)}if(this._element)switch(o.type){case"mouseup":case"blur":document.body.style.userSelect="",this.shiftPressCount=0;break;case"contextmenu":o.button!==2&&o.preventDefault();break;case"keydown":{o.key==="Shift"&&!o.repeat&&(this.shiftPressCount=1);break}case"keyup":{(o.key==="Shift"||!o.getModifierState("Shift")&&this.shiftPressCount!==2)&&(this.shiftPressCount=0);break}}}handleMessage(o,u){const{action:d}=o;if(d==="execute-command"){const{command:g}=o,b=Sc(g);if(window.top!==void 0&&b!=="virtual-keyboard")return;this.executeCommand(g);return}if((d==="connect"||d==="show")&&this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},u),d!=="disconnect"&&window===window.top){if(d==="show"){typeof o.animate!="undefined"?this.show({animate:o.animate}):this.show();return}if(d==="hide"){typeof o.animate!="undefined"?this.hide({animate:o.animate}):this.hide();return}if(d==="update-setting"){o.alphabeticLayout&&(this.alphabeticLayout=o.alphabeticLayout),o.layouts&&(this.layouts=o.layouts),o.editToolbar&&(this.editToolbar=o.editToolbar);return}if(d==="proxy-created"){this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},u);return}}}sendMessage(o,u,d){if(d||(d=this.connectedMathfieldWindow),this.targetOrigin===null||this.targetOrigin==="null"||d===window){window.dispatchEvent(new MessageEvent("message",{source:window,data:Q({type:Mm,action:o},u)}));return}if(d)d.postMessage(Q({type:Mm,action:o},u),{targetOrigin:this.targetOrigin});else if(u.command&&this.dispatchEvent(new CustomEvent("math-virtual-keyboard-command",{detail:u.command})),o==="execute-command"&&Array.isArray(u.command)&&u.command[0]==="insert"){const g=u.command[1].split("");for(const b of g)this.dispatchEvent(new KeyboardEvent("keydown",{key:b,bubbles:!0})),this.dispatchEvent(new KeyboardEvent("keyup",{key:b,bubbles:!0}))}}stateWillChange(o){return this.dispatchEvent(new CustomEvent("before-virtual-keyboard-toggle",{detail:{visible:o},bubbles:!0,cancelable:!0,composed:!0}))}stateChanged(){this.dispatchEvent(new Event("virtual-keyboard-toggle")),this._visible||(this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect}))}focus(){this.sendMessage("focus",{})}blur(){this.sendMessage("blur",{})}updateToolbar(o){const u=this._element;if(!u)return;u.classList.toggle("is-math-mode",o.mode==="math"),u.classList.toggle("is-text-mode",o.mode==="text"),u.classList.toggle("can-undo",o.canUndo),u.classList.toggle("can-redo",o.canRedo),u.classList.toggle("can-copy",!o.selectionIsCollapsed),u.classList.toggle("can-copy",!o.selectionIsCollapsed),u.classList.toggle("can-paste",!0);const d=u.querySelectorAll(".ML__edit-toolbar");if(d)for(const g of d)g.innerHTML=s1(this,o)}update(o){this._style=o.style,this.updateToolbar(o)}connect(){this.connectedMathfieldWindow=window}disconnect(){this.connectedMathfieldWindow=void 0}executeCommand(o){let u,d=[],g=Sc(o);return pt(o)?(u=o[0],u==="performWithFeedback"&&(o=o.slice(1),g=Sc(o)),d=o.slice(1)):u=o,u=u.replace(/-\w/g,b=>b[1].toUpperCase()),g==="virtual-keyboard"?Wn[u].fn(void 0,...d):(this.sendMessage("execute-command",{command:o}),!1)}dispose(){window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("message",this)}};function ny(){var r,o;let u=Hh(),d=null;for(;u;){if("host"in u&&((o=(r=u.host)==null?void 0:r.tagName)==null?void 0:o.toLowerCase())==="math-field"){d=u.host;break}u=u.parentNode}return d}if(Ce()&&!("mathVirtualKeyboard"in window))if(window===window.top){const r=tf.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>r})}else Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>Kg.singleton,configurable:!0});function lp(r){const o={};for(const u of Object.keys(r))switch(u){case"scriptDepth":const d=r.scriptDepth;if(pt(d))o.scriptDepth=[d[0],d[1]];else if(typeof d=="number")o.scriptDepth=[d,d];else if(typeof d=="string"){const[b,M]=d.split(",").map(N=>parseInt(N.trim()));o.scriptDepth=[b,M]}else throw new TypeError("Unexpected value for scriptDepth");break;case"mathVirtualKeyboardPolicy":let g=r.mathVirtualKeyboardPolicy.toLowerCase();if(g==="sandboxed"){if(window!==window.top){const b=tf.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>b})}g="manual"}o.mathVirtualKeyboardPolicy=g;break;case"letterShapeStyle":r.letterShapeStyle==="auto"?$t.locale.startsWith("fr")?o.letterShapeStyle="french":o.letterShapeStyle="tex":o.letterShapeStyle=r.letterShapeStyle;break;case"defaultMode":["text","math","inline-math"].includes(r.defaultMode)?o.defaultMode=r.defaultMode:(console.error('MathLive 0.98.5: valid values for defaultMode are "text", "math" or "inline-math"'),o.defaultMode="math");break;case"macros":o.macros=oe(r.macros);break;default:pt(r[u])?o[u]=[...r[u]]:typeof r[u]=="object"&&!(r[u]instanceof Element)&&u!=="computeEngine"?o[u]=Q({},r[u]):o[u]=r[u]}return o}function Uo(r,o){let u;typeof o=="string"?u=[o]:o===void 0?u=Object.keys(r):u=o;const d={};for(const g of u)r[g]===null?d[g]=null:pt(r[g])?d[g]=[...r[g]]:typeof r[g]=="object"&&!(r[g]instanceof Element)&&g!=="computeEngine"?d[g]=Q({},r[g]):d[g]=r[g];return typeof o=="string"?d[o]:d}function p0(){return{readOnly:!1,defaultMode:"math",macros:{},registers:{},colorMap:We,backgroundColorMap:ee,letterShapeStyle:$t.locale.startsWith("fr")?"french":"tex",minFontScale:0,smartMode:!1,smartFence:!0,smartSuperscript:!0,scriptDepth:[1/0,1/0],removeExtraneousParentheses:!0,isImplicitFunction:r=>["\\sin","\\cos","\\tan","\\arcsin","\\arccos","\\arctan","\\arcsec","\\arccsc","\\arsinh","\\arcosh","\\artanh","\\arcsech","\\arccsch","\\arg","\\ch","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\sec","\\sinh","\\sh","\\tanh","\\tg","\\th","\\lg","\\lb","\\log","\\ln"].includes(r),mathModeSpace:"",placeholderSymbol:"\u25A2",contentPlaceholder:"",popoverPolicy:"auto",environmentPopoverPolicy:"off",keybindings:Fd,inlineShortcuts:om,inlineShortcutTimeout:0,mathVirtualKeyboardPolicy:"auto",virtualKeyboardTargetOrigin:window==null?void 0:window.origin,originValidator:"none",onInlineShortcut:()=>"",onScrollIntoView:null,onExport:Vp,value:""}}function ui(r){return r.defaultMode==="inline-math"?"math":r.defaultMode}function us(r,o){!r||!o||(pt(r)?r.forEach(u=>us(u,o)):typeof r=="object"&&!r.style.color&&!r.style.backgroundColor&&!r.style.fontFamily&&!r.style.fontShape&&!r.style.fontSeries&&!r.style.fontSize&&!r.style.variant&&!r.style.variantStyle&&(r.applyStyle(o),us(r.body,o),us(r.above,o),us(r.below,o),us(r.subscript,o),us(r.superscript,o)))}function _m(r,o,u,d){function g(M,N){for(const I of b)if(I.style[M]!==N)return!1;return!0}if(o=r.normalizeRange(o),o[0]===o[1])return!1;const b=r.getAtoms(o,{includeChildren:!0});d.operation==="toggle"&&(u.color&&g("color",u.color)&&(u.color="none",delete u.verbatimColor),u.backgroundColor&&g("backgroundColor",u.backgroundColor)&&(u.backgroundColor="none",delete u.verbatimBackgroundColor),u.fontFamily&&g("fontFamily",u.fontFamily)&&(u.fontFamily="none"),u.fontSeries&&g("fontSeries",u.fontSeries)&&(u.fontSeries="auto"),u.fontShape&&g("fontShape",u.fontShape)&&(u.fontShape="auto"),u.fontSize&&g("fontSize",u.fontSize)&&(u.fontSize=qu),u.variant&&g("variant",u.variant)&&(u.variant="normal"),u.variantStyle&&g("variantStyle",u.variantStyle)&&(u.variantStyle=""));for(const M of b)M.applyStyle(u);return!0}function px(r,o){const u=r.at(r.position);if(u.type==="composition")u.value=o;else{const{caret:d}=u;u.caret=void 0;const g=new Qs(o,{mode:u.mode});g.caret=d,u.parent.addChildAfter(g,u),r.position+=1}}function Zg(r){const o=r.at(r.position);o.type==="composition"&&(o.parent.removeChild(o),r.position-=1)}Ei(["math","displaymath"],Tu),Ei("center",Tu),qt("displaylines","",{parse:r=>{const o=[];let u=[];r.beginContext({tabular:!0});do{if(r.end()||r.match("<}>"))break;r.matchColumnSeparator()||r.matchRowSeparator()?(o.push([u]),u=[]):u.push(...r.scan(d=>["<}>","&","\\cr","\\\\","\\tabularnewline"].includes(d)))}while(!0);return r.endContext(),o.push([u]),o},createAtom:r=>new rr("lines",r.args,[],{leftDelim:".",rightDelim:".",columns:[{align:"l"}]})}),Ci("array","{columns:colspec}",(r,o,u,d)=>new rr(r,ch(o),u,{columns:d[0],mathstyleName:"textstyle"})),Ci(["equation","equation*","subequations"],"",(r,o,u)=>new rr(r,ch(o),u,{columns:[{align:"c"}]})),Ci(["multline","multline*"],"",Tu),Ci(["align","align*","aligned","eqnarray"],"",Tu),Ci("split","",Tu),Ci(["gather","gathered"],"",Tu),Ci(["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],"[columns:colspec]",Tu),Ci(["smallmatrix","smallmatrix*"],"[columns:colspec]",Tu),Ci(["cases","dcases","rcases"],"",Tu);function u1(r){for(const o of r)for(const u of o)if(u.length>0)return!1;return!0}function ch(r,o=1){return u1(r)?Array(o).fill([[new oi({type:"first"}),new Dn]]):r.map(u=>u.length===0?[[new oi({type:"first"})]]:u.map(d=>d.length===0?[new oi({type:"first"})]:(d[0].type!=="first"&&d.unshift(new oi({type:"first"})),d)))}function Tu(r,o=[[[]]],u=[],d=[]){switch(o=ch(o,["split","align","align*","aligned","eqnarray"].includes(r)?2:1),r){case"math":return new rr(r,o,u,{mathstyleName:"textstyle"});case"displaymath":return new rr(r,o,u,{mathstyleName:"textstyle"});case"center":return new rr(r,o,u,{columns:[{align:"c"}]});case"multline":case"multline*":return new rr(r,o,u,{columns:[{align:"m"}],leftDelim:".",rightDelim:"."});case"split":return new rr(r,o,u,{columns:[{align:"r"},{align:"l"}],minColumns:2});case"gather":case"gathered":return new rr(r,o,u,{columns:[{gap:.25},{align:"c"},{gap:0}]});case"pmatrix":case"pmatrix*":return new rr(r,o,u,{mathstyleName:"textstyle",leftDelim:"(",rightDelim:")",columns:hu(d[0])});case"bmatrix":case"bmatrix*":return new rr(r,o,u,{mathstyleName:"textstyle",leftDelim:"[",rightDelim:"]",columns:hu(d[0])});case"Bmatrix":case"Bmatrix*":return new rr(r,o,u,{mathstyleName:"textstyle",leftDelim:"\\lbrace",rightDelim:"\\rbrace",columns:hu(d[0])});case"vmatrix":case"vmatrix*":return new rr(r,o,u,{mathstyleName:"textstyle",leftDelim:"\\vert",rightDelim:"\\vert",columns:hu(d[0])});case"Vmatrix":case"Vmatrix*":return new rr(r,o,u,{mathstyleName:"textstyle",leftDelim:"\\Vert",rightDelim:"\\Vert",columns:hu(d[0])});case"matrix":case"matrix*":return new rr(r,o,u,{mathstyleName:"textstyle",leftDelim:".",rightDelim:".",columns:hu(d==null?void 0:d[0])});case"smallmatrix":case"smallmatrix*":return new rr(r,o,u,{mathstyleName:"scriptstyle",columns:hu(d==null?void 0:d[0]),colSeparationType:"small",arraystretch:.5});case"cases":case"dcases":return new rr(r,o,u,{mathstyleName:r==="dcases"?"displaystyle":"textstyle",arraystretch:1.2,leftDelim:"\\lbrace",rightDelim:".",columns:[{align:"l"},{gap:1},{align:"l"}]});case"rcases":return new rr(r,o,u,{arraystretch:1.2,leftDelim:".",rightDelim:"\\rbrace",columns:[{align:"l"},{gap:1},{align:"l"}]});case"lines":return new rr(r,o,u,{leftDelim:".",rightDelim:".",columns:[{align:"l"}]});case"align":case"align*":case"aligned":case"eqnarray":{let g=0;for(const N of o)g=Math.max(g,N.length);const b=[{gap:0},{align:"r"},{gap:.25},{align:"l"}];let M=2;for(;M<g;)b.push({gap:1},{align:"r"},{gap:.25},{align:"l"}),M+=2;return b.push({gap:0}),new rr(r,o,u,{arraycolsep:0,columns:b,minColumns:2})}}return new rr(r,o,u,{mathstyleName:"textstyle"})}function hu(r){return r!=null?r:[{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"}]}function h1(r,o){let u=r.at(r.position);for(;u&&!(u.parent instanceof rr);)u=u.parent;if(u&&u.type==="array"&&u.environmentName,!u||!(u.parent instanceof rr)){const d=r.at(r.position);if(u=d,!u.parent.parent){let g=r.extractAtoms([r.position,r.lastOffset]),b=r.extractAtoms([0,r.position]);b.length===0&&(b=Nm()),g.length===0&&(g=Nm());let M;return o.endsWith("column")?(M=Tu("split",[[b,g]]),r.root=M,ef(M,0,0)?nf(r,M,0,0):ef(M,0,1)?nf(r,M,0,1):r.position=r.offsetOf(d)):(M=Tu("lines",[[b],[g]]),r.root=M,ef(M,0,0)?nf(r,M,0,0):ef(M,1,0)?nf(r,M,1,0):r.position=r.offsetOf(d)),[void 0,[0,0]]}if(u.parent instanceof Kr){const g=u.parent;let b=r.extractAtoms([r.position,r.offsetOf(g.lastChild)]),M=r.extractAtoms([r.offsetOf(g.firstChild),r.position]);M.length===0&&(M=Nm()),b.length===0&&(b=Nm());let N="pmatrix";const I=g.leftDelim,F=g.rightDelim;I==="("&&(F===")"||F==="?")?N="pmatrix":(I==="["||I==="\\lbrack")&&(F==="]"||F==="\\rbrack"||F==="?")?N="bmatrix":I==="\\vert"&&F==="\\vert"?N="vmatrix":I==="\\Vert"&&F==="\\Vert"?N="Vmatrix":(I==="{"||I==="\\lbrace")&&(F==="."||F==="?")&&(N="cases");const $=Tu(N,o.endsWith("column")?[[M,b]]:[[M],[b]]);return g.parent.addChildBefore($,g),g.parent.removeChild(g),ef($,0,0)?nf(r,$,0,0):o.endsWith("column")?ef($,0,1)?nf(r,$,0,1):r.position=r.offsetOf(u):ef($,1,0)?nf(r,$,1,0):r.position=r.offsetOf(u),[void 0,[0,0]]}}return u&&u.parent instanceof rr?[u.parent,u.parentBranch]:[void 0,[0,0]]}function ef(r,o,u){const d=r.getCell(o,u);return!d||d.length!==2?!1:d[1].type==="placeholder"}function c1(r,o,u,d){const g=o.getCell(u,d);return g?[r.offsetOf(g[0]),r.offsetOf(g[g.length-1])]:-1}function nf(r,o,u,d){const g=c1(r,o,u,d);typeof g!="number"&&r.setSelection(g)}function Tm(r,o,u,d,g){const b=o.getCell(u,d);b&&r.setPositionHandlingPlaceholder(r.offsetOf(b[g==="start"?0:b.length-1]))}function m0(r,o){const[u,[d,g]]=h1(r,o);if(u)switch(o){case"after row":u.addRowAfter(d),Tm(r,u,d+1,0,"end");break;case"after column":if(u.maxColumns<=u.colCount){r.announce("plonk");return}u.addColumnAfter(g),Tm(r,u,d,g+1,"end");break;case"before row":u.addRowBefore(d),Tm(r,u,d,0,"start");break;case"before column":if(u.maxColumns<=u.colCount){r.announce("plonk");return}u.addColumnBefore(g),Tm(r,u,d,g,"start");break}}function Mc(r){return r.contentWillChange({inputType:"insertText"})?(m0(r,"after row"),r.contentDidChange({inputType:"insertText"}),!0):!1}function ry(r){return r.contentWillChange({inputType:"insertText"})?(m0(r,"before row"),r.contentDidChange({inputType:"insertText"}),!0):!1}function Gg(r){return r.contentWillChange({inputType:"insertText"})?(m0(r,"after column"),r.contentDidChange({inputType:"insertText"}),!0):!1}function ad(r){return r.contentWillChange({inputType:"insertText"})?(m0(r,"before column"),r.contentDidChange({inputType:"insertText"}),!0):!1}function Pm(r,o){if(!r.contentWillChange({}))return!1;r.mathfield.snapshot();let u=".",d=".";switch(o){case"pmatrix":case"pmatrix*":u="(",d=")";break;case"bmatrix":case"bmatrix*":u="[",d="]";break;case"Bmatrix":case"Bmatrix*":u="\\lbrace",d="\\rbrace";break;case"vmatrix":case"vmatrix*":u="\\vert",d="\\vert";break;case"Vmatrix":case"Vmatrix*":u="\\Vert",d="\\Vert";break;case"matrix":case"matrix*":u=".",d=".";break;case"cases":case"dcases":u="\\lbrace";break;case"rcases":d="\\rbrace";break}const g=r.at(r.position),b=g.type==="array"?g:r.parentEnvironment;return b.environmentName=o,b.leftDelim=u,b.rightDelim=d,r.contentDidChange({}),!0}function Xg(r,o){let u=r.at(r.position);for(;u&&!(Array.isArray(u.parentBranch)&&u.parent instanceof rr);)u=u.parent;if(Array.isArray(u==null?void 0:u.parentBranch)&&(u==null?void 0:u.parent)instanceof rr){const d=u.parent,g=u.parentBranch;let b;switch(o){case"row":if(d.rowCount>1){d.removeRow(g[0]);const M=d.getCell(Math.max(0,g[0]-1),g[1]);b=r.offsetOf(M[M.length-1])}break;case"column":if(d.colCount>d.minColumns){d.removeColumn(g[1]);const M=d.getCell(g[0],Math.max(0,g[1]-1));b=r.offsetOf(M[M.length-1])}break}b&&r.setPositionHandlingPlaceholder(b)}}function d1(r){return r.contentWillChange({inputType:"deleteContent"})?(Xg(r,"row"),r.contentDidChange({inputType:"deleteContent"}),!0):!1}function oy(r){return r.contentWillChange({inputType:"deleteContent"})?(Xg(r,"column"),r.contentDidChange({inputType:"deleteContent"}),!0):!1}bs({addRowAfter:Mc,addColumnAfter:Gg,addRowBefore:ry,addColumnBefore:ad,removeRow:d1,removeColumn:oy,setEnvironment:Pm},{target:"model",canUndo:!0,changeContent:!0,changeSelection:!0});function Nm(){return[new Dn]}var Cc=class R2{constructor(o){this.recording=!1,this.model=o,this.reset()}reset(){this.stack=[],this.index=-1,this.lastOp=""}startRecording(){this.recording=!0}stopRecording(){this.recording=!1}canUndo(){return this.index-1>=0}canRedo(){return this.stack.length-1>this.index}stopCoalescing(o){o&&this.index>=0&&(this.stack[this.index].selection=o),this.lastOp=""}undo(){return this.canUndo()?(this.model.setState(this.stack[this.index-1],{silenceNotifications:!1,type:"undo"}),this.index-=1,this.lastOp="",!0):!1}redo(){return this.canRedo()?(this.index+=1,this.model.setState(this.stack[this.index],{silenceNotifications:!1,type:"redo"}),this.lastOp="",!0):!1}pop(){this.canUndo()&&(this.stack.splice(this.index,this.stack.length-this.index),this.index-=1)}snapshot(o){return this.recording?(o&&o===this.lastOp&&this.pop(),this.stack.splice(this.index+1,this.stack.length-this.index-1),this.stack.push(this.model.getState()),this.index+=1,this.stack.length>R2.maximumDepth&&(this.stack.shift(),this.index-=1),this.lastOp=o!=null?o:"",!0):!1}};Cc.maximumDepth=1e3;var f1=Cc;function Cn(r,o,u){if(r.at(o).mode!=="text")return o;const d=u==="backward"?-1:1;let g;if(U.test(r.at(o).value)){let b=o,M;do M=r.at(b).mode==="text"&&U.test(r.at(b).value),b+=d;while(r.at(b)&&M);g=r.at(b)?b-2*d:b-d}else if(/\s/.test(r.at(o).value)){let b=o;for(;r.at(b)&&r.at(b).mode==="text"&&/\s/.test(r.at(b).value);)b+=d;if(!r.at(b))g=b-d;else{let M=!0;do M=r.at(b).mode==="text"&&!/\s/.test(r.at(b).value),b+=d;while(r.at(b)&&M);g=r.at(b)?b-2*d:b-d}}else{let b=o;for(;r.at(b)&&r.at(b).mode==="text"&&!/\s/.test(r.at(b).value);)b+=d;g=r.at(b)?b:b-d;let M=!0;for(;r.at(b)&&M;)M=r.at(b).mode==="text"&&/\s/.test(r.at(b).value),M&&(g=b),b+=d;g=r.at(b)?b-2*d:b-d}return g-(d>0?0:1)}function rf(r,o,u){var d,g,b,M,N,I,F;const $=r.position;(d=u==null?void 0:u.extend)!=null&&d||r.collapseSelection(o);let it=r.at(r.position);if(o==="forward"&&(it.type==="subsup"?(it=it.rightSibling,it||(it=r.at(r.position+1))):it=r.at(r.position+1)),!it)return r.announce("plonk"),!1;let gt=r.offsetOf(it);if(it instanceof nh)gt=Cn(r,gt,o);else if(it instanceof Ea)if(it.isSuggestion)for(console.assert(o==="forward");it&&it instanceof Ea;)it.isSuggestion=!1,gt=r.offsetOf(it),it=it.rightSibling;else if(o==="forward"){if(it=it.rightSibling,!it||!(it instanceof Ea))return r.announce("plonk"),!1;for(;it&&it instanceof Ea&&/[a-zA-Z\*]/.test(it.value);)gt=r.offsetOf(it),it=it.rightSibling}else{if(it=it.leftSibling,!it||!(it instanceof Ea))return r.announce("plonk"),!1;for(;it&&it instanceof Ea&&/[a-zA-Z\*]/.test(it.value);)gt=r.offsetOf(it),it=it.leftSibling}else if(o==="forward"&&it.type==="mopen"){let _t=0;do it.type==="mopen"?_t+=1:it.type==="mclose"&&(_t-=1),it=it.rightSibling;while(!it.isLastSibling&&_t!==0);gt=r.offsetOf(it.leftSibling)}else if(o==="backward"&&it.type==="mclose"){let _t=0;do it.type==="mopen"?_t+=1:it.type==="mclose"&&(_t-=1),it=it.leftSibling;while(!it.isFirstSibling&&_t!==0);gt=r.offsetOf(it)}else if(o==="backward")if(it.type==="first")for(;gt>0&&it.type==="first";)gt-=1,it=r.at(gt);else{const _t=it.type;it.type==="subsup"&&(gt=r.offsetOf(r.at(gt).leftSibling)),gt-=1;let zt=(g=r.at(gt))==null?void 0:g.type;for(;gt>=0&&zt===_t;)((b=r.at(gt))==null?void 0:b.type)==="subsup"?gt=r.offsetOf(r.at(gt).leftSibling):gt-=1,zt=r.at(gt).type}else{const{type:_t}=it;let zt=(M=r.at(gt))==null?void 0:M.type;const{lastOffset:Ne}=r;for(;gt<=Ne&&(zt===_t||zt==="subsup");){for(;((N=r.at(gt).rightSibling)==null?void 0:N.type)==="subsup";)gt=r.offsetOf(r.at(gt).rightSibling);gt+=1,zt=(I=r.at(gt))==null?void 0:I.type}gt-=1}if((F=u==null?void 0:u.extend)!=null&&F){if(!r.setSelection(r.anchor,gt))return r.announce("plonk"),!1}else{if(gt===r.position)return r.announce("plonk"),!1;r.position=gt}return r.announce("move",$),r.mathfield.stopCoalescingUndo(),!0}function Le(r,o,u){var d,g;if(u=u!=null?u:{extend:!1},r.mathfield.adoptStyle=o==="backward"?"right":"left",o!=="forward"){const[N,I]=r1(r);N!==void 0&&I!==void 0&&r.deleteAtoms([N,I])}if(o==="upward")return ja(r,u);if(o==="downward")return m1(r,u);if(u.extend){let N=Pu(r,r.position,o);N<0&&(N=0),N>r.lastOffset&&(N=r.lastOffset);const I=r.setSelection(r.anchor,N);return r.mathfield.stopCoalescingUndo(),I}if(r.selectionIsPlaceholder){r.collapseSelection(o);const N=Le(r,o);return r.mathfield.stopCoalescingUndo(),N}let b=r.position;const M=b;if(r.collapseSelection(o)?(b=r.position,sy(r,b)||(b=Pu(r,b,o))):b=Pu(r,b,o),b<0||b>r.lastOffset){let N=!0;return r.silenceNotifications||(N=(g=(d=r.mathfield.host)==null?void 0:d.dispatchEvent(new CustomEvent("move-out",{detail:{direction:o},cancelable:!0,bubbles:!0,composed:!0})))!=null?g:!0),N&&r.announce("plonk"),N}return r.setPositionHandlingPlaceholder(b),r.mathfield.stopCoalescingUndo(),r.announce("move",M),!0}function Pu(r,o,u){return o=o+(u==="forward"?1:-1),o<0||o>r.lastOffset||sy(r,o)?o:Pu(r,o,u)}function sy(r,o){var u;const d=r.at(o);let g=d.parent;for(;g&&!g.inCaptureSelection;)g=g.parent;return!(g!=null&&g.inCaptureSelection||(u=d.parent)!=null&&u.skipBoundary&&(!d.isFirstSibling&&d.isLastSibling||d.type==="first")||r.mathfield.hasEditablePrompts&&!d.parentPrompt)}function p1(r,o,u){let d=1/0,g=0;for(;g<o.length;g++){const b=Rd(r.getHTMLElement(o[g])).right,M=Math.abs(u-b);if(M<=d)d=M;else break}return o[g-1]}function Am(r,o,u,d,g){const b=r.mathfield.hasEditablePrompts,M=b?u.filter(F=>F.type==="prompt"&&!F.captureSelection):u,N=Rd(r.mathfield.getHTMLElement(o)).right,I=r.offsetOf(p1(r.mathfield,M,N))-(b?1:0);if(d){const[F,$]=r.selection.ranges[0];let it;I<(g==="up"?F:$)?it={ranges:[[I,$]],direction:"backward"}:it={ranges:[[F,I]],direction:"forward"},r.setSelection(it)}else r.setPositionHandlingPlaceholder(I);r.announce(`move ${g}`)}function ja(r,o){var u,d;const g=(u=o==null?void 0:o.extend)!=null?u:!1;g||r.collapseSelection("backward");const b=()=>{var I,F;let $=!0;return r.silenceNotifications||($=(F=(I=r.mathfield.host)==null?void 0:I.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"upward"},cancelable:!0,bubbles:!0,composed:!0})))!=null?F:!0),r.announce($?"plonk":"line"),$},M=r.at(r.position);let N=M;for(;N&&N.parentBranch!=="below"&&!(Array.isArray(N.parentBranch)&&N.parent instanceof rr);)N=N.parent;if(Array.isArray(N==null?void 0:N.parentBranch)&&N.parent instanceof rr){const I=N.parent;if(N.parentBranch[0]<1)return b();const F=N.parentBranch[0]-1,$=I.array[F][N.parentBranch[1]];if(!$.some(gt=>gt.type==="prompt"&&!gt.captureSelection)&&r.mathfield.hasEditablePrompts)return b();Am(r,M,$,g,"up")}else if(N){const I=(d=N.parent.branch("above"))!=null?d:N.parent.createBranch("above");if(!I.some($=>$.type==="prompt"&&$.placeholderId)&&r.mathfield.hasEditablePrompts)return b();Am(r,M,I,g,"up")}else return b();return r.mathfield.stopCoalescingUndo(),!0}function m1(r,o){var u,d;const g=(u=o==null?void 0:o.extend)!=null?u:!1;g||r.collapseSelection("forward");const b=()=>{var I,F;let $=!0;return r.silenceNotifications||($=(F=(I=r.mathfield.host)==null?void 0:I.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"downward"},cancelable:!0,bubbles:!0,composed:!0})))!=null?F:!0),r.announce($?"plonk":"line"),$},M=r.at(r.position);let N=M;for(;N&&N.parentBranch!=="above"&&!(Array.isArray(N.parentBranch)&&N.parent instanceof rr);)N=N.parent;if(Array.isArray(N==null?void 0:N.parentBranch)&&N.parent instanceof rr){const I=N.parent;if(N.parentBranch[0]+1>I.array.length-1)return b();const F=N.parentBranch[0]+1,$=I.array[F][N.parentBranch[1]];if(!$.some(gt=>gt.type==="prompt"&&!gt.captureSelection)&&r.mathfield.hasEditablePrompts)return b();Am(r,M,$,g,"down")}else if(N){const I=(d=N.parent.branch("below"))!=null?d:N.parent.createBranch("below");if(!I.some($=>$.type==="prompt")&&r.mathfield.hasEditablePrompts)return b();Am(r,M,I,g,"down")}else return b();return!0}function Dm(r){const o=r.position,u=r.at(o).parent;return u!=null&&u.parent?(r.position=r.offsetOf(u),r.mathfield.stopCoalescingUndo(),r.announce("move",o),!0):(r.announce("plonk"),!1)}function Yg(r){let o=0,u=r.at(r.position),d=!1;for(;u;)(!u.hasEmptyBranch("superscript")||!u.hasEmptyBranch("subscript"))&&(o+=1),u.hasEmptyBranch("superscript")?u.hasEmptyBranch("subscript")||(d=!1):d=!0,u=u.parent;return d?o:0}function Im(r){let o=0,u=r.at(r.position),d=!1;for(;u;)(!u.hasEmptyBranch("superscript")||!u.hasEmptyBranch("subscript"))&&(o+=1),u.hasEmptyBranch("superscript")?u.hasEmptyBranch("subscript")||(d=!0):d=!1,u=u.parent;return d?o:0}function ay(r){var o;if(r.collapseSelection(),Yg(r)>=r.mathfield.options.scriptDepth[1])return r.announce("plonk"),!1;let u=r.at(r.position);return u.subsupPlacement===void 0&&(((o=u.rightSibling)==null?void 0:o.type)!=="subsup"&&u.parent.addChildAfter(new ha({style:u.computedStyle}),u),u=u.rightSibling),u.createBranch("superscript"),r.setSelection(r.getSiblingsRange(r.offsetOf(u.superscript[0]))),!0}function ly(r){var o;if(r.collapseSelection(),Im(r)>=r.mathfield.options.scriptDepth[0])return r.announce("plonk"),!1;let u=r.at(r.position);return u.subsupPlacement===void 0&&(((o=r.at(r.position+1))==null?void 0:o.type)!=="subsup"&&u.parent.addChildAfter(new ha({style:r.at(r.position).computedStyle}),u),u=r.at(r.position+1)),u.createBranch("subscript"),r.setSelection(r.getSiblingsRange(r.offsetOf(u.subscript[0]))),!0}function uy(){function r(I){const F=[],$=[];return[...I.querySelectorAll(`input, select, textarea, a[href], button,
[tabindex], audio[controls], video[controls],
[contenteditable]:not([contenteditable="false"]), details>summary`)].filter(o).forEach((gt,_t)=>{const zt=d(gt);zt===0?F.push(gt):$.push({documentOrder:_t,tabIndex:zt,node:gt})}),$.sort((gt,_t)=>gt.tabIndex===_t.tabIndex?gt.documentOrder-_t.documentOrder:gt.tabIndex-_t.tabIndex).map(gt=>gt.node).concat(F)}function o(I){return!(!u(I)||g(I)||d(I)<0)}function u(I){return!(I.disabled||I.type==="hidden"&&I.tagName.toUpperCase()==="INPUT"||N(I))}function d(I){var F;const $=Number.parseInt((F=I.getAttribute("tabindex"))!=null?F:"NaN",10);return Number.isNaN($)?I.contentEditable==="true"||(I.nodeName==="AUDIO"||I.nodeName==="VIDEO")&&I.getAttribute("tabindex")===null?0:I.tabIndex:$}function g(I){return I.tagName.toUpperCase()==="INPUT"&&I.type==="radio"&&!M(I)}function b(I,F){for(const $ of I)if($.checked&&$.form===F)return $;return null}function M(I){var F;if(!I.name)return!0;const it=((F=I.form)!=null?F:I.ownerDocument).querySelectorAll('input[type="radio"][name="'+I.name+'"]'),gt=b(it,I.form);return!gt||gt===I}function N(I){if(!Ce()||I===document.activeElement||I.contains(document.activeElement))return!1;if(getComputedStyle(I).visibility==="hidden")return!0;const F=I.getBoundingClientRect();if(F.width===0||F.height===0)return!0;for(;I;){if(getComputedStyle(I).display==="none")return!0;I=I.parentElement}return!1}return Ce()?r(document.body):[]}function ml(r,o,u="forward"){const d=r.position;if(Array.isArray(o)){const g=r.offsetOf(o[0]),b=r.offsetOf(o[o.length-1]);return u==="forward"?r.setSelection(g,b):r.setSelection(b,g),r.announce("move",d),r.mathfield.stopCoalescingUndo(),!0}return u==="forward"?ml(r,[o.leftSibling,o]):ml(r,[o,o.leftSibling])}function dh(r,o){const u=r.position;if(typeof o=="number"&&(o=r.at(o)),o.type==="prompt")r.setSelection(r.offsetOf(o.firstChild),r.offsetOf(o.lastChild));else{const d=r.offsetOf(o);o.type==="placeholder"?r.setSelection(d-1,d):r.position=d}return r.announce("move",u),r.mathfield.stopCoalescingUndo(),!0}function Om(r,o,u=!0){var d,g;const b=o==="forward"?1:-1;r.at(r.anchor).type==="placeholder"&&Le(r,o);let M;const N=r.at(r.anchor).parentPrompt;N?o==="forward"?M=r.offsetOf(N)+1:M=r.offsetOf(N.leftSibling):M=Math.max(r.position+b,0);const I=Jg(r,M,o);if(!I||o==="forward"&&r.offsetOf(I)<M||o==="backward"&&r.offsetOf(I)>M){if(!u||!((g=(d=r.mathfield.host)==null?void 0:d.dispatchEvent(new CustomEvent("move-out",{detail:{direction:o},cancelable:!0,bubbles:!0,composed:!0})))==null||g))return r.announce("plonk"),!1;const $=uy();if(!document.activeElement||$.length<=1)return r.announce("plonk"),!1;let it=$.indexOf(document.activeElement)+b;return it<0&&(it=$.length-1),it>=$.length&&(it=0),$[it].focus(),r.mathfield.stopCoalescingUndo(),!0}return dh(r,I),!0}function Jg(r,o=0,u="forward"){return r.findAtom(d=>d.type==="placeholder"||d.type==="prompt"||!r.mathfield.readOnly&&d.treeDepth>2&&d.isFirstSibling&&d.isLastSibling,o,u)}bs({moveToOpposite:r=>{const o={superscript:"subscript",subscript:"superscript",above:"below",below:"above"},u=r.at(r.position),{parent:d}=u;if(!d)return r.announce("plonk"),!1;const g=u.parentBranch;let b;if(typeof g=="string"&&(b=o[g]),!b){const N=u.subsupPlacement?ly(r):ay(r);return r.mathfield.stopCoalescingUndo(),N}d.branch(b)||d.createBranch(b);const M=r.setSelection(r.getBranchRange(r.offsetOf(d),b));return r.mathfield.stopCoalescingUndo(),M},moveBeforeParent:r=>{const{parent:o}=r.at(r.position);return o?(r.position=r.offsetOf(o),r.mathfield.stopCoalescingUndo(),!0):(r.announce("plonk"),!1)},moveAfterParent:r=>Dm(r),moveToNextChar:r=>Le(r,"forward"),moveToPreviousChar:r=>Le(r,"backward"),moveUp:r=>Le(r,"upward"),moveDown:r=>Le(r,"downward"),moveToNextWord:r=>rf(r,"forward"),moveToPreviousWord:r=>rf(r,"backward"),moveToGroupStart:r=>{const o=r.offsetOf(r.at(r.position).firstSibling);return o===r.position?(r.announce("plonk"),!1):(r.position=o,r.mathfield.stopCoalescingUndo(),!0)},moveToGroupEnd:r=>{const o=r.offsetOf(r.at(r.position).lastSibling);return o===r.position?(r.announce("plonk"),!1):(r.position=o,r.mathfield.stopCoalescingUndo(),!0)},moveToNextGroup:r=>{var o,u,d,g;if(r.position===r.lastOffset&&r.anchor===r.lastOffset)return Om(r,"forward");const b=r.at(r.position);if(b.mode==="text"){if(r.selectionIsCollapsed){let gt=b;for(;gt&&gt.mode==="text";)gt=gt.leftSibling;let _t=b;for(;((o=_t.rightSibling)==null?void 0:o.mode)==="text";)_t=_t.rightSibling;if(gt&&_t)return ml(r,[gt,_t])}if(b.rightSibling.mode==="text"){let gt=b;for(;gt&&gt.mode==="text";)gt=gt.rightSibling;return gt?(dh(r,(u=gt.leftSibling)!=null?u:gt),r.mathfield.switchMode("math"),!0):dh(r,r.lastOffset)}}const N=r.at(r.anchor).parentPrompt,I=N?r.offsetOf(N)+1:Math.max(r.position+1,0),F=Jg(r,I,"forward");if(F)return dh(r,F);const $=g1(r,b,gt=>gt.type==="leftright"||gt.type==="text","forward");if($){if($.mode==="text"){let gt=$;for(;gt&&gt.mode==="text";)gt=gt.rightSibling;return ml(r,[(d=$.leftSibling)!=null?d:$,(g=gt.leftSibling)!=null?g:gt])}return ml(r,$)}const it=b.parent;if(it){if(it.type==="leftright"||it.type==="surd")return ml(r,it);if(b.parentBranch==="superscript"&&it.subscript)return ml(r,it.subscript);if(b.parentBranch==="above"&&it.below)return ml(r,it.below);if(b.parentBranch==="superscript"||b.parentBranch==="subscript")return dh(r,it);if(b.parentBranch==="above"||b.parentBranch==="below")return ml(r,it)}return dh(r,r.lastOffset)},moveToPreviousGroup:r=>{var o;if(r.position===0&&r.anchor===0)return Om(r,"backward");let u=r.at(r.position);const d=u.mode;if(d==="text"){if(r.selectionIsCollapsed){let N=u;for(;N&&N.mode==="text";)N=N.leftSibling;let I=u;for(;((o=I.rightSibling)==null?void 0:o.mode)==="text";)I=I.rightSibling;if(N&&I)return ml(r,[N,I])}for(;u&&u.mode==="text";)u=u.leftSibling;return u?dh(r,u):dh(r,0)}const g=r.at(r.anchor).parentPrompt,b=g?r.offsetOf(g.leftSibling):Math.max(r.position-1,0),M=Jg(r,b,"backward");if(M)return dh(r,M);if(d==="math"){const N=g1(r,u,F=>F.type==="leftright"||F.type==="text","backward");if(N){if(N.mode==="text"){let F=N;for(;F&&F.mode==="text";)F=F.leftSibling;return ml(r,[N,F])}return ml(r,N)}const I=u.parent;if(I){if(I.type==="leftright"||I.type==="surd")return ml(r,I);if(u.parentBranch==="subscript"&&I.superscript)return ml(r,I.superscript);if(u.parentBranch==="below"&&I.above)return ml(r,I.above);if(u.parentBranch==="superscript"||u.parentBranch==="subscript")return dh(r,I);if(u.parentBranch==="above"||u.parentBranch==="below")return ml(r,I)}return dh(r,0)}return!1},moveToMathfieldStart:r=>r.selectionIsCollapsed&&r.position===0?(r.announce("plonk"),!1):(r.position=0,r.mathfield.stopCoalescingUndo(),!0),moveToMathfieldEnd:r=>r.selectionIsCollapsed&&r.position===r.lastOffset?(r.announce("plonk"),!1):(r.position=r.lastOffset,r.mathfield.stopCoalescingUndo(),!0),moveToSuperscript:ay,moveToSubscript:ly},{target:"model",changeSelection:!0}),bs({moveToNextPlaceholder:r=>Om(r,"forward"),moveToPreviousPlaceholder:r=>Om(r,"backward")},{target:"model",changeSelection:!0,audioFeedback:"return"});function g1(r,o,u,d){if(d==="forward"){let b=o.rightSibling;for(;b&&!u(b);)b=b.rightSibling;return b}let g=o.leftSibling;for(;g&&!u(g);)g=g.leftSibling;return g}function up(r,o,u){typeof o=="function"&&(u=o,o=1/0),o===void 0&&(o=1/0);let d=r.position,g=!1,b="";for(;!g;){const M=r.at(d);g=o===0||M===void 0||M.type==="first"||M.mode!=="math"||!(M.type&&/mord|mpunct|operator/.test(M.type)||M.type==="mop"&&/[a-zA-Z ]+/.test(M.value))||!M.hasEmptyBranch("superscript")||!M.hasEmptyBranch("subscript")||typeof u=="function"&&!u(M),g||(M.mode="text",M.command=M.value,M.verbatimLatex=void 0,b+=M.value),d-=1,o-=1}r.contentDidChange({data:b,inputType:"insertText"})}function ld(r,o,u){typeof o=="function"&&(u=o,o=1/0),o===void 0&&(o=1/0);let d=r.position,g=!1;const b=[];for(;!g;){const M=r.at(d);g=o===0||!M||M.type==="first"||M.isFirstSibling||M.mode!=="text"||M.value===" "||typeof u=="function"&&!u(M),g||(b.push(oi.serialize([M],{defaultMode:"math"})),M.mode="math"),d-=1,o-=1}ji(r),r.contentDidChange({data:fr(b),inputType:"insertText"})}function ji(r){var o;let u=r.position-1;for(;u>=0&&((o=r.at(u))==null?void 0:o.mode)==="math";)u-=1;if(!(u<0)&&r.at(u).mode==="text"&&r.at(u).value===" "&&r.at(u-1).mode==="math"){r.at(u-1).parent.removeChild(r.at(u-1));const d=r.silenceNotifications;r.silenceNotifications=!0,r.position-=1,r.silenceNotifications=d,r.contentDidChange({inputType:"deleteContent"})}}function hy(r){let o="",u=r.position,d=!1;for(;!d;){const g=r.at(u);d=!(g&&(g.mode==="text"||g.mode==="math"&&g.type&&/mord|mpunct/.test(g.type))),d||(o=g.value+o),u-=1}return o}function cy(r,o,u){const{model:d}=r;if(d.mode==="latex"||!d.at(d.position).isLastSibling||!u||!uu(u))return!1;const g=ip(u);if(!d.selectionIsCollapsed)return!!(r.model.mode==="text"&&/[/_^]/.test(g));const b=hy(d)+g;if(r.model.mode==="text"){if(o==="Esc"||/[/\\]/.test(g))return!0;if(/[\^_]/.test(g))return/(^|\s)[a-zA-Z][^_]$/.test(b)&&ld(d,1),!0;const M={")":"(","}":"{","]":"["}[g],{parent:N}=d.at(d.position);if(M&&N instanceof Kr&&N.leftDelim===M)return!0;if(/(^|[^a-zA-Z])(a|I) $/.test(b))return!1;if(/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(g))return!0;if(/(^|[^a-zA-Z'])[a-zA-Z] $/.test(b))return ld(d,1),!1;if(/\D\.[^\d\s]$/.test(b)){ld(d,1);const I=d.at(d.position);return I.value="\u22C5",I.style.variant="normal",I.command="\\cdot",I.verbatimLatex=void 0,d.contentDidChange({data:"\\cdot",inputType:"insertText"}),!0}if(/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(b)||/\.\d$/.test(b)||/\([\d+\-.]$/.test(b))return ld(d,1),!0;if(/\([a-z][,;]$/.test(b))return ld(d,2),!0;if(/[\d+\-=><*|]$/.test(g))return ji(d),!0}else{if(o==="[Space]")return up(d,void 0,M=>/[a-z][:,;.]$/.test(M.value)),!0;if(/[a-zA-Z]{3,}$/.test(b)&&!/(dxd|abc|xyz|uvw)$/.test(b))return up(d,void 0,M=>/[a-zA-Z]/.test(M.value)),!0;if(/(^|\W)(if)$/i.test(b))return up(d,1),!0;if(/(\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5){3,}$/u.test(b)&&!/(αβγ)$/.test(b))return up(d,void 0,M=>/(:|,|;|.|\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5)/u.test(M.value)),!0;if(g==="?"||g==="."&&!/[\d-+]\.$/.test(b))return!0}return!1}function v1(r,o){if(!r.isSelectionEditable||!r.keystrokeCaptionVisible)return;const u=Zs(),d=r.element.getBoundingClientRect();u.style.left=`${d.left}px`,u.style.top=`${d.top-64}px`,u.innerHTML=window.MathfieldElement.createHTML("<span>"+(pm(o)||o)+"</span>"+u.innerHTML),u.style.visibility="visible",setTimeout(()=>{u.childNodes.length>0&&u.childNodes[u.childNodes.length-1].remove(),u.childNodes.length===0&&(u.style.visibility="hidden")},3e3)}function y1(r){if(r.keystrokeCaptionVisible=!r.keystrokeCaptionVisible,r.keystrokeCaptionVisible){const o=Zs();o.innerHTML=""}else{const o=n0("mathlive-keystroke-caption-panel");o.style.visibility="hidden"}return!1}function Zs(){const r=document.getElementById("mathlive-keystroke-caption-panel");return r||(Hl("keystroke-caption"),Hl("core"),n0("mathlive-keystroke-caption-panel"))}function ue(){document.getElementById("mathlive-keystroke-caption-panel")&&(ym("mathlive-keystroke-caption-panel"),h("core"),h("keystroke-caption"))}function hp(r,o){var u,d,g;const{model:b}=r,M=Gv(o);if(o.isTrusted){Dg(o);const _t=rd();r.keyboardLayout!==_t.id&&(r.keyboardLayout=_t.id,r._keybindings=void 0)}if(clearTimeout(r.inlineShortcutBufferFlushTimer),r.inlineShortcutBufferFlushTimer=0,v1(r,M),o.isTrusted&&o.defaultPrevented)return r.flushInlineShortcutBuffer(),!1;let N,I="",F;const $=r.inlineShortcutBuffer;if(r.isSelectionEditable){if(b.mode==="math")if(M==="[Backspace]")$.pop();else if(!uu(o))r.flushInlineShortcutBuffer();else{const _t=ip(o),zt=[...(d=(u=$[$.length-1])==null?void 0:u.keystrokes)!=null?d:[],_t];$.push({state:b.getState(),keystrokes:zt,leftSiblings:kc(r)});let Ne=0,Bi="";for(;!N&&Ne<zt.length;)F=$.length-(zt.length-Ne),Bi=zt.slice(Ne).join(""),N=rm($[F].leftSiblings,Bi,r.options.inlineShortcuts),!N&&/^[a-zA-Z][a-zA-Z0-9]+?([_\^][a-zA-Z0-9\*\+\-]+?)?$/.test(Bi)&&(N=r.options.onInlineShortcut(r,Bi)),Ne+=1;r.flushInlineShortcutBuffer({defer:!0})}r.options.smartMode&&(N?r.switchMode("math"):cy(r,M,o)&&(r.switchMode({math:"text",text:"math"}[b.mode]),I=""))}if(!N){if(I||(I=bc(r.keybindings,b.mode,o)),!I&&(M==="[Enter]"||M==="[Return]")){let _t=!1;return b.contentWillChange({inputType:"insertLineBreak"})&&(r.host&&(_t=!r.host.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),_t||o.preventDefault&&(o.preventDefault(),o.stopPropagation()),b.contentDidChange({inputType:"insertLineBreak"})),_t}if((!I||M==="[Space]")&&b.mode==="math"){if(M==="[Space]"){if(r.adoptStyle="none",r.flushInlineShortcutBuffer(),r.options.mathModeSpace)return Bn.insert(b,r.options.mathModeSpace,{format:"latex",mode:"math"}),r.snapshot("insert-space"),I="",r.dirty=!0,r.scrollIntoView(),o.preventDefault&&(o.preventDefault(),o.stopPropagation()),!1;const _t=b.at(b.position+1),zt=b.at(b.position-1);if((_t==null?void 0:_t.mode)==="text"||(zt==null?void 0:zt.mode)==="text")return Bn.insert(b," ",{mode:"text"}),r.snapshot("insert-space"),r.dirty=!0,r.scrollIntoView(),!1}(g=b.at(b.position))!=null&&g.isDigit()&&window.MathfieldElement.decimalSeparator===","&&ip(o)===","&&(I="insertDecimalSeparator")}}if(!N&&!I){if(b.mathfield.smartFence){if(g0(b,ip(o),r.effectiveStyle))return r.dirty=!0,r.scrollIntoView(),o.preventDefault&&o.preventDefault(),!1}else{const{parent:_t}=b.at(b.position);if(_t instanceof Kr&&_t.rightDelim==="?"&&b.at(b.position).isLastSibling&&/^[)}\]|]$/.test(M))return r.snapshot(),_t.isDirty=!0,_t.rightDelim=M,b.position+=1,b.selectionDidChange(),b.contentDidChange({data:ip(o),inputType:"insertText"}),r.snapshot("insert-fence"),r.dirty=!0,r.scrollIntoView(),o.preventDefault&&o.preventDefault(),!1;if(!b.selectionIsCollapsed){const zt=ip(o);if(zt==="("||zt==="{"||zt==="["){const Ne={"(":"(","{":"\\lbrace","[":"\\lbrack"}[zt],Bi={"(":")","{":"\\rbrace","[":"\\rbrack"}[zt],[Ee,hi]=Yo(b.selection);return r.snapshot(),b.position=hi,Bn.insert(b,Bi,{format:"latex"}),b.position=Ee,Bn.insert(b,Ne,{format:"latex"}),b.setSelection(Ee+1,hi+1),b.contentDidChange({data:zt,inputType:"insertText"}),r.snapshot("insert-fence"),r.dirty=!0,r.scrollIntoView(),o.preventDefault&&o.preventDefault(),!1}}}return!0}const it=b.at(Math.max(b.position,b.anchor)),{parent:gt}=it;if(I==="moveAfterParent"&&(gt==null?void 0:gt.type)==="leftright"&&it.isLastSibling&&r.options.smartFence&&g0(b,".",r.defaultStyle)&&(I="",ls(r)),r.keyboardDelegate.cancelComposition(),I)r.executeCommand(I);else if(N){const _t=r.effectiveStyle;b.setState($[F].state);const zt=$[$.length-1].keystrokes;for(const Ne of zt)Bn.insert(b,Ne,{silenceNotifications:!0,style:_t});r.snapshot("insert-shortcut"),b.setState($[F].state),b.deferNotifications({content:!0,selection:!0,data:N,type:"insertText"},()=>(Bn.insert(b,N,{format:"latex",style:_t}),ji(r.model),N.endsWith(" ")&&(r.switchMode("text"),Bn.insert(b," ",{style:_t,mode:"text"})),r.snapshot(),b.selectionIsCollapsed||r.flushInlineShortcutBuffer(),!0)),r.dirty=!0,b.announce("replacement")}return r.scrollIntoView(),o.preventDefault&&o.preventDefault(),!1}function qg(r,o,u){const{model:d}=r;if(!r.isSelectionEditable){d.announce("plonk");return}u!=null||(u={}),u.focus&&r.focus(),u.feedback&&window.MathfieldElement.playSound("keypress"),typeof u.mode=="string"&&(r.switchMode(u.mode),r.snapshot());let g=jf(o);const b=window.mathVirtualKeyboard;if(b!=null&&b.isShifted&&(g=typeof g=="string"?g.toUpperCase():g.map(I=>I.toUpperCase())),u.simulateKeystroke){let I=!0;for(const F of g)hp(r,new KeyboardEvent("keypress",{key:F}))&&(I=!1);if(I)return}const M=d.at(d.position),N=Q(Q({},M.computedStyle),r.defaultStyle);if(d.selectionIsCollapsed||(d.deleteAtoms(Yo(d.selection)),r.snapshot("delete")),d.mode==="latex")d.deferNotifications({content:!0,selection:!0,data:o,type:"insertText"},()=>{Xd(r);for(const I of g)Bn.insert(d,I);r.snapshot("insert-latex"),i0(r)});else if(d.mode==="text"){for(const I of g)Bn.insert(d,I,{style:N});r.snapshot("insert-text")}else if(d.mode==="math")for(const I of g)Qg(r,I,N,M);r.dirty=!0,r.scrollIntoView()}function kc(r){const o=r.model,u=[];let d=o.at(Math.min(o.position,o.anchor));for(;d.type!=="first";)u.push(d),d=d.leftSibling;return u}function Qg(r,o,u,d){const g=r.model;let b={"^":"moveToSuperscript",_:"moveToSubscript"," ":"moveAfterParent"}[o];if(o===" "&&r.options.mathModeSpace&&(b=["insert",r.options.mathModeSpace]),b){r.executeCommand(b);return}if(/\d/.test(o)&&r.options.smartSuperscript&&d.parentBranch==="superscript"&&d.parent.type!=="mop"&&d.parent.type!=="operator"&&d.parent.type!=="extensible-symbol"&&d.hasNoSiblings){dy(g),Bn.insert(g,o,{style:u}),r.snapshot(),Dm(g),r.snapshot();return}if(/[a-zA-Z0-9]/.test(o)&&r.adoptStyle!=="none"){const M=r.adoptStyle==="left"?d:d.parent?d.rightSibling:null;(M==null?void 0:M.type)==="mord"&&/[a-zA-Z0-9]/.test(M.value)&&(u=Q({},u),M.style.variant&&(u.variant=M.style.variant),M.style.variantStyle&&(u.variantStyle=M.style.variantStyle))}Bn.insert(g,o,{style:u}),r.snapshot(`insert-${g.at(g.position).type}`)}function dy(r){r.selectionIsCollapsed||(r.deleteAtoms(Yo(r.selection)),r.mathfield.snapshot("delete"))}function g0(r,o,u){if(!o||r.mode!=="math")return!1;const d=r.at(r.position),{parent:g}=d,b={"(":"(",")":")","{":"\\lbrace","}":"\\rbrace","[":"\\lbrack","]":"\\rbrack","|":"|"}[o];if(!b)return!1;const M=y[b],N=x[b];if(!r.selectionIsCollapsed){r.mathfield.snapshot();const[I,F]=Yo(r.selection),$=r.extractAtoms([I,F]),it=g.addChildrenAfter([new Kr("left...right",$,{leftDelim:b,rightDelim:N})],r.at(I));return r.setSelection(r.offsetOf(it.firstChild),r.offsetOf(it.lastChild)),r.mathfield.snapshot("insert-fence"),r.contentDidChange({data:b,inputType:"insertText"}),!0}if(b==="|"){const I=g instanceof Kr?g.leftDelim+g.rightDelim:"";if(I==="\\lbrace\\rbrace"||I==="\\{\\}"||I==="\\lbrace?")return r.mathfield.snapshot(),Bn.insert(r,"\\,\\middle\\vert\\,",{format:"latex",style:u}),r.mathfield.snapshot("insert-fence"),r.contentDidChange({data:b,inputType:"insertText"}),!0}if(N){if(g instanceof Kr&&g.firstChild===d&&(g.leftDelim==="?"||g.leftDelim==="."))return g.leftDelim=b,g.isDirty=!0,r.mathfield.snapshot(),r.contentDidChange({data:b,inputType:"insertText"}),r.mathfield.snapshot("insert-fence"),!0;if(!(g instanceof Kr)){let it=d;for(;it&&!(it.type==="mclose"&&it.value===N);)it=it.rightSibling;if(it){r.mathfield.snapshot();const gt=r.extractAtoms([r.offsetOf(d),r.offsetOf(it)]);return gt.pop(),g.addChildrenAfter([new Kr("left...right",gt,{leftDelim:b,rightDelim:N})],d),r.position=r.offsetOf(g.firstChild)+1,r.contentDidChange({data:b,inputType:"insertText"}),r.mathfield.snapshot("insert-fence"),!0}}const I=r.offsetOf(d.lastSibling);let F;for(F=r.position;F<=I;F++){const it=r.at(F);if(it instanceof Kr&&(it.leftDelim==="?"||it.leftDelim===".")&&Bm(b,it.rightDelim))break}const $=r.at(F);if(F<=I&&$ instanceof Kr){$.leftDelim=b,r.mathfield.snapshot();let it=r.extractAtoms([r.position,F-1]);return it=it.filter(gt=>gt.type!=="first"),$.addChildren(it,$.parentBranch),r.position+=1,r.contentDidChange({data:b,inputType:"insertText"}),r.mathfield.snapshot("insert-fence"),!0}if(g instanceof Kr&&(g.leftDelim==="?"||g.leftDelim===".")&&Bm(b,g.rightDelim)){g.isDirty=!0,g.leftDelim=b,r.mathfield.snapshot();const it=r.extractAtoms([r.offsetOf(d.firstSibling),r.position]);for(const gt of it)g.parent.addChildBefore(gt,g);return r.contentDidChange({data:b,inputType:"insertText"}),r.mathfield.snapshot("insert-fence"),!0}if(!(g instanceof Kr&&g.leftDelim==="|")){if(r.mathfield.snapshot(),Bn.insert(r,`\\left${b}\\right?`,{format:"latex",style:u}),d.lastSibling.type!=="first"){const it=r.offsetOf(d.lastSibling),gt=r.extractAtoms([r.position,it]);r.at(r.position).body=gt,r.position-=1}return r.mathfield.snapshot("insert-fence"),!0}}if(M){let I=d;for(;I;){if(I.type==="mopen"&&I.value===M){r.mathfield.snapshot();const _t=I.leftSibling,zt=r.extractAtoms([r.offsetOf(I.leftSibling),r.offsetOf(d)]);zt.shift();const Ne=new Kr("left...right",zt,{leftDelim:M,rightDelim:b});return g.addChildrenAfter([Ne],_t),r.position=r.offsetOf(Ne),r.contentDidChange({data:b,inputType:"insertText"}),r.mathfield.snapshot("insert-fence"),!0}I=I.leftSibling}if(g instanceof Kr&&d.isLastSibling&&of(g.leftDelim,b))return r.mathfield.snapshot(),g.isDirty=!0,g.rightDelim=b,r.position+=1,r.contentDidChange({data:b,inputType:"insertText"}),r.mathfield.snapshot("insert-fence"),!0;const F=r.offsetOf(d.firstSibling);let $;for($=r.position;$>=F;$--){const _t=r.at($);if(_t instanceof Kr&&(_t.rightDelim==="?"||_t.rightDelim===".")&&of(_t.leftDelim,b))break}const it=r.at($);if($>=F&&it instanceof Kr)return r.mathfield.snapshot(),it.rightDelim=b,it.addChildren(r.extractAtoms([$,r.position]),it.parentBranch),r.contentDidChange({data:b,inputType:"insertText"}),r.mathfield.snapshot("insert-fence"),!0;if(g instanceof Kr&&(g.rightDelim==="?"||g.rightDelim===".")&&of(g.leftDelim,b))return r.mathfield.snapshot(),g.isDirty=!0,g.rightDelim=b,g.parent.addChildren(r.extractAtoms([r.position,r.offsetOf(d.lastSibling)]),g.parentBranch),r.position=r.offsetOf(g),r.contentDidChange({data:b,inputType:"insertText"}),r.mathfield.snapshot("insert-fence"),!0;const gt=g.parent;return gt instanceof Kr&&(gt.rightDelim==="?"||gt.rightDelim===".")&&r.at(r.position).isLastSibling?(r.position=r.offsetOf(gt),g0(r,b,u)):!1}return!1}function of(r,o){return r?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(r)?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(o):x[r]===o:!0}function Bm(r,o){return o?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(o)?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(r):y[o]===r:!0}bs({undo:r=>(r.undo(),!0),redo:r=>(r.redo(),!0),scrollIntoView:r=>(r.scrollIntoView(),!0),scrollToStart:r=>(r.field.scroll(0,0),!0),scrollToEnd:r=>{const o=r.field.getBoundingClientRect();return r.field.scroll(o.left-window.scrollX,0),!0},toggleKeystrokeCaption:y1,toggleContextMenu:r=>{const o=r.toggleContextMenu();return o||r.model.announce("plonk"),o},plonk:r=>(r.model.announce("plonk"),!0),switchMode:(r,o,u,d)=>(r.switchMode(o,u,d),!0),insert:(r,o,u)=>r.insert(o,u),typedText:(r,o,u)=>(qg(r,o,u),!0),insertDecimalSeparator:r=>{const o=r.model;return o.mode==="math"&&window.MathfieldElement.decimalSeparator===","&&o.at(Math.max(o.position,o.anchor)).isDigit()?(r.insert("{,}",{format:"latex"}),r.snapshot("insert-mord"),!0):(r.insert("."),!0)},commit:r=>{var o;return r.model.contentWillChange({inputType:"insertLineBreak"})&&((o=r.host)==null||o.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),r.model.contentDidChange({inputType:"insertLineBreak"})),!0},insertPrompt:(r,o,u)=>{const d=r.getPrompts();let g="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36),b=0;for(;d.includes(g)&&b<100;){if(b===99)return console.error("could not find a unique ID after 100 tries"),!1;g="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36),b++}return r.insert(`\\placeholder[${o!=null?o:g}]{}`,u),!0}}),bs({copyToClipboard:r=>(r.focus(),r.model.selectionIsCollapsed&&r.select(),"queryCommandSupported"in document&&document.queryCommandSupported("copy")?document.execCommand("copy"):r.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("copy",{bubbles:!0,composed:!0})),!1)},{target:"mathfield"}),bs({cutToClipboard:r=>(r.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("cut")?document.execCommand("cut"):r.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("cut",{bubbles:!0,composed:!0})),!0),pasteFromClipboard:r=>(r.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("paste")?(document.execCommand("paste"),!0):(navigator.clipboard.readText().then(o=>{o&&r.model.contentWillChange({inputType:"insertFromPaste",data:o})?(r.stopCoalescingUndo(),r.stopRecording(),r.insert(o,{mode:r.model.mode})&&(i0(r),r.startRecording(),r.snapshot("paste"),r.model.contentDidChange({inputType:"insertFromPaste"}),ls(r))):r.model.announce("plonk"),r.startRecording()}),!0))},{target:"mathfield",canUndo:!0,changeContent:!0,changeSelection:!0});function fy(r,o){r.flushInlineShortcutBuffer(),r.stopCoalescingUndo();const u=Fm(r,o),{model:d}=r;return d.selectionIsCollapsed?(r.defaultStyle.fontSeries&&u.fontSeries===r.defaultStyle.fontSeries&&(u.fontSeries="auto"),u.fontShape&&u.fontShape===r.defaultStyle.fontShape&&(u.fontShape="auto"),u.color&&u.color===r.defaultStyle.color&&(u.color="none"),u.backgroundColor&&u.backgroundColor===r.defaultStyle.backgroundColor&&(u.backgroundColor="none"),u.fontSize&&u.fontSize===r.defaultStyle.fontSize&&(u.fontSize="auto"),r.defaultStyle=Q(Q({},r.defaultStyle),u)):r.model.deferNotifications({content:!0,type:"insertText"},()=>{d.selection.ranges.forEach(g=>_m(d,g,u,{operation:"toggle"})),r.snapshot("style-change")}),!0}bs({applyStyle:fy},{target:"mathfield",canUndo:!0,changeContent:!0});function Fm(r,o){var u,d,g,b,M,N,I,F,$,it;const gt={};if(typeof o.color=="string"){const zt=(d=r.colorMap((u=o.color)!=null?u:o.verbatimColor))!=null?d:"none";zt!==o.color&&(gt.verbatimColor=(g=o.verbatimColor)!=null?g:o.color),gt.color=zt}if(typeof o.backgroundColor=="string"){const zt=(M=r.backgroundColorMap((b=o.backgroundColor)!=null?b:o.verbatimBackgroundColor))!=null?M:"none";zt!==o.backgroundColor&&(gt.verbatimBackgroundColor=(N=o.verbatimBackgroundColor)!=null?N:o.backgroundColor),gt.backgroundColor=zt}typeof o.fontFamily=="string"&&(gt.fontFamily=o.fontFamily),typeof o.series=="string"&&(gt.fontSeries=o.series),typeof o.fontSeries=="string"&&(gt.fontSeries=o.fontSeries.toLowerCase()),gt.fontSeries&&(gt.fontSeries=(I={bold:"b",medium:"m",normal:"m"}[gt.fontSeries])!=null?I:gt.fontSeries),typeof o.shape=="string"&&(gt.fontShape=o.shape),typeof o.fontShape=="string"&&(gt.fontShape=o.fontShape.toLowerCase()),gt.fontShape&&(gt.fontShape=(F={italic:"it",up:"n",upright:"n",normal:"n"}[gt.fontShape])!=null?F:gt.fontShape),o.variant&&(gt.variant=o.variant.toLowerCase()),o.variantStyle&&(gt.variantStyle=o.variantStyle.toLowerCase());const _t=($=o.size)!=null?$:o.fontSize;return typeof _t=="number"?gt.fontSize=Math.max(1,Math.min(10,_t)):typeof _t=="string"&&(gt.fontSize=(it={size1:1,size2:2,size3:3,size4:4,size5:5,size6:6,size7:7,size8:8,size9:9,size10:10}[_t.toLowerCase()])!=null?it:{tiny:1,scriptsize:2,footnotesize:3,small:4,normal:5,normalsize:5,large:6,Large:7,LARGE:8,huge:9,Huge:10}[_t]),gt}function v0(r){let[o,u]=Yo(r.selection);if(o=sf(r,o,"backward"),u=sf(r,u,"forward"),o===u){const d=r.at(o);if(d.type==="leftright")return r.setSelection(r.offsetOf(d.firstChild)-1,u);if(d.type==="first"&&(d.parent.type==="leftright"||d.parent.type==="surd"))return r.setSelection(o-1,r.offsetOf(d.parent.lastChild)+1);r.setSelection(o-1,u)}else r.setSelection(o,u);return!0}function sf(r,o,u){var d,g,b;let M=r.at(o);if(!M)return o;const N=u==="forward"?1:-1;if(M.mode==="text"){for(;M&&!(M.mode!=="text"||!U.test(M.value));)o+=N,M=r.at(o);return u==="backward"?o-1:o}if(M.mode==="latex"){if(/[a-zA-Z\*]/.test(M.value))if(u==="backward")for(;M&&M.mode==="latex"&&M.value!=="\\"&&/[a-zA-Z]/.test(M.value);)o+=N,M=r.at(o);else for(;M&&M.mode==="latex"&&/[a-zA-Z\*]/.test(M.value);)o+=N,M=r.at(o);else if(M.value==="{"){if(u==="forward"){for(;M&&M.mode==="latex"&&M.value!=="}";)o+=N,M=r.at(o);return o}return o-1}else if(M.value==="}"){if(u==="backward"){for(;M&&M.mode==="latex"&&M.value!=="{";)o+=N,M=r.at(o);return o-1}return o}return o-1}if(M.mode==="math"){if(M.isDigit()){for(;(d=r.at(o+N))!=null&&d.isDigit();)o+=N;return u==="backward"?o-1:o}if(M.style.variant||M.style.variantStyle){let I=(g=r.at(o))==null?void 0:g.style;for(;I&&I.variant===M.style.variant&&I.variantStyle===M.style.variantStyle;)I=(b=r.at(o+N))==null?void 0:b.style,o+=N;return u==="backward"?o-1:o}return o}return o}bs({selectGroup:r=>{const o=v0(r);return o||r.announce("plonk"),o},selectAll:r=>r.setSelection(0,r.lastOffset),extendSelectionForward:r=>Le(r,"forward",{extend:!0}),extendSelectionBackward:r=>Le(r,"backward",{extend:!0}),extendToNextWord:r=>rf(r,"forward",{extend:!0}),extendToPreviousWord:r=>rf(r,"backward",{extend:!0}),extendSelectionUpward:r=>Le(r,"upward",{extend:!0}),extendSelectionDownward:r=>Le(r,"downward",{extend:!0}),extendToNextBoundary:r=>rf(r,"forward",{extend:!0}),extendToPreviousBoundary:r=>rf(r,"backward",{extend:!0}),extendToGroupStart:r=>{const o=r.setSelection(r.anchor,r.offsetOf(r.at(r.position).firstSibling));return o||r.announce("plonk"),o},extendToGroupEnd:r=>{const o=r.setSelection(r.anchor,r.offsetOf(r.at(r.position).lastSibling));return o||r.announce("plonk"),o},extendToMathFieldStart:r=>{const o=r.setSelection(r.anchor,0);return o||r.announce("plonk"),o},extendToMathFieldEnd:r=>{const o=r.setSelection(r.anchor,r.lastOffset);return o||r.announce("plonk"),o}},{target:"model",changeSelection:!0});var ud=null,Uh=0,tv=class Fc{static start(o,u,d,g){var b;Fc.element=o,(b=Fc.controller)==null||b.abort(),Fc.controller=new AbortController;const M={signal:Fc.controller.signal};"PointerEvent"in window?(o.addEventListener("pointermove",d,M),o.addEventListener("pointerup",g,M),o.addEventListener("pointercancel",g,M),py(u)&&(Fc.pointerId=u.pointerId,o.setPointerCapture(u.pointerId))):(window.addEventListener("mousemove",d,M),window.addEventListener("blur",g,M),window.addEventListener("mouseup",g,M))}static stop(){var o;(o=Fc.controller)==null||o.abort(),Fc.controller=void 0,typeof Fc.pointerId=="number"&&(Fc.element.releasePointerCapture(Fc.pointerId),Fc.pointerId=void 0)}};function py(r){return r!==null&&globalThis.PointerEvent!==void 0&&r instanceof PointerEvent}function hd(r,o){var u;if(o.buttons>1)return;r.atomBoundsCache=new Map;const d=r;let g,b=!1,M=!1,N="none",I=!1,F=!1;const $=o.clientX,it=o.clientY,gt=Date.now(),_t=d.field,zt=setInterval(()=>{I?_t.scroll({top:0,left:_t.scrollLeft-16}):F&&_t.scroll({top:0,left:_t.scrollLeft+16})},32);function Ne(){tv.stop(),b=!1,clearInterval(zt),r.element.classList.remove("tracking"),o&&o.preventDefault()}function Bi(hi){if(!d.hasFocus()){Ne();return}const $i=hi.clientX,xi=hi.clientY,bn=py(hi)&&hi.pointerType==="touch"?20:5;if(Date.now()<gt+500&&Math.abs($-$i)<bn&&Math.abs(it-xi)<bn){hi.preventDefault(),hi.stopPropagation();return}const Rn=_t.getBoundingClientRect();F=$i>Rn.right,I=$i<Rn.left;let En=g;py(hi)&&(hi.isPrimary||(En=cd(d,hi.clientX,hi.clientY,{bias:0})));const Fr=cd(d,$i,xi,{bias:$i<=$?$i===$?0:-1:1});En>=0&&Fr>=0&&(d.model.extendSelectionTo(En,Fr),ls(r)),M&&v0(d.model)}ud&&Math.abs(ud.x-$)<5&&Math.abs(ud.y-it)<5&&Date.now()<ud.time+500?(Uh+=1,ud.time=gt):(ud={x:$,y:it,time:gt},Uh=1);const Ee=_t.getBoundingClientRect();if($>=Ee.left&&$<=Ee.right&&it>=Ee.top&&it<=Ee.bottom){if(r.flushInlineShortcutBuffer(),r.adoptStyle="left",g=cd(r,$,it,{bias:0}),g>=0){if(r.element.classList.add("tracking"),o.shiftKey){const hi=r.model.selectionIsCollapsed;r.model.extendSelectionTo(r.model.anchor,g),vm(r.model)||hi?N="all":N="selection"}else r.model.at(g).type==="placeholder"?(r.model.setSelection(g-1,g),N="selection"):((u=r.model.at(g).rightSibling)==null?void 0:u.type)==="placeholder"?(r.model.setSelection(g,g+1),N="selection"):(r.model.position=g,vm(r.model)?N="all":N="selection");r.defaultStyle={},o.detail===3||Uh>2?(Ne(),(o.detail===3||Uh===3)&&(r.model.selection={ranges:[[0,r.model.lastOffset]]},N="all")):b||(b=!0,tv.start(_t,o,Bi,Ne),(o.detail===2||Uh===2)&&(M=!0,v0(r.model),N="all"))}r.hasFocus()||(N="none",r.focus({preventScroll:!0}))}else ud=null;r.stopCoalescingUndo(),N!=="none"&&(r.model.selectionIsCollapsed&&(N="all"),ls(r)),o.preventDefault()}function ev(r,o,u){if(r>=u.left&&r<=u.right&&o>=u.top&&o<=u.bottom)return 0;const d=r-(u.left+u.right)/2,g=o-(u.top+u.bottom)/2;return d*d+g*g}function my(r,o,u,d,g){if(!u.id)return[1/0,null];if(o.has(u.id))return o.get(u.id);const b=td(r,u);if(!b)return[1/0,null];let M=[1/0,null];if(u.hasChildren&&!u.captureSelection&&d>=b.left&&d<=b.right)for(const N of u.children){const I=my(r,o,N,d,g);I[0]<=M[0]&&(M=I)}return M[1]||(M=[ev(d,g,b),u]),o.set(u.id,M),M}function Rm(r,o,u){const[,d]=my(r,new Map,r.model.root,o,u);return d}function cd(r,o,u,d){var g;const b=r.field.querySelector(".ML__latex").getBoundingClientRect();if(!b)return 0;if(o>b.right||u>b.bottom+8)return r.model.lastOffset;if(o<b.left||u<b.top-8)return 0;d=d!=null?d:{},d.bias=(g=d.bias)!=null?g:0;let M=Rm(r,o,u);const N=[];let I=M;for(;I;)N.unshift(I),I=I.parent;for(const $ of N)if($.captureSelection){M=$;break}let F=r.model.offsetOf(M);if(F<0)return-1;if(M.leftSibling)if(d.bias===0&&M.type!=="placeholder"){const $=td(r,M);$&&o<($.left+$.right)/2&&(F=r.model.offsetOf(M.leftSibling))}else d.bias<0&&(F=r.model.offsetOf(M.leftSibling));return F}var cp=class extends Bn{constructor(){super("math")}onPaste(r,o){if(!o||!r.model.contentWillChange({data:typeof o=="string"?o:null,dataTransfer:typeof o=="string"?null:o,inputType:"insertFromPaste"}))return!1;let u="",d="auto",g=typeof o!="string"?o.getData("application/json+mathlive"):"";if(g)try{const b=JSON.parse(g);if(b&&Array.isArray(b)){r.snapshot();const M=nd(b),{model:N}=r;N.selectionIsCollapsed||N.deleteAtoms(Yo(N.selection));const I=N.at(N.position);if(I.parent instanceof rr){console.assert(I.parentBranch!==void 0);const F=[];let $=[];M[0].type==="first"&&M.shift(),M[M.length-1].type==="first"&&M.pop();for(const zt of M)zt.type==="first"&&$.length>0?(F.push($),$=[zt]):$.push(zt);$.length>0&&F.push($);let it=Number(I.parentBranch[0]),gt=Number(I.parentBranch[1]);const _t=I.parent.maxColumns;for(;I.parent.colCount-gt<F.length&&I.parent.colCount<_t;)I.parent.addColumn();I.parent.addChildrenAfter(F[0],I);for(let zt=1;zt<F.length;zt++)gt++,gt>=_t&&(gt=0,I.parent.addRowAfter(it),it++),I.parent.setCell(it,gt,F[zt])}else I.parent.addChildrenAfter(M.filter(F=>F.type!=="first"),I);return N.position=N.offsetOf(M[M.length-1]),N.contentDidChange({inputType:"insertFromPaste"}),ls(r),!0}}catch(b){}if(g=typeof o!="string"?o.getData("application/json"):"",g&&window.MathfieldElement.computeEngine)try{const b=JSON.parse(g);if(typeof b=="object"&&"latex"in b&&b.latex&&(u=b.latex),!u){const M=window.MathfieldElement.computeEngine.box(b);M&&!M.has("Error")&&(u=M.latex)}u||(d="latex")}catch(b){}if(!u&&typeof o!="string"&&(u=o.getData("application/x-latex"),u&&(d="latex")),u||(u=typeof o=="string"?o:o.getData("text/plain")),u){let b;return[b,u]=sh(u),d==="auto"&&b&&(d="latex"),r.stopCoalescingUndo(),r.stopRecording(),this.insert(r.model,u,{format:d})&&(r.startRecording(),r.snapshot("paste"),ls(r)),r.startRecording(),!0}return!1}insert(r,o,u){var d,g;const b=typeof o=="string"?o:(g=(d=window.MathfieldElement.computeEngine)==null?void 0:d.box(o).latex)!=null?g:"";if(!u.silenceNotifications&&!r.contentWillChange({data:b,inputType:"insertText"}))return!1;u.insertionMode||(u.insertionMode="replaceSelection"),u.selectionMode||(u.selectionMode="placeholder"),u.format||(u.format="auto");const{silenceNotifications:M}=r;u.silenceNotifications&&(r.silenceNotifications=!0);const N=r.silenceNotifications;r.silenceNotifications=!0;const I={"?":"\\placeholder{}","@":"\\placeholder{}"};I[0]=u.insertionMode==="replaceAll"?"":r.getValue(r.selection,"latex-unstyled"),u.insertionMode==="replaceSelection"&&!r.selectionIsCollapsed?r.deleteAtoms(Yo(r.selection)):u.insertionMode==="replaceAll"?(r.root.setChildren([],"body"),r.position=0):u.insertionMode==="insertBefore"?r.collapseSelection("backward"):u.insertionMode==="insertAfter"&&r.collapseSelection("forward"),!r.at(r.position).isLastSibling&&r.at(r.position+1).type==="placeholder"?r.deleteAtoms([r.position,r.position+1]):r.at(r.position).type==="placeholder"&&r.deleteAtoms([r.position-1,r.position]);let F=-1;I[0]?I["@"]=I[0]:typeof o=="string"&&/(^|[^\\])#@/.test(o)&&(F=mx(r),F>=0&&(I["@"]=r.getValue(F,r.position,"latex"))),I[0]||(I[0]=I["?"]);let $=!1;const it=$i=>($=!0,I[$i]);let[gt,_t]=af(r,o,it,u);if(!_t)return!1;const zt=_t.length===1&&_t[0].type==="genfrac";zt&&F>=0&&typeof r.mathfield.options.isImplicitFunction=="function"&&r.mathfield.options.isImplicitFunction(r.at(r.position).command)?(I["@"]=I["?"],$=!1,[gt,_t]=af(r,o,it,u)):F>=0&&r.deleteAtoms([F,r.position]);const{parent:Ne}=r.at(r.position),Bi=Ne.hasEmptyBranch("body");if(zt&&gt!=="latex"&&r.mathfield.options.removeExtraneousParentheses&&Ne instanceof Kr&&Ne.leftDelim==="("&&Bi){const $i=Ne.parent,xi=Ne.parentBranch;$i.removeChild(Ne),$i.setChildren(_t,xi)}const Ee=r.at(r.position);Ee.parent.addChildrenAfter(_t,Ee),gt==="latex"&&typeof o=="string"&&(Ne==null?void 0:Ne.type)==="root"&&Bi&&!$&&(Ne.verbatimLatex=o),r.silenceNotifications=N;const hi=_t[_t.length-1];if(u.selectionMode==="placeholder"){const $i=_t.flatMap(xi=>[xi,...xi.children]).find(xi=>xi.type==="placeholder");if($i){const xi=r.offsetOf($i);r.setSelection(xi-1,xi),r.announce("move")}else hi&&(r.position=r.offsetOf(hi))}else u.selectionMode==="before"||(u.selectionMode==="after"?hi&&(r.position=r.offsetOf(hi)):u.selectionMode==="item"&&r.setSelection(r.anchor,r.offsetOf(hi)));return r.contentDidChange({data:b,inputType:"insertText"}),r.silenceNotifications=M,!0}};function af(r,o,u,d){var g;let b,M=[];if(typeof o!="string"||d.format==="math-json"){const N=window.MathfieldElement.computeEngine;if(!N)return["math-json",[]];[b,o]=["latex",N.box(o).latex],M=vs(o,{context:r.mathfield.context})}else typeof o=="string"&&d.format==="ascii-math"?([b,o]=qc(o,{format:"ascii-math",inlineShortcuts:r.mathfield.options.inlineShortcuts}),M=vs(o,{context:r.mathfield.context}),b!=="latex"&&r.mathfield.options.removeExtraneousParentheses&&iv(M)):(d.format==="auto"||(g=d.format)!=null&&g.startsWith("latex"))&&(d.format==="auto"&&([b,o]=qc(o,{format:"auto",inlineShortcuts:r.mathfield.options.inlineShortcuts})),d.format==="latex"&&([,o]=sh(o)),M=vs(o,{context:r.mathfield.context,args:u}),d.format!=="latex"&&r.mathfield.options.removeExtraneousParentheses&&iv(M));return us(M,d.style),[b!=null?b:"latex",M]}function gy(r){if(!r||(console.assert(r[0].type==="first"),r.length>1))return null;const o=r[0];return o instanceof Kr&&o.leftDelim==="("&&o.rightDelim===")"?o.removeBranch("body"):null}function iv(r){if(r){for(let o=0;r[o];o++){const u=r[o];if(u instanceof Kr&&u.leftDelim==="("){let d=0,g=0,b=0;for(let M=0;u.body[M];M++)u.body[M].type==="genfrac"&&(d++,g=M),b++;b===0&&d===1&&(r[o]=u.body[g])}}for(const o of r){for(const u of o.branches)if(!o.hasEmptyBranch(u)){iv(o.branch(u));const d=gy(o.branch(u));d&&o.setChildren(d,u)}if(o instanceof rr)for(const u of o.cells)iv(u)}}}function mx(r){let o=r.at(r.position);if(o.mode==="text"){for(;!o.isFirstSibling&&o.mode==="text";)o=o.leftSibling;return r.offsetOf(o)}const u=o;let d=!1;if(o.type==="mclose"){const g=y[o.value];for(;!o.isFirstSibling&&!(o.type==="mopen"&&o.value===g);)o=o.leftSibling;o.isFirstSibling||(o=o.leftSibling),d=!0}else o.type==="leftright"&&(o=o.leftSibling,d=!0);if(d)for(;!o.isFirstSibling&&(o.isFunction||vy(o));)o=o.leftSibling;else{const g=[];for(;!o.isFirstSibling&&(vy(o)||g.length>0);)o.type==="mclose"&&g.unshift(o.value),o.type==="mopen"&&g.length>0&&o.value===y[g[0]]&&g.shift(),o=o.leftSibling}return u===o?-1:r.offsetOf(o)}function vy(r){return r.isDigit()?!0:r.type&&/^(mord|surd|subsup|leftright|mop|mclose)$/.test(r.type)?!r.isExtensibleSymbol:!1}new cp;var ea=class extends Bn{constructor(){super("text")}onPaste(r,o){if(!o)return!1;const u=typeof o=="string"?o:o.getData("text/plain");return u&&r.model.contentWillChange({inputType:"insertFromPaste",data:u})?(r.stopCoalescingUndo(),r.stopRecording(),this.insert(r.model,u)&&(r.model.contentDidChange({inputType:"insertFromPaste"}),r.startRecording(),r.snapshot("paste"),ls(r)),r.startRecording(),!0):!1}insert(r,o,u={}){if(!r.contentWillChange({data:o,inputType:"insertText"}))return!1;u.insertionMode||(u.insertionMode="replaceSelection"),u.selectionMode||(u.selectionMode="placeholder"),u.format||(u.format="auto");const{silenceNotifications:d}=r;u.silenceNotifications&&(r.silenceNotifications=!0);const g=r.silenceNotifications;r.silenceNotifications=!0,u.insertionMode==="replaceSelection"&&!r.selectionIsCollapsed?r.deleteAtoms(Yo(r.selection)):u.insertionMode==="replaceAll"?(r.root.setChildren([],"body"),r.position=0):u.insertionMode==="insertBefore"?r.collapseSelection("backward"):u.insertionMode==="insertAfter"&&r.collapseSelection("forward");const b=Qa(o,r.mathfield.context);if(us(b,u.style),!b)return!1;const M=r.at(r.position),N=M.parent.addChildrenAfter(b,M);return r.silenceNotifications=g,u.selectionMode==="before"||(u.selectionMode==="item"?r.setSelection(r.anchor,r.offsetOf(N)):N&&(r.position=r.offsetOf(N))),r.contentDidChange({data:o,inputType:"insertText"}),r.silenceNotifications=d,!0}};function Qa(r,o){return r=r.replace(/\\/g,"\\textbackslash "),r=r.replace(/#/g,"\\#"),r=r.replace(/\$/g,"\\$"),r=r.replace(/%/g,"\\%"),r=r.replace(/&/g,"\\&"),r=r.replace(/_/g,"\\_"),r=r.replace(/{/g,"\\textbraceleft "),r=r.replace(/}/g,"\\textbraceright "),r=r.replace(/lbrace/g,"\\textbraceleft "),r=r.replace(/rbrace/g,"\\textbraceright "),r=r.replace(/\^/g,"\\textasciicircum "),r=r.replace(/~/g,"\\textasciitilde "),r=r.replace(/£/g,"\\textsterling "),vs(r,{context:o,parseMode:"text"})}new ea;function $a(r){return{value:r.model.getValue(),selectionIsCollapsed:r.model.selectionIsCollapsed,canUndo:r.canUndo(),canRedo:r.canRedo(),style:r.selectionStyle,mode:r.model.mode}}var yo=4,Ka=20,Es=2*(Ka+yo),dp=(r,o)=>`
<line x1="${r+Ka}" y1="${o+Ka}"
x2="${r>o?r+Ka:7*Ka+10*yo}"
y2="${r<o?o+Ka:7*Ka+10*yo}"/>
<svg id="plus" viewBox="0 0 40 40" x="${r}" y="${o}" width="40" height="40">
<circle class="cls-2" cx="20" cy="20" r="20"/>
<path class="font" d="m33.33,20c0,1.84-1.49,3.34-3.33,3.34h-6.67v6.66c0,1.84-1.49,3.34-3.33,3.34s-3.34-1.5-3.34-3.34v-6.66h-6.66c-1.84,0-3.34-1.5-3.34-3.34s1.5-3.33,3.34-3.33h6.66v-6.67c0-1.84,1.5-3.33,3.34-3.33s3.33,1.49,3.33,3.33v6.67h6.67c1.84,0,3.33,1.49,3.33,3.33Z"/>
</svg>`,y0=(r,o)=>`
<line x1="${r+Ka}" y1="${o+Ka}"
x2="${r>o?r+Ka:7*Ka+10*yo}"
y2="${r<o?o+Ka:7*Ka+10*yo}"/>
<svg id="minus" viewBox="0 0 40 40" x="${r}" y="${o}" width="40" height="40">
<circle class="cls-2" cx="20" cy="20" r="20"/>
<path class="font" d="m33.33,20c0,1.84-1.49,3.33-3.33,3.33H10c-1.84,0-3.34-1.49-3.34-3.33s1.5-3.34,3.34-3.34h20c1.84,0,3.33,1.5,3.33,3.34Z"/>
</svg>`,lf=(r,o,u)=>`
<svg id="arrow" viewBox="0 0 40 40" x="${r}" y="${o}" width="40" height="40">
<circle class="cls-2" cx="20" cy="20" r="20"/>
<g transform="rotate(${u})" transform-origin="20 20">
<path class="font" d="m17.7,7.23h4.6c.52,0,.94.42.94.94v13.82c0,.52.42.94.94.94h3.39c.83,0,1.25,1.01.66,1.6l-7.56,7.56c-.37.37-.96.37-1.32,0l-7.56-7.56c-.59-.59-.17-1.6.66-1.6h3.39c.52,0,.94-.42.94-.94v-13.82c0-.52.42-.94.94-.94Z"/>
</g>
</svg>`,zm=`
<svg class="MLEP__array-buttons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox=
"-2 -2 ${8*Ka+10*yo+5} ${8*Ka+10*yo+5}">
<rect
class="MLEP__array-insert-background rows"
x="0"
y="${Es+yo}"
height="${3*Es}"
width="${Es}"
rx="${Es/2}"/>
<rect
class="MLEP__array-insert-background columns"
x="${Es+yo}"
y="0"
height="${Es}"
width="${3*Es}"
rx="${Es/2}"/>
<g data-command='"moveDown"'>
${lf(2*(yo+Es),2*yo+3*Es,0)}
</g>
<g data-command='"moveUp"'>
${lf(2*(yo+Es),2*yo+Es,180)}
</g>
<g data-command='"moveToNextWord"'>
${lf(2*yo+3*Es,2*(yo+Es),-90)}
</g>
<g data-command='"moveToPreviousWord"'>
${lf(2*yo+Es,2*(yo+Es),90)}
</g>
<g>
<g data-command='"addColumnBefore"'>
${dp(2*yo+Es,yo)}
</g>
<g data-command='"removeColumn"'>
${y0(2*yo+2*Es,yo)}
</g>
<g data-command='"addColumnAfter"'>
${dp(2*yo+3*Es,yo)}
</g>
<g data-command='"addRowBefore"'>
${dp(yo,2*yo+Es)}
</g>
<g data-command='"removeRow"'>
${y0(yo,2*yo+2*Es)}
</g>
<g data-command='"addRowAfter"'>
${dp(yo,2*yo+3*Es)}
</g>
</svg>`,yy=r=>`
<svg id="matrix" class="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","matrix"]'>
<rect class="cls-1" width="28" height="24"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/></svg>`,nv=r=>`
<svg id="pmatrix" class="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","pmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m6,4c-3.96,4.6-3.96,11.4,0,16"/>
<path class="cls-2" d="m22,4c3.96,4.6,3.96,11.4,0,16"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/></svg>`,x0=r=>`
<svg id="Bmatrix" class="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","Bmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m6,4c-1.1,0-2,.9-2,2v3c0,1.66-.9,3-2,3,1.1,0,2,1.34,2,3v3c0,1.1.9,2,2,2"/>
<path class="cls-2" d="m22,4c1.1,0,2,.9,2,2v3c0,1.66.9,3,2,3-1.1,0-2,1.34-2,3v3c0,1.1-.9,2-2,2"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
</svg>`,jm=r=>`
<svg id="bmatrix" class="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","bmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m6,4h-3v16h3"/>
<path class="cls-2" d="m22,4h3v16h-3"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
</svg>`,rv=r=>`
<svg id="vmatrix" class="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","vmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
<line class="cls-2" x1="4" y1="4" x2="4" y2="20"/>
<line class="cls-2" x1="24" y1="4" x2="24" y2="20"/>
</svg>`,x1=r=>`
<svg id="Vmatrix" class="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="-3.5 -3 35 30"
data-command='["setEnvironment","Vmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
<line class="cls-2" x1="6" y1="4" x2="6" y2="20"/>
<line class="cls-2" x1="22" y1="4" x2="22" y2="20"/>
<line class="cls-2" x1="2" y1="4" x2="2" y2="20"/>
<line class="cls-2" x1="26" y1="4" x2="26" y2="20"/>
</svg>`,w1=r=>`
<svg id="cases" class="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","cases"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m10,4c-1.1,0-2,.9-2,2v3c0,1.66-.9,3-2,3,1.1,0,2,1.34,2,3v3c0,1.1.9,2,2,2"/>
<circle cx="13" cy="8" r="1"/>
<circle cx="13" cy="16" r="1"/>
<circle cx="21" cy="8" r="1"/>
<circle cx="21" cy="16" r="1"/>
</svg>`,$m=r=>`
<svg id="rcases" class="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","rcases"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m18,20c1.1,0,2-.9,2-2v-3c0-1.66.9-3,2-3-1.1,0-2-1.34-2-3v-3c0-1.1-.9-2-2-2"/>
<circle cx="15" cy="8" r="1"/>
<circle cx="15" cy="16" r="1"/>
<circle cx="7" cy="8" r="1"/>
<circle cx="7" cy="16" r="1"/>
</svg>`,w0={matrix:yy,pmatrix:nv,bmatrix:jm,Bmatrix:x0,vmatrix:rv,Vmatrix:x1},fp={cases:w1,rcases:$m,Bmatrix:x0};function b0(r){var o,u;const d=(o=r.model.parentEnvironment)==null?void 0:o.array;if(!d)return;let g=0;d.forEach(zt=>{(!g||zt.length>g)&&(g=zt.length)});let b=document.getElementById("mathlive-environment-popover");b||(b=n0("mathlive-environment-popover"),Hl("environment-popover"),Hl("core"),b.setAttribute("aria-hidden","true"));let M;const N=b.querySelector(".MLEP__environment-controls");N?M=N:(M=document.createElement("div"),b.innerHTML="",b.appendChild(M)),M.className="MLEP__environment-controls",M.style.display="flex",M.style.width="100%",M.style.height="100%",M.style.boxSizing="border-box",M.innerHTML=zm;let I=[],F="";const $=r.model.parentEnvironment.environmentName;if(za($)){const zt=ov($);F=w0[zt]("active");const Ne=w0,{[zt]:Bi}=Ne,Ee=be(Ne,[yt(zt)]);I=Object.values(Ee).map(hi=>hi("inactive"))}else if(ka($)){const zt=sv($);F=fp[zt]("active");const Ne=fp,{[zt]:Bi}=Ne,Ee=be(Ne,[yt(zt)]);I=Object.values(Ee).map(hi=>hi("inactive"))}else Os($)&&(F=w0.matrix("active"),I=Object.values(fp).map(zt=>zt("inactive")));const it=document.createElement("div");it.className="MLEP__environment-delimiter-controls",it.style.display="flex",it.style.flexDirection="column",it.innerHTML=`
<div class='MLEP__array-delimiter-options'>
${F}
${I.join("")}
</div>`,F&&M.appendChild(it),M.querySelectorAll("[data-command]").forEach(zt=>{const Ne=zt.dataset.command;let Bi=Ne;try{Bi=JSON.parse(Ne)}catch(Ee){}zt.addEventListener("mousedown",Ee=>Ee.preventDefault()),Bi&&zt.addEventListener("click",()=>r.executeCommand(Bi))});const _t=(u=r.field)==null?void 0:u.getBoundingClientRect();_t&&(b.style.top=`${window.scrollY+(_t.top-b.clientHeight-15)}px`,b.style.left=`${_t.left+20}px`,b.classList.add("is-visible"))}function cu(){const r=document.getElementById("mathlive-environment-popover");r==null||r.classList.remove("is-visible")}function b1(){document.getElementById("mathlive-environment-popover")&&(ym("mathlive-environment-popover"),h("environment-popover"),h("core"))}function Gl(r){if(!r.hasFocus())return;let o=!1;if(r.model.mode==="math"){const u=r.model.parentEnvironment;if(u!=null&&u.array&&qo(u.environmentName)){const d=r.options.environmentPopoverPolicy;o=d==="auto"||d==="on"}}o?b0(r):cu()}function ov(r){return r.replace("*","")}function sv(r){return r==="dcases"?"cases":r}function xy(r){const o=getComputedStyle(r).direction;return o==="ltr"||o==="rtl"?o:"ltr"}function wy(r,o,u){return o==="left"||o==="leading"&&u==="ltr"||o==="trailing"&&u==="rtl"?r.left:r.right}function fh(r,o,u,d){return u==="middle"?r-o/2:u==="start"&&d==="rtl"||u==="end"&&d==="ltr"||u==="top"||u==="right"?Math.max(0,r-o):r}function uf(r,o,u,d){return u==="middle"?r-o/2:u==="start"&&d==="ltr"||u==="end"&&d==="rtl"||u==="top"||u==="right"?r:r-o}function S0(r,o){var u,d,g;const b=(u=xy(r))!=null?u:"ltr";r.style.position="fixed",r.style.left="",r.style.top="",r.style.right="",r.style.bottom="",r.style.height="",r.style.width="";const M=r.getBoundingClientRect(),N=Number.isFinite(o.maxHeight)?Math.min(o.maxHeight,window.innerHeight):window.innerHeight;let I=Math.min(N,(d=o.height)!=null?d:M.height),F=fh(o.location.y,I,o.verticalPos,b);F+I>window.innerHeight-8&&(o.alternateLocation?(F=fh(o.alternateLocation.y,I,o.verticalPos,b),F+I>window.innerHeight-8&&(F=void 0)):F=void 0),Number.isFinite(F)||(F=Math.max(8,window.innerHeight-8-I),8+I>window.innerHeight-8&&(r.style.bottom="8px")),I=Math.min(F+I,window.innerHeight-8)-F;const $=Number.isFinite(o.maxWidth)?Math.min(o.maxWidth,window.innerWidth):window.innerWidth;let it=Math.min($,(g=o.width)!=null?g:M.width),gt=fh(o.location.x,it,o.horizontalPos,b);gt+it>window.innerWidth-8&&(o.alternateLocation?(gt=uf(o.alternateLocation.x,it,o.verticalPos,b),gt+it>window.innerWidth-8&&(gt=void 0)):gt=void 0),Number.isFinite(gt)||(gt=Math.max(8,window.innerWidth-8-it),8+it>window.innerWidth-8&&(r.style.right="8px")),it=Math.min(gt+it,window.innerWidth-8)-gt,b==="rtl"?r.style.right=`${Math.ceil(window.innerWidth-gt-it).toString()}px`:r.style.left=`${Math.ceil(gt).toString()}px`,r.style.top=`${Math.ceil(F).toString()}px`,I!==M.height&&(r.style.height=`${Math.ceil(I).toString()}px`),it!==M.width&&(r.style.width=`${Math.ceil(it).toString()}px`)}function by(r,o){return Math.hypot(o.x-r.x,o.y-r.y)}function hf(r){return"submenu"in r}function Nl(r){return"type"in r&&r.type==="command"||"onMenuSelect"in r||"id"in r}function Sy(r){return"type"in r&&r.type==="divider"}function av(r){return"type"in r&&r.type==="heading"}var lv={};function pr(r){let o=lv[r];if(!o){let u;switch(r){case"checkmark":u=`<span aria-hidden="true" class="ui-checkmark"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"></path></svg>
</span>`;break;case"trailing-chevron":u='<span aria-hidden="true" class="ui-trailing-chevron"><svg focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"></path></svg></span>';break;case"mixedmark":u='<span aria-hidden="true" class="ui-mixedmark"><svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 512 512"><path fill="currentColor" d="M0 256c0-13.3 10.7-24 24-24H488c13.3 0 24 10.7 24 24s-10.7 24-24 24H24c-13.3 0-24-10.7-24-24z"/></svg></span>'}if(u){const d=document.createElement("template");d.innerHTML=u,lv[r]=d,o=d}}if(o){if("content"in o)return o.content.cloneNode(!0);const u=document.createElement("svg");return u.innerHTML=o.innerHTML,u}}var Lc=80,M0=class{constructor(r,o){this._element=null;var u;this.parentMenu=o,this._declaration=r,hf(r)?(this.type="submenu",this.submenu=new uv(r.submenu,{parentMenu:o,submenuClass:r.submenuClass,columnCount:r.columnCount})):this.type=(u=r.type)!=null?u:"command",this.hasCheck=Nl(r)&&r.checked!==void 0}get rootMenu(){return this.parentMenu.rootMenu}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}dispose(){var r,o;(r=this._abortController)==null||r.abort(),this._abortController=void 0,(o=this._element)==null||o.remove(),this._element=null,this.submenu&&this.submenu.dispose(),this.submenu=void 0}get menuItem(){return this._declaration}get label(){var r;return(r=this._label)!=null?r:""}set label(r){r===void 0&&(r=""),r!==this._label&&(this._label=r,this.dirty=!0)}get visible(){return this._visible}set visible(r){r!==this._visible&&(this._visible=r,this.dirty=!0)}get enabled(){return this._enabled}set enabled(r){this._enabled=r,this.element&&(r?this.element.removeAttribute("aria-disabled"):this.element.setAttribute("aria-disabled","true")),this.dirty=!0}get checked(){return this._checked}set checked(r){this._checked=r,this.dirty=!0}get tooltip(){return this._tooltip}set tooltip(r){r!==this._tooltip&&(this._tooltip=r,this.dirty=!0)}get ariaLabel(){return this._ariaLabel}set ariaLabel(r){r!==this._ariaLabel&&(this._ariaLabel=r,this.dirty=!0)}get active(){var r,o;return(o=(r=this.element)==null?void 0:r.classList.contains("active"))!=null?o:!1}set active(r){this.element&&this.element.classList.toggle("active",r)}updateState(r){var o,u,d;const g=this._declaration;if(Sy(g)){this.enabled=!1,this.checked=!1;return}av(g)&&(this.enabled=!1,this.checked=!1,this.visible=!0),Nl(g)&&(this.checked=Nl(g)&&((o=pp(g.checked,r))!=null?o:!1)),(Nl(g)||hf(g))&&(this.enabled=(u=pp(g.enabled,r))!=null?u:!0,this.visible=(d=pp(g.visible,r))!=null?d:!0,this.visible&&this.enabled&&this.submenu&&(this.submenu.updateState(r),this.submenu.visible||(this.visible=!1))),(Nl(g)||av(g)||hf(g))&&(this.label=pp(g.label,r),this.tooltip=pp(g.tooltip,r),this.ariaLabel=pp(g.ariaLabel,r)),this._element&&this.updateElement()}set dirty(r){console.assert(r===!0),r&&this.parentMenu&&(this.parentMenu.dirty=!0)}updateElement(){if(!this.visible||!this.element)return;const r=this.element;r.textContent="",this.enabled?r.removeAttribute("aria-disabled"):r.setAttribute("aria-disabled","true"),this.checked===!0?(r.setAttribute("aria-checked","true"),r.append(pr("checkmark"))):this.checked==="mixed"?(r.setAttribute("aria-checked","mixed"),r.append(pr("mixedmark"))):r.removeAttribute("aria-checked"),this.ariaLabel&&r.setAttribute("aria-label",this.ariaLabel);const o=document.createElement("span");if(o.className=this.parentMenu.hasCheck?"label indent":"label",this.type==="heading"&&o.classList.add("heading"),o.innerHTML=this.label,r.append(o),this._tooltip&&r.setAttribute("data-tooltip",this._tooltip),Nl(this._declaration)&&this._declaration.keyboardShortcut){const u=document.createElement("kbd");u.innerHTML=pm(this._declaration.keyboardShortcut),r.append(u)}this.type==="submenu"&&r.append(pr("trailing-chevron"))}get element(){if(this._element)return this._element;if(Sy(this._declaration)){const u=document.createElement("li");return u.setAttribute("part","menu-divider"),u.setAttribute("role","divider"),this._element=u,u}const r=document.createElement("li");this._element=r,(Nl(this._declaration)||av(this._declaration)||hf(this._declaration))&&this._declaration.class&&(r.className=this._declaration.class),r.setAttribute("part","menu-item"),r.setAttribute("tabindex","-1"),this.hasCheck?r.setAttribute("role","menuitemcheckbox"):r.setAttribute("role","menuitem"),this.type==="submenu"&&(r.setAttribute("aria-haspopup","true"),r.setAttribute("aria-expanded","false"));const o=this.abortController.signal;return r.addEventListener("pointerenter",this,{signal:o}),r.addEventListener("pointerleave",this,{signal:o}),r.addEventListener("pointerup",this,{signal:o}),r.addEventListener("click",this,{signal:o}),this._element}dispatchSelect(){if(!Nl(this._declaration))return;const r=new CustomEvent("menu-select",{cancelable:!0,bubbles:!0,detail:{modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data}});this.parentMenu.dispatchEvent(r)&&typeof this._declaration.onMenuSelect=="function"&&this._declaration.onMenuSelect({modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data})}handleEvent(r){var o;if(!(!this.visible||!this.enabled)){if(r.type==="click"){this.rootMenu.state==="modal"&&this.select(),r.stopPropagation(),r.preventDefault();return}if(r.type==="pointerenter"){const u=r;this.rootMenu.cancelDelayedOperation(),this.parentMenu.isSubmenuOpen&&((o=this.parentMenu.activeMenuItem)!=null&&o.movingTowardSubmenu(u))?this.rootMenu.scheduleOperation(()=>{this.parentMenu.activeMenuItem=this,this.openSubmenu()}):(this.parentMenu.activeMenuItem=this,this.openSubmenu({withDelay:!0}));return}if(r.type==="pointerleave"){this.rootMenu.activeSubmenu===this.parentMenu&&(this.parentMenu.activeMenuItem=null);return}if(r.type==="pointerup"){this.rootMenu.state!=="modal"&&this.select(),r.stopPropagation(),r.preventDefault();return}}}select(){if(this.rootMenu.cancelDelayedOperation(),this.type==="submenu"){this.openSubmenu();return}this.active=!1,setTimeout(()=>{this.active=!0,setTimeout(()=>{this.rootMenu.hide(),this.dispatchSelect()},Lc)},Lc)}openSubmenu(r){var o;if(this.type!=="submenu"||!this.element)return;if((o=r==null?void 0:r.withDelay)!=null&&o){this.rootMenu.scheduleOperation(()=>this.openSubmenu());return}const u=this.element.getBoundingClientRect(),d=xy(this.element);this.submenu.show({container:this.rootMenu.element.parentNode,location:{x:wy(u,"trailing",d),y:u.top-4},alternateLocation:{x:wy(u,"leading",d),y:u.top-4}})}movingTowardSubmenu(r){if(!this.element||this.type!=="submenu")return!1;const o=this.rootMenu.lastMoveEvent;if(!o)return!1;const u=r.timeStamp-o.timeStamp;if(u>500)return!1;const d=r.clientX-o.clientX;if(nr(d,o.clientY-r.clientY,u)<=.2)return!1;let b="right";if(this.submenu.element){const M=this.submenu.element.getBoundingClientRect(),N=this.element.getBoundingClientRect();M.left<N.left+N.width/2&&(b="left")}return b==="right"?d>0:d<0}};function nr(r,o,u){return Math.hypot(r,o)/u}function pp(r,o){return r===void 0||typeof r!="function"?r:(o!=null||(o={alt:!1,control:!1,shift:!1,meta:!1}),r(o))}var uv=class Fv{constructor(o,u){this._element=null,this._activeMenuItem=null,this._dirty=!0;var d,g;this.parentMenu=(d=u==null?void 0:u.parentMenu)!=null?d:null,this._submenuClass=u==null?void 0:u.submenuClass,this.columnCount=(g=u==null?void 0:u.columnCount)!=null?g:1,this.isSubmenuOpen=!1,this.menuItems=o}get children(){return this._menuItems}set menuItems(o){const u=this.parentMenu;this.dispose(),this.parentMenu=u,o=[...o],this._menuItems=o.map(d=>d.onCreate?d.onCreate(d,this):new M0(d,this)),this.hasCheck=void 0,this.dirty=!0}dispose(){var o;this.hide(),this._element&&this._element.remove(),this._abortController&&this._abortController.abort(),(o=this._menuItems)==null||o.forEach(u=>u.dispose()),this._menuItems=[],this._activeMenuItem=null,this.parentMenu=null}handleEvent(o){if(o.type==="wheel"&&this._element){const u=o;this._element.scrollBy(0,u.deltaY),o.stopPropagation()}}dispatchEvent(o){return this.rootMenu.dispatchEvent(o)}get rootMenu(){return this.parentMenu.rootMenu}updateState(o){var u,d,g;this._menuItems.forEach(F=>F.updateState(o));const b=this.hasCheck;this.hasCheck=this._menuItems.some(F=>F.visible&&F.hasCheck),this.hasCheck!==b&&this._menuItems.forEach(F=>F.updateState(o));let M,N=0;for(const F of this._menuItems)F.type==="heading"?(M&&N===0&&(M.visible=!1),M=F,N=0):F.type==="divider"&&M?(M.visible=N>0,M=void 0,N=0):M&&F.visible&&(N+=1);M&&(M.visible=N>0);let I=!0;for(const F of this._menuItems)F.type==="divider"?(F.visible=!I,I=!0):F.visible&&(I=!1);(u=this.activeMenuItem)!=null&&u.visible||(this.activeMenuItem=null),!((d=this.activeMenuItem)!=null&&d.enabled)&&((g=this.activeMenuItem)==null?void 0:g.type)==="submenu"&&this._activeMenuItem.submenu.hide(),this._dirty=!1}get enabled(){return this.updateIfDirty(),this._menuItems.some(o=>o.type!=="divider"&&o.visible&&o.enabled)}get visible(){return this.updateIfDirty(),this._menuItems.some(o=>o.type!=="divider"&&o.visible)}set dirty(o){console.assert(o===!0),this._dirty!==o&&o&&this.parentMenu&&(this._dirty=!0,this.parentMenu.dirty=!0)}updateIfDirty(){this._dirty&&this.updateState(this.rootMenu.modifiers)}updateElement(){var o;if(this._element){this._element.textContent="";for(const{element:u,visible:d}of this._menuItems)u&&d&&this._element.append(u);(o=this._element.querySelector("li:first-of-type"))==null||o.setAttribute("tabindex","0")}}get element(){if(this._element)return this._element;const o=document.createElement("menu");o.setAttribute("role","menu"),o.setAttribute("tabindex","-1"),o.setAttribute("aria-orientation","vertical"),o.setAttribute("part","ui-menu-container"),this._submenuClass&&o.classList.add(this._submenuClass),o.classList.add("ui-menu-container"),this._abortController||(this._abortController=new AbortController);const u=this._abortController.signal;return o.addEventListener("focus",this,{signal:u}),o.addEventListener("wheel",this,{passive:!0,signal:u}),this._element=o,this.updateElement(),o}get activeMenuItem(){return this._activeMenuItem}set activeMenuItem(o){var u,d,g,b;if(this.rootMenu.cancelDelayedOperation(),o!==this._activeMenuItem){if(this.activeMenuItem){const M=this.activeMenuItem;M.active=!1,(u=M.submenu)==null||u.hide()}if(!((d=o==null?void 0:o.visible)==null||d)){this._activeMenuItem=null;return}this._activeMenuItem=o,o&&(o.active=!0)}o?(g=o.element)==null||g.focus({preventScroll:!0}):(b=this._element)==null||b.focus({preventScroll:!0})}get firstMenuItem(){this.updateIfDirty();let o=0,u=!1;const d=this._menuItems;for(;!u&&o<=d.length-1;){const g=d[o];u=g.type!=="divider"&&g.visible&&g.enabled,o+=1}return u?d[o-1]:null}get lastMenuItem(){this.updateIfDirty();const o=this._menuItems;let u=o.length-1,d=!1;for(;!d&&u>=0;){const g=o[u];d=g.type!=="divider"&&g.visible&&g.enabled,u-=1}return d?o[u+1]:null}nextMenuItem(o){if(o===0)return this._activeMenuItem;if(!this._activeMenuItem)return o>0?this.firstMenuItem:this.lastMenuItem;if(!this.firstMenuItem||!this.lastMenuItem||!this._activeMenuItem)return null;this.updateIfDirty();const u=this._menuItems.indexOf(this.firstMenuItem),d=this._menuItems.indexOf(this.lastMenuItem);let g=this._menuItems.indexOf(this._activeMenuItem),b=1;for(;g>=u&&g<=d;){g+=o>0?1:-1;const M=this._menuItems[g];if(!M)break;if(M.visible&&M.enabled){if(b===Math.abs(o))return this._menuItems[g];b+=1}}return o>0?this.lastMenuItem:this.firstMenuItem}getMenuItemColumn(o){this.updateIfDirty();const d=this._menuItems.filter(g=>g.visible&&g.enabled).indexOf(o);return d<0?-1:d%this.columnCount}static get collator(){return Fv._collator||(Fv._collator=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),Fv._collator}findMenuItem(o){var u;this.updateIfDirty();const d=this._menuItems.filter(N=>N.type!=="divider"&&N.visible&&N.enabled);if(d.length===0)return null;const g=Math.max(...d.map(N=>N.label.length))-o.length;if(g<0)return null;let b=null,M=0;for(;M<g&&!b;)b=(u=d.find(N=>Fv.collator.compare(o,N.label.substring(M,o.length))===0))!=null?u:null,M++;return b}show(o){return!this.visible||!o.container?!1:(this.updateElement(),o.container.appendChild(this.element),De()&&(this.element.popover="manual",this.element.showPopover()),o.location&&S0(this.element,{location:o.location,alternateLocation:o.alternateLocation,verticalPos:"bottom",horizontalPos:"start"}),this.element.focus({preventScroll:!0}),this.parentMenu&&(this.parentMenu.openSubmenu=this),!0)}hide(){var o,u,d,g,b;this.openSubmenu=null,this.activeMenuItem=null,this.parentMenu&&(this.parentMenu.openSubmenu=null),De()&&((o=this._element)!=null&&o.popover)&&this.element.hidePopover(),(d=(u=this.parentMenu)==null?void 0:u.element)==null||d.focus(),(b=(g=this._element)==null?void 0:g.parentNode)==null||b.removeChild(this._element)}set openSubmenu(o){var u,d,g,b;const M=o!==null;((u=this.activeMenuItem)==null?void 0:u.type)==="submenu"&&((d=this.activeMenuItem.element)==null||d.setAttribute("aria-expanded",M.toString())),(b=(g=this.activeMenuItem)==null?void 0:g.element)==null||b.classList.toggle("is-submenu-open",M),this.isSubmenuOpen=M}},hv=class z2 extends uv{constructor(o,u){var d;super(o),this.state="closed",this.typingBufferResetTimer=0,this.hysteresisTimer=0,this._updating=!1,this._host=(d=u==null?void 0:u.host)!=null?d:null,this.isDynamic=o.some(cv),this._modifiers={shift:!1,control:!1,alt:!1,meta:!1},this.typingBuffer="",this.state="closed"}get modifiers(){return this._modifiers}set modifiers(o){Qy(this._modifiers,o)||(this._modifiers=o,this.dirty=!0)}get activeSubmenu(){let o=this;for(;o.isSubmenuOpen;)o=o.activeMenuItem.submenu;return o}set dirty(o){this._updating||(console.assert(o===!0),this._dirty!==o&&(this._dirty=!0,o&&setTimeout(()=>{this.updateState(this.modifiers),this.updateElement()})))}updateState(o){this._updating=!0,this.modifiers=o!=null?o:this.modifiers,super.updateState(this.modifiers),this._updating=!1}handleKeyupEvent(o){this.isDynamic&&(this.modifiers=wc(o)),o.stopImmediatePropagation()}handleKeydownEvent(o){var u,d,g;if(o.key==="Tab"||o.key==="Escape"){this.hide();return}this.isDynamic&&(this.modifiers=wc(o));let b=!0;const M=this.activeSubmenu,N=M.activeMenuItem;switch(o.key){case" ":case"Space":case"Return":case"Enter":N==null||N.select(wc(o));break;case"ArrowRight":if((N==null?void 0:N.type)==="submenu")N.select(wc(o)),this.activeSubmenu.activeMenuItem=this.activeSubmenu.firstMenuItem;else if(!N)M.activeMenuItem=M.firstMenuItem;else{const I=(u=M.getMenuItemColumn(N))!=null?u:-1;if(I>=0&&I<((d=M.columnCount)!=null?d:1)-1){const F=M.nextMenuItem(1);F&&(M.activeMenuItem=F)}}break;case"ArrowLeft":if(M===this.rootMenu)N||(M.activeMenuItem=M.firstMenuItem);else if((N&&(g=M.getMenuItemColumn(N))!=null?g:-1)<=0||!N){M.hide();const F=M.parentMenu.activeMenuItem;if(F){const{element:$}=F;$==null||$.focus(),$==null||$.classList.remove("is-submenu-open")}}else{const F=M.nextMenuItem(-1);F&&(M.activeMenuItem=F)}break;case"ArrowDown":M.activeMenuItem=M.nextMenuItem(M.columnCount);break;case"ArrowUp":M.activeMenuItem=M.nextMenuItem(-M.columnCount);break;case"Home":case"PageUp":M.activeMenuItem=M.firstMenuItem;break;case"End":case"PageDown":M.activeMenuItem=M.lastMenuItem;break;case"Backspace":if(this.typingBuffer&&(this.typingBuffer=this.typingBuffer.slice(0,-1),this.typingBuffer)){clearTimeout(this.typingBufferResetTimer);const I=M.findMenuItem(this.typingBuffer);I&&(M.activeMenuItem=I),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}break;default:if(uu(o)){isFinite(this.typingBufferResetTimer)&&clearTimeout(this.typingBufferResetTimer),this.typingBuffer+=o.key;const I=M.findMenuItem(this.typingBuffer);I&&(M.activeMenuItem=I),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}else b=!1}b&&(o.preventDefault(),o.stopPropagation())}handleEvent(o){if(o.type==="keydown")this.handleKeydownEvent(o);else if(o.type==="keyup")this.handleKeyupEvent(o);else if(o.type==="pointermove")this.lastMoveEvent=o;else if(o.type==="pointerup"&&o.target===this.scrim)Number.isFinite(this.rootMenu._openTimestamp)&&Date.now()-this.rootMenu._openTimestamp<120?this.state="modal":this.state==="modal"&&this.hide();else if(o.type==="contextmenu"){o.preventDefault(),o.stopPropagation();return}super.handleEvent(o)}dispatchEvent(o){return this._host?this._host.dispatchEvent(o):!0}get scrim(){return Vh.element}connectScrim(o){const u=this.scrim;u.addEventListener("pointerup",this),u.addEventListener("contextmenu",this),u.addEventListener("keydown",this),u.addEventListener("keyup",this),u.addEventListener("pointermove",this),Vh.open({root:o,onDismiss:()=>this.hide()})}disconnectScrim(){const o=this.scrim;o.removeEventListener("pointerup",this),o.removeEventListener("contextmenu",this),o.removeEventListener("keydown",this),o.removeEventListener("keyup",this),o.removeEventListener("pointermove",this),Vh.state==="open"&&Vh.scrim.close()}get rootMenu(){return this}show(o){return this._onDismiss=o==null?void 0:o.onDismiss,o!=null&&o.modifiers&&(this.modifiers=o.modifiers),this.updateState(),this.connectScrim(o==null?void 0:o.target),super.show(rt(Q({},o),{container:this.scrim}))?(this._openTimestamp=Date.now(),this.state="open",!0):(this.disconnectScrim(),!1)}hide(){this.cancelDelayedOperation(),this.state!==void 0&&(this.state!=="closed"&&(this.activeMenuItem=null,Vh.element.parentElement.focus(),super.hide(),this.state="closed",this.disconnectScrim()),this._onDismiss&&(this._onDismiss(),this._onDismiss=void 0))}scheduleOperation(o){this.cancelDelayedOperation();const u=z2.SUBMENU_DELAY;if(u<=0){o();return}this.hysteresisTimer=setTimeout(()=>{this.hysteresisTimer=0,o()},u)}cancelDelayedOperation(){this.hysteresisTimer&&(clearTimeout(this.hysteresisTimer),this.hysteresisTimer=0)}};hv.SUBMENU_DELAY=120;var gx=hv;function cv(r){return Sy(r)?!1:typeof r.label=="function"||typeof r.ariaLabel=="function"||typeof r.tooltip=="function"||(Nl(r)||hf(r))&&(typeof r.enabled=="function"||typeof r.visible=="function")||Nl(r)&&typeof r.checked=="function"?!0:hf(r)?r.submenu.some(cv):!1}var lo=class{};lo.DELAY=300,lo.MAX_DISTANCE=10;function My(r){return new Promise((o,u)=>{const d=mm(r);d||o(!1);let g=d;const b=setTimeout(()=>{M.abort(),o(by(g,d)<lo.MAX_DISTANCE)},lo.DELAY),M=new AbortController,N=M.signal;for(const I of["pointermove","pointerup","pointercancel"])window.addEventListener(I,F=>{if(F.type==="pointerup"||F.type==="pointercancel")clearTimeout(b),M.abort(),o(!1);else if(F.type==="pointermove"){const $=mm(F);$&&(g=$)}},{passive:!0,signal:N})})}function Na(r,o,u){return $0(this,null,function*(){if(r.type==="contextmenu"){const d=r;if(u.show({target:o,location:mm(d),modifiers:wc(d)}))return r.preventDefault(),r.stopPropagation(),!0}if(r.type==="keydown"){const d=r;if(d.code==="ContextMenu"||d.code==="F10"&&d.shiftKey){const g=o==null?void 0:o.getBoundingClientRect();if(g&&u.show({target:o,location:{x:Math.ceil(g.left+g.width/2),y:Math.ceil(g.top+g.height/2)},modifiers:wc(d)}))return r.preventDefault(),r.stopPropagation(),!0}}if(r.type==="pointerdown"&&r.pointerType!=="mouse"&&r.button===0){let d=r.target;for(;d&&o!==d;)d=d.parentNode;if(!d||!u.visible)return!1;const g=mm(r);if(yield My(r))return u.state!=="closed"?!1:(u.show({target:o,location:g}),!0)}return!1})}var es={acute:714,grave:715,dot:729,ddot:168,mathring:730,tilde:126,bar:713,breve:728,check:711,hat:94,vec:8407};qt(Object.keys(es),"{body:auto}",{createAtom:r=>new p(rt(Q({},r),{body:se(r.args[0]),accentChar:es[r.command.slice(1)]}))}),qt(["widehat","widecheck","widetilde"],"{body:auto}",{createAtom:r=>{const o=Si(se(r.args[0]));return new p(rt(Q({},r),{body:se(r.args[0]),svgAccent:r.command.slice(1)+(o.length>5?"4":["1","1","2","2","3","3"][o.length])}))}}),qt(["overarc","overparen","wideparen"],"{body:auto}",{createAtom:r=>new p(rt(Q({},r),{body:se(r.args[0]),svgAccent:"overarc"}))}),qt(["underarc","underparen"],"{body:auto}",{createAtom:r=>new au(rt(Q({},r),{body:se(r.args[0]),svgBelow:"underarc"}))}),qt("utilde","{body:auto}",{createAtom:r=>{const o=se(r.args[0]),u=Si(o),d="widetilde"+(u.length>5?"4":["1","1","2","2","3","3"][u.length]);return new au(rt(Q({},r),{body:o,svgBelow:d,boxType:Ad(o)}))}}),qt("^","{:string}",{createAtom:r=>{var o;return new oi(rt(Q({},r),{type:"mord",isFunction:!1,limits:"adjacent",value:r.args[0]&&(o={a:"\xE2",e:"\xEA",i:"\xEE",o:"\xF4",u:"\xFB",A:"\xC2",E:"\xCA",I:"\xCE",O:"\xD4",U:"\xDB"}[r.args[0]])!=null?o:"^"}))}}),qt("`","{:string}",{createAtom:r=>{var o;return new oi(rt(Q({},r),{type:"mord",isFunction:!1,limits:"adjacent",value:r.args[0]&&(o={a:"\xE0",e:"\xE8",i:"\xEC",o:"\xF2",u:"\xF9",A:"\xC0",E:"\xC8",I:"\xCC",O:"\xD2",U:"\xD9"}[r.args[0]])!=null?o:"`"}))}}),qt("'","{:string}",{createAtom:r=>{var o;return new oi(rt(Q({},r),{type:"mord",isFunction:!1,limits:"adjacent",value:r.args[0]&&(o={a:"\xE1",e:"\xE9",i:"\xED",o:"\xF3",u:"\xFA",A:"\xC1",E:"\xC9",I:"\xCD",O:"\xD3",U:"\xDA"}[r.args[0]])!=null?o:"'"}))}}),qt('"',"{:string}",{createAtom:r=>{var o,u;return new oi(rt(Q({},r),{type:"mord",isFunction:!1,limits:"adjacent",value:(o=r.args)!=null&&o[0]?(u={a:"\xE4",e:"\xEB",i:"\xEF",o:"\xF6",u:"\xFC",A:"\xC4",E:"\xCB",I:"\xCB",O:"\xD6",U:"\xDC"}[r.args[0]])!=null?u:'"'+r.args[0]:'"'}))}}),qt(".","{:string}",{createAtom:r=>{var o,u;return new oi(rt(Q({},r),{type:"mord",isFunction:!1,limits:"adjacent",value:(o=r.args)!=null&&o[0]?(u={a:"\u0227",e:"\u0117",i:"\u0307i",o:"\u022F",u:"\u0307u",A:"\u0226",E:"\u0116",I:"\u0130",O:"\u022E",U:"\u0307U"}[r.args[0]])!=null?u:"."+r.args[0]:"."}))}}),qt("=","{:string}",{createAtom:r=>{var o,u;return new oi(rt(Q({},r),{type:"mord",isFunction:!1,limits:"adjacent",value:(o=r.args)!=null&&o[0]?(u={a:"\u0101",e:"\u0113",i:"\u012B",o:"\u014D",u:"\u016B",A:"\u0100",E:"\u0112",I:"\u012A",O:"\u014C",U:"\u016A"}[r.args[0]])!=null?u:"="+r.args[0]:"="}))}}),qt("~","{:string}",{createAtom:r=>{var o;return new oi(rt(Q({type:"mord"},r),{isFunction:!1,limits:"adjacent",value:r.args[0]&&(o={n:"\xF1",N:"\xD1",a:"\xE3",o:"\xF5",A:"\xC3",O:"\xD5"}[r.args[0]])!=null?o:"\xB4"}))}}),qt("c","{:string}",{createAtom:r=>{var o;return new oi(rt(Q({},r),{type:"mord",isFunction:!1,limits:"adjacent",value:r.args[0]&&(o={c:"\xE7",C:"\xC7"}[r.args[0]])!=null?o:""}))}}),qt("enclose","{notation:string}[style:string]{body:auto}",{createAtom:r=>{var o,u;const d=r.args,g={strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",backgroundcolor:"transparent",padding:"auto",shadow:"none",svgStrokeStyle:void 0,borderStyle:void 0,style:(o=r.style)!=null?o:{}};if(d[1]){const M=d[1].split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const N of M){const I=N.match(/\s*(\S+)\s+(\S+)\s+(.*)/);if(I)g.strokeWidth=I[1],g.strokeStyle=I[2],g.strokeColor=I[3];else{const F=N.match(/\s*([a-z]*)\s*=\s*"(.*)"/);F&&(F[1]==="mathbackground"?g.backgroundcolor=F[2]:F[1]==="mathcolor"?g.strokeColor=F[2]:F[1]==="padding"?g.padding=F[2]:F[1]==="shadow"&&(g.shadow=F[2]))}}g.strokeStyle==="dashed"?g.svgStrokeStyle="5,5":g.strokeStyle==="dotted"&&(g.svgStrokeStyle="1,5")}g.borderStyle=`${g.strokeWidth} ${g.strokeStyle} ${g.strokeColor}`;const b={};return((u=d[0])!=null?u:"").split(/[, ]/).filter(M=>M.length>0).forEach(M=>{b[M.toLowerCase()]=!0}),new Eu(r.command,se(d[2]),b,g)}}),qt("cancel","{body:auto}",{createAtom:r=>{var o;return new Eu(r.command,se(r.args[0]),{updiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(o=r.style)!=null?o:{}})}}),qt("bcancel","{body:auto}",{createAtom:r=>{var o;return new Eu(r.command,se(r.args[0]),{downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(o=r.style)!=null?o:{}})}}),qt("xcancel","{body:auto}",{createAtom:r=>{var o;return new Eu(r.command,se(r.args[0]),{updiagonalstrike:!0,downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(o=r.style)!=null?o:{}})}}),qt(["overrightarrow","overleftarrow","Overrightarrow","overleftharpoon","overrightharpoon","overleftrightarrow","overlinesegment","overgroup"],"{:auto}",{createAtom:r=>{var o;return new au(rt(Q({},r),{body:se((o=r.args)==null?void 0:o[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgAbove:r.command.slice(1)}))}}),qt("overbrace","{:auto}",{createAtom:r=>new au(rt(Q({},r),{body:se(r.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgAbove:r.command.slice(1)}))}),qt(["underrightarrow","underleftarrow","underleftrightarrow","underlinesegment","undergroup"],"{:auto}",{createAtom:r=>new au(rt(Q({},r),{body:se(r.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgBelow:r.command.slice(1)}))}),qt(["underbrace"],"{:auto}",{createAtom:r=>new au(rt(Q({},r),{body:se(r.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgBelow:r.command.slice(1)}))}),qt(["xrightarrow","longrightarrow","xleftarrow","longleftarrow","xRightarrow","xLeftarrow","xleftharpoonup","xleftharpoondown","xrightharpoonup","xrightharpoondown","xlongequal","xtwoheadleftarrow","xtwoheadrightarrow","xleftrightarrow","longleftrightarrow","xLeftrightarrow","xrightleftharpoons","longrightleftharpoons","xleftrightharpoons","xhookleftarrow","xhookrightarrow","xmapsto","xtofrom","xleftrightarrows","longleftrightarrows","xRightleftharpoons","longRightleftharpoons","xLeftrightharpoons","longLeftrightharpoons"],"[:auto]{:auto}",{createAtom:r=>{var o,u,d,g,b;return new au(rt(Q({},r),{svgBody:r.command.slice(1),above:((u=se((o=r.args)==null?void 0:o[1]))==null?void 0:u.length)===0?void 0:se((d=r.args)==null?void 0:d[1]),below:(b=se((g=r.args)==null?void 0:g[0]))!=null?b:null,skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,paddedLabels:!0,boxType:"rel"}))},serialize:(r,o)=>r.command+(r.hasEmptyBranch("below")?"":`[${r.belowToLatex(o)}]`)+`{${r.aboveToLatex(o)}}${r.supsubToLatex(o)}`}),qt(["arccos","arcsin","arctan","arctg","arcctg","arg","ch","cos","cosh","cot","cotg","coth","ctg","cth","csc","cosec","deg","dim","exp","gcd","hom","inf","ker","lb","lg","ln","log","Pr","sec","sh","sin","sinh","sup","tan","tanh","tg","th","arcsec","arccsc","arsinh","arcosh","artanh","arcsech","arccsch"],"",{isFunction:!0,ifMode:"math",createAtom:r=>new Tn(r.command.slice(1),rt(Q({},r),{limits:"adjacent",isFunction:!0,variant:"main",variantStyle:"up"}))}),qt(["liminf","limsup"],"",{ifMode:"math",createAtom:r=>new Tn({"\\liminf":"lim inf","\\limsup":"lim sup"}[r.command],rt(Q({},r),{limits:"over-under",variant:"main"}))}),qt(["lim","mod"],"",{ifMode:"math",createAtom:r=>new Tn(r.command.slice(1),rt(Q({},r),{limits:"over-under",variant:"main"}))}),qt(["det","max","min"],"",{ifMode:"math",isFunction:!0,createAtom:r=>new Tn(r.command.slice(1),rt(Q({},r),{limits:"over-under",isFunction:!0,variant:"main"}))}),qt(["ang"],"{:math}",{ifMode:"math",createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[0])})),serialize:(r,o)=>`\\ang{${r.bodyToLatex(o)}}`,render:(r,o)=>{const u=r.createBox(o),d=u.caret;u.caret=void 0;const g=new zi("\xB0",{style:rt(Q({},r.style),{variant:"normal",variantStyle:"up"})});return new zi([u,g],{type:"inner",isSelected:r.isSelected,caret:d})}}),qt("sqrt","[index:auto]{radicand:expression}",{ifMode:"math",createAtom:r=>new Jp(rt(Q({},r),{body:se(r.args[1]),index:r.args[0]?se(r.args[0]):void 0}))}),qt(["frac","dfrac","tfrac","cfrac","binom","dbinom","tbinom"],"{:expression}{:expression}",{ifMode:"math",createAtom:r=>{const o=Q({},r),u=r.command,d=r.args;switch(u){case"\\dfrac":case"\\frac":case"\\tfrac":o.hasBarLine=!0;break;case"\\atopfrac":o.hasBarLine=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o.hasBarLine=!1,o.leftDelim="(",o.rightDelim=")";break;case"\\cfrac":o.hasBarLine=!0,o.continuousFraction=!0;break;default:}switch(u){case"\\dfrac":case"\\dbinom":o.mathstyleName="displaystyle";break;case"\\tfrac":case"\\tbinom":o.mathstyleName="textstyle";break;default:}return new Bs(d[0]?se(d[0]):[new Dn],d[1]?se(d[1]):[new Dn],o)},serialize:(r,o)=>{const u=r.aboveToLatex(o),d=r.belowToLatex(o);return/^[0-9]$/.test(u)&&/^[0-9]$/.test(d)?`${r.command}${u}${d}`:Vo(r.command,u,d)}}),qt(["brace","brack"],"",{infix:!0,createAtom:r=>new Bs(se(r.args[0]),se(r.args[1]),rt(Q({},r),{hasBarLine:!1,leftDelim:r.command==="\\brace"?"\\lbrace":"\\lbrack",rightDelim:r.command==="\\brace"?"\\rbrace":"\\rbrack"})),serialize:(r,o)=>fr([r.aboveToLatex(o),r.command,r.belowToLatex(o)])}),qt(["over","atop","choose"],"",{infix:!0,createAtom:r=>{let o,u;const d=r.args;return r.command==="\\choose"&&(o="(",u=")"),new Bs(se(d[0]),se(d[1]),rt(Q({},r),{hasBarLine:r.command==="\\over",leftDelim:o,rightDelim:u}))},serialize:(r,o)=>fr([r.aboveToLatex(o),r.command,r.belowToLatex(o)])}),qt(["overwithdelims","atopwithdelims"],"{numer:auto}{denom:auto}{left-delim:delim}{right-delim:delim}",{infix:!0,createAtom:r=>{var o,u;const d=r.args;return new Bs(se(d[0]),se(d[1]),rt(Q({},r),{leftDelim:(o=d[2])!=null?o:".",rightDelim:(u=d[3])!=null?u:".",hasBarLine:!1}))},serialize:(r,o)=>`${r.aboveToLatex(o)} ${r.command}${r.leftDelim}${r.rightDelim}${r.belowToLatex(o)}`}),qt("pdiff","{numerator}{denominator}",{ifMode:"math",createAtom:r=>new Bs(se(r.args[0]),se(r.args[1]),rt(Q({},r),{hasBarLine:!0,numerPrefix:"\u2202",denomPrefix:"\u2202"}))}),qt(["sum","prod","bigcup","bigcap","coprod","bigvee","bigwedge","biguplus","bigotimes","bigoplus","bigodot","bigsqcup","intop"],"",{ifMode:"math",createAtom:r=>new Sg({coprod:"\u2210",bigvee:"\u22C1",bigwedge:"\u22C0",biguplus:"\u2A04",bigcap:"\u22C2",bigcup:"\u22C3",intop:"\u222B",prod:"\u220F",sum:"\u2211",bigotimes:"\u2A02",bigoplus:"\u2A01",bigodot:"\u2A00",bigsqcup:"\u2A06",smallint:"\u222B"}[r.command.slice(1)],rt(Q({},r),{limits:"auto",variant:"main"}))}),qt("smallint","",{ifMode:"math",createAtom:r=>new Tn("\u222B",rt(Q({},r),{limits:"adjacent",variant:"main"}))});var Cy={int:"\u222B",iint:"\u222C",iiint:"\u222D",oint:"\u222E",oiint:"\u222F",oiiint:"\u2230",intclockwise:"\u2231",varointclockwise:"\u2232",ointctrclockwise:"\u2233",intctrclockwise:"\u2A11",sqcup:"\u2294",sqcap:"\u2293",uplus:"\u228E",wr:"\u2240",amalg:"\u2A3F",Cap:"\u22D2",Cup:"\u22D3",doublecap:"\u22D2",doublecup:"\u22D3"};qt(Object.keys(Cy),"",{ifMode:"math",createAtom:r=>{const o=r.command,u=Cy[o.slice(1)];return new Sg(u,rt(Q({},r),{limits:"adjacent",variant:{"\u22D2":"ams","\u22D3":"ams"}[u]}))}}),qt(["Re","Im"],"",{ifMode:"math",createAtom:r=>new Tn({"\\Re":"\u211C","\\Im":"\u2111"}[r.command],rt(Q({},r),{limits:"adjacent",isFunction:!0,variant:"fraktur"}))}),qt("middle","{:delim}",{ifMode:"math",createAtom:r=>{var o;return new Xf(rt(Q({},r),{delim:(o=r.args[0])!=null?o:"|",size:1}))}}),qt("the","{:value}",{createAtom:r=>new oi(rt(Q({},r),{captureSelection:!0,verbatimLatex:null})),render:(r,o)=>{var u;const d=new Dr({parent:o},r.style);let g="";r.isSelected&&(g+=" ML__selected");const b=d.evaluate(r.args[0]);return new zi(((u=Ls(b))!=null?u:"").split("").map(M=>new zi(M,{type:"ord",classes:g,mode:r.mode,isSelected:r.isSelected,style:Q({variant:"main"},r.style)})),{type:"lift",style:r.style,caret:r.caret,isSelected:r.isSelected,classes:g}).wrap(d)},serialize:r=>{var o;return`\\the${(o=Ls(r.args[0]))!=null?o:"\\relax"}`}}),qt("mathtip","{:auto}{:math}",{createAtom:r=>new qf(rt(Q({},r),{body:se(r.args[0]),tooltip:se(r.args[1]),content:"math"})),serialize:(r,o)=>o.skipStyles?r.bodyToLatex(o):`\\texttip{${r.bodyToLatex(o)}}{${oi.serialize([r.tooltip],rt(Q({},o),{defaultMode:"math"}))}}`}),qt("texttip","{:auto}{:text}",{createAtom:r=>new qf(rt(Q({},r),{body:se(r.args[0]),tooltip:se(r.args[1]),content:"text"})),serialize:(r,o)=>o.skipStyles?r.bodyToLatex(o):`\\texttip{${r.bodyToLatex(o)}}{${oi.serialize([r.tooltip],rt(Q({},o),{defaultMode:"text"}))}}`}),qt("error","{:math}",{createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[0])})),serialize:(r,o)=>`\\error{${r.bodyToLatex(o)}}`,render:(r,o)=>r.createBox(o,{classes:"ML__error"})}),qt("ensuremath","{:math}",{createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[0])})),serialize:(r,o)=>`${r.command}{${r.bodyToLatex(rt(Q({},o),{defaultMode:"math"}))}}`}),qt("color","{:value}",{applyStyle:(r,o,u)=>{var d,g;return{verbatimColor:(d=Ls(o[0]))!=null?d:void 0,color:u.toColor((g=o[0])!=null?g:{string:"red"})}}}),qt("textcolor","{:value}{content:auto*}",{applyStyle:(r,o,u)=>{var d,g;return{verbatimColor:(d=Ls(o[0]))!=null?d:void 0,color:u.toColor((g=o[0])!=null?g:{string:"red"})}}}),qt("boxed","{content:math}",{createAtom:r=>new Qo(rt(Q({},r),{body:se(r.args[0]),framecolor:{string:"black"}}))}),qt("colorbox","{:value}{:text*}",{applyStyle:(r,o,u)=>{var d,g;return{verbatimBackgroundColor:(d=Ls(o[0]))!=null?d:void 0,backgroundColor:u.toBackgroundColor((g=o[0])!=null?g:{string:"yellow"})}}}),qt("fcolorbox","{frame-color:value}{background-color:value}{content:text}",{applyMode:"text",createAtom:r=>{var o,u;return new Qo(rt(Q({},r),{body:se(r.args[2]),framecolor:(o=r.args[0])!=null?o:{string:"blue"},backgroundcolor:(u=r.args[1])!=null?u:{string:"yellow"}}))},serialize:(r,o)=>{var u,d;return o.skipStyles?r.bodyToLatex(rt(Q({},o),{defaultMode:"text"})):Vo(r.command,(u=Ls(r.framecolor))!=null?u:"",(d=Ls(r.backgroundcolor))!=null?d:"",r.bodyToLatex(rt(Q({},o),{defaultMode:"text"})))}}),qt("bbox","[:bbox]{body:auto}",{createAtom:r=>{var o;const u=r.args[0],d=se(r.args[1]);return u?new Qo(rt(Q({},r),{body:d,padding:u.padding,border:u.border,backgroundcolor:(o=u.backgroundcolor)!=null?o:void 0})):new Qo(rt(Q({},r),{body:d}))},serialize:(r,o)=>{var u,d;if(o.skipStyles)return r.bodyToLatex(o);let g=r.command;if(Number.isFinite(r.padding)||r.border!==void 0||r.backgroundcolor!==void 0){const b=[];r.padding&&b.push((u=Ls(r.padding))!=null?u:""),r.border&&b.push(`border: ${r.border}`),r.backgroundcolor&&b.push((d=Ls(r.backgroundcolor))!=null?d:""),g+=`[${b.join(",")}]`}return Vo(g,r.bodyToLatex(o))}}),qt(["displaystyle","textstyle","scriptstyle","scriptscriptstyle"],"{:rest}",{createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[0])})),render:(r,o)=>{const u=new Dr({parent:o,mathstyle:r.command.slice(1)},r.style),d=oi.createBox(u,r.body,{type:"lift"});return r.caret&&(d.caret=r.caret),r.bind(o,d)},serialize:(r,o)=>o.skipStyles?r.bodyToLatex(o):`{${fr([r.command,r.bodyToLatex(o)])}}`}),qt(["tiny","scriptsize","footnotesize","small","normalsize","large","Large","LARGE","huge","Huge"],"",{applyStyle:r=>({fontSize:{"\\tiny":1,"\\scriptsize":2,"\\footnotesize":3,"\\small":4,"\\normalsize":5,"\\large":6,"\\Large":7,"\\LARGE":8,"\\huge":9,"\\Huge":10}[r]})}),qt("fontseries","{:string}",{ifMode:"text",applyStyle:(r,o)=>{var u;return{fontSeries:(u=o[0])!=null?u:"auto"}}}),qt("fontshape","{:string}",{ifMode:"text",applyStyle:(r,o)=>{var u;return{fontShape:(u=o[0])!=null?u:"auto"}}}),qt("fontfamily","{:string}",{ifMode:"text",applyStyle:(r,o)=>{var u;return{fontFamily:(u=o[0])!=null?u:"roman"}}}),qt("selectfont","",{ifMode:"text",applyStyle:()=>({})}),qt("bf","{:rest}",{applyStyle:()=>({fontSeries:"b",fontShape:"n",fontFamily:"roman"})}),qt(["boldsymbol","bm"],"{:math}",{applyMode:"math",createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[0])})),serialize:(r,o)=>`${r.command}{${r.bodyToLatex(o)}}`,render:(r,o)=>r.createBox(o,{classes:"ML__boldsymbol"})}),qt("bold","{:math*}",{applyMode:"math",applyStyle:()=>({variantStyle:"bold"})}),qt("bfseries","{:rest}",{applyMode:"text",applyStyle:()=>({fontSeries:"b"})}),qt("mdseries","{:rest}",{applyMode:"text",applyStyle:()=>({fontSeries:"m"})}),qt("upshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"n"})}),qt("slshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"sl"})}),qt("scshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"sc"})}),qt("textbf","{:text*}",{applyMode:"text",applyStyle:()=>({fontSeries:"b"})}),qt("textmd","{:text*}",{applyMode:"text",applyStyle:()=>({fontSeries:"m"})}),qt("textup","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"n"})}),qt("textnormal","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"n",fontSeries:"m"})}),qt("textsl","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"sl"})}),qt("textit","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"it"})}),qt("textsc","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"sc"})}),qt("textrm","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"roman"})}),qt("textsf","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"sans-serif"})}),qt("texttt","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"monospace"})}),qt("mathbf","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"bold"})}),qt("mathit","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"main",variantStyle:"italic"})}),qt("mathnormal","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"italic"})}),qt("mathbfit","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"main",variantStyle:"bolditalic"})}),qt("mathrm","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"up"})}),qt("mathsf","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"sans-serif",variantStyle:"up"})}),qt("mathtt","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"monospace",variantStyle:"up"})}),qt("it","{:rest}",{applyStyle:()=>({fontSeries:"m",fontShape:"it",fontFamily:"roman",variantStyle:"italic"})}),qt("rmfamily","",{applyStyle:()=>({fontFamily:"roman"})}),qt("sffamily","",{applyStyle:()=>({fontFamily:"sans-serif"})}),qt("ttfamily","",{applyStyle:()=>({fontFamily:"monospace"})}),qt(["Bbb","mathbb"],"{:math*}",{applyStyle:()=>({variant:"double-struck",variantStyle:"up"})}),qt(["frak","mathfrak"],"{:math*}",{applyStyle:()=>({variant:"fraktur",variantStyle:"up"})}),qt("mathcal","{:math*}",{applyStyle:()=>({variant:"calligraphic",variantStyle:"up"})}),qt("mathscr","{:math*}",{applyStyle:()=>({variant:"script",variantStyle:"up"})}),qt("mbox","{:text}",{ifMode:"math",createAtom:r=>new oi(rt(Q({},r),{type:"mord",body:se(r.args[0]),mode:"math"})),serialize:(r,o)=>Vo("\\mbox",r.bodyToLatex(rt(Q({},o),{defaultMode:"text"})))}),qt("text","{:text}",{ifMode:"math",applyMode:"text"}),qt(["class","htmlClass"],"{name:string}{content:auto}",{createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[1])})),serialize:(r,o)=>!r.args[0]||o.skipStyles?r.bodyToLatex(o):`${r.command}{${r.args[0]}}{${r.bodyToLatex(o)}}`,render:(r,o)=>{var u;return r.createBox(o,{classes:(u=r.args[0])!=null?u:""})}}),qt(["cssId","htmlId"],"{id:string}{content:auto}",{createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[1])})),serialize:(r,o)=>{var u;return!((u=r.args)!=null&&u[0])||o.skipStyles?r.bodyToLatex(o):`${r.command}{${r.args[0]}}{${r.bodyToLatex(o)}}`},render:(r,o)=>{var u;const d=r.createBox(o);return d.cssId=(u=r.args[0])!=null?u:"",d}}),qt("htmlData","{data:string}{content:auto}",{createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[1])})),serialize:(r,o)=>{var u;return!((u=r.args)!=null&&u[0])||o.skipStyles?r.bodyToLatex(o):`\\htmlData{${r.args[0]}}{${r.bodyToLatex(o)}}`},render:(r,o)=>{var u;const d=r.createBox(o);return d.htmlData=(u=r.args[0])!=null?u:"",d}}),qt(["style","htmlStyle"],"{data:string}{content:auto}",{createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[1])})),serialize:(r,o)=>{var u;return!((u=r.args)!=null&&u[0])||o.skipStyles?r.bodyToLatex(o):`${r.command}{${r.args[0]}}{${r.bodyToLatex(o)}}`},render:(r,o)=>{var u;const d=r.createBox(o);return d.htmlStyle=(u=r.args[0])!=null?u:"",d}}),qt("em","{:rest}",{createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[0])})),serialize:(r,o)=>o.skipStyles?r.bodyToLatex(o):`{\\em ${r.bodyToLatex(o)}}`,render:(r,o)=>r.createBox(o,{classes:"ML__emph",boxType:"lift"})}),qt("emph","{:auto}",{createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[1])})),serialize:(r,o)=>o.skipStyles?r.bodyToLatex(o):`\\emph{${r.bodyToLatex(o)}}`,render:(r,o)=>r.createBox(o,{classes:"ML__emph",boxType:"lift"})});var Km={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}};qt(["bigl","Bigl","biggl","Biggl","bigr","Bigr","biggr","Biggr","bigm","Bigm","biggm","Biggm","big","Big","bigg","Bigg"],"{:delim}",{createAtom:r=>{var o;return new Kd(rt(Q({},r),{delim:(o=r.args[0])!=null?o:".",size:Km[r.command].size,delimType:Km[r.command].mclass}))}}),qt(["hspace","hspace*"],"{width:value}",{createAtom:r=>{var o;return new Jf(rt(Q({},r),{width:(o=r.args[0])!=null?o:{dimension:0}}))}}),qt(["mkern","kern","mskip","hskip","mspace"],"{width:value}",{createAtom:r=>{var o;return new Jf(rt(Q({},r),{width:(o=r.args[0])!=null?o:{dimension:0}}))}}),qt("mathchoice","{:math}{:math}{:math}{:math}",{createAtom:r=>new oi(r),render:(r,o)=>{let u=0;const d=o.mathstyle.id;(d===Ih||d===Oh)&&(u=1),(d===Gc||d===ua)&&(u=2),(d===Vs||d===Ma)&&(u=3);const g=se(r.args[u]);return oi.createBox(o,g)},serialize:(r,o)=>`\\mathchoice{${oi.serialize(r.args[0],o)}}{${oi.serialize(r.args[1],o)}}{${oi.serialize(r.args[2],o)}}{${oi.serialize(r.args[3],o)}}`}),qt("mathop","{:auto}",{createAtom:r=>new oi(rt(Q({},r),{type:"mop",body:se(r.args[0]),limits:"over-under",isFunction:!0,captureSelection:!0})),render:(r,o)=>{var u;let d=oi.createBox(o,r.body);if(r.superscript||r.subscript){const g=(u=r.subsupPlacement)!=null?u:"auto";d=g==="over-under"||g==="auto"&&o.isDisplayStyle?r.attachLimits(o,{base:d}):r.attachSupsub(o,{base:d})}return new zi(r.bind(o,d),{type:"op",isSelected:r.isSelected,classes:"op-group"})},serialize:(r,o)=>{const u=[Vo(r.command,r.bodyToLatex(o))];return r.explicitSubsupPlacement&&(r.subsupPlacement==="over-under"&&u.push("\\limits"),r.subsupPlacement==="adjacent"&&u.push("\\nolimits"),r.subsupPlacement==="auto"&&u.push("\\displaylimits")),u.push(r.supsubToLatex(o)),fr(u)}}),qt(["mathbin","mathrel","mathopen","mathclose","mathpunct","mathord","mathinner"],"{:auto}",{createAtom:r=>new oi(rt(Q({},r),{type:{"\\mathbin":"mbin","\\mathrel":"mrel","\\mathopen":"mopen","\\mathclose":"mclose","\\mathpunct":"mpunct","\\mathord":"mord","\\mathinner":"minner"}[r.command],body:se(r.args[0])}))}),qt(["operatorname","operatorname*"],"{operator:math}",{createAtom:r=>{const o=se(r.args[0]).map(u=>{var d;return u.type!=="first"&&(u.type="mord",u.value=(d={"\u2217":"*","\u2212":"-"}[u.value])!=null?d:u.value,u.isFunction=!1,!u.style.variant&&!u.style.variantStyle&&(u.style.variant="main",u.style.variantStyle="up")),u});return new oi(rt(Q({},r),{type:"mop",body:o,isFunction:!0,limits:r.command==="\\operatorname"?"adjacent":"over-under"}))},render:(r,o)=>{var u;let d=oi.createBox(o,r.body);if(r.superscript||r.subscript){const g=(u=r.subsupPlacement)!=null?u:"auto";d=g==="over-under"||g==="auto"&&o.isDisplayStyle?r.attachLimits(o,{base:d}):r.attachSupsub(o,{base:d})}return r.caret&&(d.caret=r.caret),new zi(r.bind(o,d),{type:"op",isSelected:r.isSelected,classes:"op-group"})},serialize:(r,o)=>{const u=[Vo(r.command,r.bodyToLatex(o))];return r.explicitSubsupPlacement&&(r.subsupPlacement==="over-under"&&u.push("\\limits"),r.subsupPlacement==="adjacent"&&u.push("\\nolimits"),r.subsupPlacement==="auto"&&u.push("\\displaylimits")),u.push(r.supsubToLatex(o)),fr(u)}}),qt(["char","unicode"],"{charcode:value}",{createAtom:r=>new oi(rt(Q({},r),{type:r.mode==="text"?"text":"mord"})),serialize:r=>{var o;return`${r.command}${Ls((o=r.args[0])!=null?o:{number:10067,base:"hexadecimal"})}`},render:(r,o)=>{let u=o.evaluate(r.args[0]);return(!u||!("number"in u))&&(u={number:10067,base:"hexadecimal"}),r.value=String.fromCodePoint(u.number),r.createBox(o)}}),qt("rule","[raise:value]{width:value}{thickness:value}",{createAtom:r=>new oi(r),render:(r,o)=>{var u,d,g;const b=new Dr({parent:o,mathstyle:"textstyle"},r.style),M=b.toEm((u=r.args[0])!=null?u:{dimension:0}),N=b.toEm((d=r.args[1])!=null?d:{dimension:10}),I=b.toEm((g=r.args[2])!=null?g:{dimension:10}),F=new zi(null,{classes:"rule",type:"ord"});return F.width=N,F.height=I+M,F.depth=-M,F.setStyle("border-right-width",N,"em"),F.setStyle("border-top-width",I,"em"),F.setStyle("border-color",r.style.color),F.setStyle("vertical-align",M,"em"),r.isSelected&&F.setStyle("opacity","50%"),r.bind(b,F),r.caret&&(F.caret=r.caret),F.wrap(o)},serialize:r=>`\\rule${r.args[0]?`[${Ls(r.args[0])}]`:""}{${Ls(r.args[1])}}{${Ls(r.args[2])}}`}),qt(["overline","underline"],"{:auto}",{createAtom:r=>new oi(rt(Q({},r),{body:se(r.args[0])})),render:(r,o)=>{const u=r.command.substring(1),d=new Dr({parent:o,mathstyle:"cramp"},r.style),g=oi.createBox(d,r.body);if(!g)return null;const b=d.metrics.defaultRuleThickness/d.scalingFactor,M=new zi(null,{classes:u+"-line"});M.height=b,M.maxFontSize=b*1.125*d.scalingFactor;let N;return u==="overline"?N=new to({shift:0,children:[{box:g},3*b,{box:M},b]}):N=new to({top:g.height,children:[b,{box:M},3*b,{box:g}]}),r.caret&&(N.caret=r.caret),new zi(N,{classes:u,type:"ignore"})}}),qt("overset","{:auto}{base:auto}",{createAtom:r=>{const o=se(r.args[1]);return new au(rt(Q({},r),{above:se(r.args[0]),body:o,skipBoundary:!1,boxType:Ad(o)}))},serialize:(r,o)=>Vo(r.command,r.aboveToLatex(o),r.bodyToLatex(o))}),qt("underset","{:auto}{base:auto}",{createAtom:r=>{const o=se(r.args[1]);return new au(rt(Q({},r),{below:se(r.args[0]),body:o,skipBoundary:!1,boxType:Ad(o)}))},serialize:(r,o)=>Vo(r.command,r.belowToLatex(o),r.bodyToLatex(o))}),qt("overunderset","{above:auto}{below:auto}{base:auto}",{createAtom:r=>{const o=se(r.args[2]);return new au(rt(Q({},r),{above:se(r.args[0]),below:se(r.args[1]),body:o,skipBoundary:!1,boxType:Ad(o)}))},serialize:(r,o)=>Vo(r.command,r.belowToLatex(o),r.bodyToLatex(o))}),qt(["stackrel","stackbin"],"[below:auto]{above:auto}{base:auto}",{createAtom:r=>new au(rt(Q({},r),{body:se(r.args[2]),above:se(r.args[1]),below:se(r.args[0]),skipBoundary:!1,boxType:r.command==="\\stackrel"?"rel":"bin"})),serialize:(r,o)=>Vo(r.command,r.aboveToLatex(o),r.bodyToLatex(o))}),qt("smash","[:string]{:auto}",{createAtom:r=>{var o,u,d,g;return new Yp(rt(Q({},r),{body:se(r.args[1]),smashHeight:(u=(o=r.args[0])==null?void 0:o.includes("t"))!=null?u:!0,smashDepth:(g=(d=r.args[0])==null?void 0:d.includes("b"))!=null?g:!0}))}}),qt(["vphantom"],"{:auto}",{createAtom:r=>new Yp(rt(Q({},r),{body:se(r.args[0]),isInvisible:!0,smashWidth:!0}))}),qt(["hphantom"],"{:auto}",{createAtom:r=>new Yp(rt(Q({},r),{body:se(r.args[0]),isInvisible:!0,smashHeight:!0,smashDepth:!0}))}),qt(["phantom"],"{:auto}",{createAtom:r=>new Yp(rt(Q({},r),{body:se(r.args[0]),isInvisible:!0}))}),qt("not","{:math}",{createAtom:r=>{const o=se(r.args[0]);return o.length===0?new oi(rt(Q({},r),{type:"mrel",value:"\uE020"})):new oi(rt(Q({},r),{body:[new lh(rt(Q({},r),{body:"\uE020",align:"right"})),...o],captureSelection:!0}))},serialize:(r,o)=>{const u=r.args[0],d=u&&typeof u=="object"&&"group"in u;return r.value!=="\uE020"?d?`\\not{${oi.serialize(u.group,o)}}`:`\\not${oi.serialize(u,o)}`:d?"\\not{}":"\\not"},render:(r,o)=>{if(r.value)return r.createBox(o);const d=r.args[0]&&typeof r.args[0]=="object"&&"group"in r.args[0]?"ord":Ad(se(r.args[0])),g=oi.createBox(o,r.body,{type:d});return r.caret&&(g.caret=r.caret),r.bind(o,g)}}),qt(["ne","neq"],"",{createAtom:r=>new oi(rt(Q({},r),{type:"mrel",body:[new lh(rt(Q({},r),{body:"\uE020",align:"right",boxType:"rel"})),new oi(rt(Q({},r),{value:"="}))],captureSelection:!0})),serialize:r=>r.command}),qt("rlap","{:auto}",{createAtom:r=>new lh(rt(Q({},r),{body:se(r.args[0]),align:"right"}))}),qt("llap","{:auto}",{createAtom:r=>new lh(rt(Q({},r),{body:se(r.args[0]),align:"left"}))}),qt("mathrlap","{:math}",{createAtom:r=>new lh(rt(Q({},r),{body:se(r.args[0]),align:"left"}))}),qt("mathllap","{:math}",{createAtom:r=>new lh(rt(Q({},r),{body:se(r.args[0]),align:"left"}))}),qt("raisebox","{:value}{:text}",{createAtom:r=>{var o;return new Qo(rt(Q({},r),{body:se(r.args[1]),padding:{dimension:0},offset:(o=r.args[0])!=null?o:{dimension:0}}))},serialize:(r,o)=>{var u;return Vo("\\raisebox",(u=Ls(r.offset))!=null?u:"0pt",r.bodyToLatex(o))}}),qt("raise","{:value}{:auto}",{createAtom:r=>{var o;return new Qo(rt(Q({},r),{body:se(r.args[1]),padding:{dimension:0},offset:(o=r.args[0])!=null?o:{dimension:0}}))},serialize:(r,o)=>{var u;return Vo("\\raise",(u=Ls(r.offset))!=null?u:"0pt",r.bodyToLatex(o))}}),qt("lower","{:value}{:auto}",{createAtom:r=>{var o;return new Qo(rt(Q({},r),{body:se(r.args[1]),padding:{dimension:0},offset:(o=ou(r.args[0],-1))!=null?o:{dimension:0}}))},serialize:(r,o)=>{var u,d;return Vo("\\lower",(d=Ls(ou((u=r.offset)!=null?u:{dimension:0},-1)))!=null?d:"0pt",r.bodyToLatex(o))}}),St("0123456789/@.?!"),ae(65,90),ae(97,122),St([["\\forall",8704],["\\exists",8707],["\\nexists",8708,"mord","ams"],["\\mid",8739,"mrel"],["\\top",8868],["\\bot",8869]]),St([["\\#",35],["\\&",38],["\\parallelogram",9649],["\\spadesuit",9824],["\\heartsuit",9825],["\\diamondsuit",9826],["\\clubsuit",9827],["\\flat",9837],["\\natural",9838],["\\sharp",9839]]),St([["\\backslash",92],["\\nabla",8711],["\\partial",8706],["\\ell",8467],["\\hbar",8463],["\\Q",81,"mord","double-struck"],["\\C",67,"mord","double-struck"],["\\P",80,"mord","double-struck"],["\\pounds",163],["\\euro",8364]]),St([["\\rightarrow",8594],["\\to",8594],["\\leftarrow",8592],["\\gets",8592],["\\Rightarrow",8658],["\\Leftarrow",8656],["\\longrightarrow",10230],["\\longleftarrow",10229],["\\Longrightarrow",10233],["\\implies",10233],["\\Longleftarrow",10232],["\\impliedby",10232],["\\longleftrightarrow",10231],["\\biconditional",10231],["\\Longleftrightarrow",10234],["\\mapsto",8614],["\\longmapsto",10236],["\\uparrow",8593],["\\downarrow",8595],["\\Uparrow",8657],["\\Downarrow",8659],["\\updownarrow",8597],["\\Updownarrow",8661],["\\hookrightarrow",8618],["\\hookleftarrow",8617],["\\rightharpoonup",8640],["\\leftharpoonup",8636],["\\rightharpoondown",8641],["\\leftharpoondown",8637],["\\searrow",8600],["\\nearrow",8599],["\\swarrow",8601],["\\nwarrow",8598],["\\originalof",8886],["\\laplace",8886],["\\imageof",8887],["\\Laplace",8887]],"mrel"),St([["\\mapsfrom",8612,"mrel"],["\\Mapsfrom",10502,"mrel"],["\\MapsTo",10503,"mrel"],["\\Yup",8516,"mord"],["\\lightning",8623,"mrel"],["\\leftarrowtriangle",8701,"mrel"],["\\rightarrowtriangle",8702,"mrel"],["\\leftrightarrowtriangle",8703,"mrel"],["\\boxdot",8865,"mbin"],["\\bigtriangleup",9651,"mbin"],["\\bigtriangledown",9661,"mbin"],["\\boxbar",9707,"mbin"],["\\Lbag",10181,"mopen"],["\\Rbag",10182,"mclose"],["\\llbracket",10214,"mopen"],["\\rrbracket",10215,"mclose"],["\\longmapsfrom",10235,"mrel"],["\\Longmapsfrom",10237,"mrel"],["\\Longmapsto",10238,"mrel"],["\\boxslash",10692,"mbin"],["\\boxbslash",10693,"mbin"],["\\boxast",10694,"mbin"],["\\boxcircle",10695,"mbin"],["\\boxbox",10696,"mbin"],["\\fatsemi",10783,"mop"],["\\leftslice",10918,"mrel"],["\\rightslice",10919,"mrel"],["\\interleave",10996,"mbin"],["\\biginterleave",11004,"mop"],["\\sslash",11005,"mbin"],["\\talloblong",11006,"mbin"]]),St([["\\lbrace",123,"mopen"],["\\rbrace",125,"mclose"],["\\lparen",40,"mopen"],["\\rparen",41,"mclose"],["\\langle",10216,"mopen"],["\\rangle",10217,"mclose"],["\\lfloor",8970,"mopen"],["\\rfloor",8971,"mclose"],["\\lceil",8968,"mopen"],["\\rceil",8969,"mclose"],["\\vert",8739],["\\lvert",8739,"mopen"],["\\rvert",8739,"mclose"],["\\|",8741],["\\Vert",8741],["\\mVert",8741],["\\lVert",8741,"mopen"],["\\rVert",8741,"mclose"],["\\lbrack",91,"mopen"],["\\rbrack",93,"mclose"],["\\{",123,"mopen"],["\\}",125,"mclose"],["(",40,"mopen"],[")",41,"mclose"],["[",91,"mopen"],["]",93,"mclose"],["\\ulcorner",9484,"mopen","ams"],["\\urcorner",9488,"mclose","ams"],["\\llcorner",9492,"mopen","ams"],["\\lrcorner",9496,"mclose","ams"],["\\lgroup",10222,"mopen"],["\\rgroup",10223,"mclose"],["\\lmoustache",9136,"mopen"],["\\rmoustache",9137,"mclose"]]),St([["\\dashrightarrow",8674],["\\dashleftarrow",8672],["\\Rrightarrow",8667],["\\Lleftarrow",8666],["\\leftrightarrows",8646],["\\rightleftarrows",8644],["\\curvearrowright",8631],["\\curvearrowleft",8630],["\\rightrightarrows",8649],["\\leftleftarrows",8647],["\\upuparrows",8648],["\\downdownarrows",8650],["\\vartriangle",9651],["\\triangleq",8796],["\\vartriangleleft",8882],["\\trianglelefteq",8884],["\\ntriangleleft",8938],["\\ntrianglelefteq",8940],["\\vartriangleright",8883],["\\trianglerighteq",8885],["\\ntriangleright",8939],["\\ntrianglerighteq",8941],["\\blacktriangleleft",9664],["\\blacktriangleright",9654],["\\leftarrowtail",8610],["\\rightarrowtail",8611],["\\looparrowright",8620],["\\looparrowleft",8619],["\\twoheadleftarrow",8606],["\\twoheadrightarrow",8608],["\\twoheadrightarrowtail",10518],["\\rightleftharpoons",8652],["\\leftrightharpoons",8651],["\\Rsh",8625],["\\Lsh",8624],["\\circlearrowright",8635],["\\circlearrowleft",8634],["\\restriction",8638],["\\upharpoonright",8638],["\\upharpoonleft",8639],["\\downharpoonright",8642],["\\downharpoonleft",8643],["\\rightsquigarrow",8669],["\\leadsto",8669],["\\leftrightsquigarrow",8621],["\\multimap",8888],["\\nleftarrow",8602],["\\nrightarrow",8603],["\\nRightarrow",8655],["\\nLeftarrow",8653],["\\nleftrightarrow",8622],["\\nLeftrightarrow",8654],["\\nvrightarrow",8696],["\\nvtwoheadrightarrow",10496],["\\nvrightarrowtail",10516],["\\nvtwoheadrightarrowtail",10519],["\\shortparallel",8741],["\\nless",8814],["\\nleqslant",57360],["\\lneq",10887],["\\lneqq",8808],["\\nleqq",57361],["\\lvertneqq",57356],["\\lnsim",8934],["\\lnapprox",10889],["\\nprec",8832],["\\npreceq",8928],["\\precnsim",8936],["\\precnapprox",10937],["\\nsim",8769],["\\nshortmid",57350],["\\nmid",8740],["\\nvdash",8876],["\\nvDash",8877],["\\ngtr",8815],["\\ngeqslant",57359],["\\ngeqq",57358],["\\gneq",10888],["\\gneqq",8809],["\\gvertneqq",57357],["\\gnsim",8935],["\\gnapprox",10890],["\\nsucc",8833],["\\nsucceq",8929],["\\succnsim",8937],["\\succnapprox",10938],["\\ncong",8774],["\\nshortparallel",57351],["\\nparallel",8742],["\\nVDash",8879],["\\nsupseteqq",57368],["\\supsetneq",8843],["\\varsupsetneq",57371],["\\supsetneqq",10956],["\\varsupsetneqq",57369],["\\nVdash",8878],["\\precneqq",10933],["\\succneqq",10934],["\\nsubseteqq",57366],["\\leqslant",10877],["\\geqslant",10878],["\\gtrsim",8819],["\\approxeq",8778],["\\thickapprox",8776],["\\lessapprox",10885],["\\gtrapprox",10886],["\\precapprox",10935],["\\succapprox",10936],["\\thicksim",8764],["\\succsim",8831],["\\precsim",8830],["\\backsim",8765],["\\eqsim",8770],["\\backsimeq",8909],["\\lesssim",8818],["\\nleq",8816],["\\ngeq",8817],["\\smallsmile",8995],["\\smallfrown",8994],["\\leqq",8806],["\\eqslantless",10901],["\\lll",8920],["\\lessgtr",8822],["\\lesseqgtr",8922],["\\lesseqqgtr",10891],["\\risingdotseq",8787],["\\fallingdotseq",8786],["\\subseteqq",10949],["\\Subset",8912],["\\sqsubset",8847],["\\preccurlyeq",8828],["\\curlyeqprec",8926],["\\vDash",8872],["\\Vvdash",8874],["\\bumpeq",8783],["\\Bumpeq",8782],["\\geqq",8807],["\\eqslantgtr",10902],["\\ggg",8921],["\\gtrless",8823],["\\gtreqless",8923],["\\gtreqqless",10892],["\\supseteqq",10950],["\\Supset",8913],["\\sqsupset",8848],["\\succcurlyeq",8829],["\\curlyeqsucc",8927],["\\Vdash",8873],["\\shortmid",8739],["\\between",8812],["\\pitchfork",8916],["\\varpropto",8733],["\\backepsilon",8717],["\\llless",8920],["\\gggtr",8921],["\\doteqdot",8785],["\\Doteq",8785],["\\eqcirc",8790],["\\circeq",8791],["\\therefore",8756],["\\because",8757]],"mrel","ams"),St([["+",43],["-",8722],["\u2212",8722],["\\pm",177],["\\mp",8723],["*",8727],["\\times",215],["\\div",247],["\\divides",8739],["\\cdot",8901],["\\cap",8745],["\\cup",8746],["\\setminus",8726],["\\land",8743],["\\wedge",8743],["\\lor",8744],["\\vee",8744],["\\circ",8728],["\\bigcirc",9711],["\\bullet",8729],["\\oplus",8853],["\\ominus",8854],["\\otimes",8855],["\\odot",8857],["\\oslash",8856],["\\bigtriangleup",9651],["\\bigtriangledown",9661],["\\triangleleft",9667],["\\triangleright",9657],["\\And",38],["\\dagger",8224],["\\dag",8224],["\\ddag",8225],["\\ddagger",8225],["\\ast",8727],["\\star",8902],["\\bigstar",9733],["\\diamond",8900]],"mbin"),St([["\\lhd",8882],["\\rhd",8883],["\\lessdot",8918],["\\gtrdot",8919],["\\ltimes",8905],["\\rtimes",8906],["\\leftthreetimes",8907],["\\rightthreetimes",8908],["\\intercal",8890],["\\dotplus",8724],["\\doublebarwedge",10846],["\\divideontimes",8903],["\\centerdot",8901],["\\smallsetminus",8726],["\\barwedge",8892],["\\veebar",8891],["\\nor",8891],["\\curlywedge",8911],["\\curlyvee",8910],["\\boxminus",8863],["\\boxplus",8862],["\\boxtimes",8864],["\\boxdot",8865],["\\circleddash",8861],["\\circledast",8859],["\\circledcirc",8858],["\\unlhd",8884],["\\unrhd",8885]],"mbin","ams"),St([["\\surd",8730],["\\infty",8734],["\\prime",8242],["\\doubleprime",8243],["\\angle",8736],["`",8216],["\\$",36],["\\%",37],["\\_",95],["\\alpha",945],["\\beta",946],["\\gamma",947],["\\delta",948],["\\epsilon",1013],["\\varepsilon",949],["\\zeta",950],["\\eta",951],["\\theta",952],["\\vartheta",977],["\\iota",953],["\\kappa",954],["\\varkappa",1008,"mord","ams"],["\\lambda",955],["\\mu",956],["\\nu",957],["\\xi",958],["\\omicron",111],["\\pi",960],["\\varpi",982],["\\rho",961],["\\varrho",1009],["\\sigma",963],["\\varsigma",962],["\\tau",964],["\\phi",981],["\\varphi",966],["\\upsilon",965],["\\chi",967],["\\psi",968],["\\omega",969],["\\Gamma",915],["\\Delta",916],["\\Theta",920],["\\Lambda",923],["\\Xi",926],["\\Pi",928],["\\Sigma",931],["\\Upsilon",933],["\\Phi",934],["\\Psi",936],["\\Omega",937],["\\digamma",989,"mord","ams"],["\\emptyset",8709]]),St([["=",61],["<",60],["\\lt",60],[">",62],["\\gt",62],["\\le",8804],["\\leq",8804],["\\ge",8805],["\\geq",8805],["\\ll",8810],["\\gg",8811],["\\coloneq",8788],["\\coloneqq",8788],["\\colonequals",8788],["\\measeq",8797],["\\eqdef",8798],["\\questeq",8799],[":",58],["\\cong",8773],["\\equiv",8801],["\\prec",8826],["\\preceq",10927],["\\succ",8827],["\\succeq",10928],["\\perp",8869],["\\propto",8733],["\\Colon",8759],["\\smile",8995],["\\frown",8994],["\\sim",8764],["\\doteq",8784],["\\bowtie",8904],["\\Join",8904],["\\asymp",8781],["\\sqsubseteq",8849],["\\sqsupseteq",8850],["\\approx",8776],["\\~",126],["\\leftrightarrow",8596],["\\Leftrightarrow",8660],["\\models",8872],["\\vdash",8866],["\\dashv",8867],["\\roundimplies",10608],["\\in",8712],["\\notin",8713],["\\ni",8715],["\\owns",8715],["\\subset",8834],["\\supset",8835],["\\subseteq",8838],["\\supseteq",8839],["\\differencedelta",8710],["\\mvert",8739],["\\parallel",8741],["\\simeq",8771]],"mrel"),St([["\\lnot",172],["\\neg",172],["\\triangle",9651],["\\subsetneq",8842],["\\varsubsetneq",57370],["\\subsetneqq",10955],["\\varsubsetneqq",57367],["\\nsubset",8836],["\\nsupset",8837],["\\nsubseteq",8840],["\\nsupseteq",8841]],"mrel","ams"),St([["\\wp",8472],["\\aleph",8501]]),St([["\\blacktriangle",9650],["\\hslash",8463],["\\Finv",8498],["\\Game",8513],["\\eth",240],["\\mho",8487],["\\Bbbk",107],["\\yen",165],["\\square",9633],["\\Box",9633],["\\blacksquare",9632],["\\circledS",9416],["\\circledR",174],["\\triangledown",9661],["\\blacktriangledown",9660],["\\checkmark",10003],["\\diagup",9585],["\\measuredangle",8737],["\\sphericalangle",8738],["\\backprime",8245],["\\backdoubleprime",8246],["\\Diamond",9674],["\\lozenge",9674],["\\blacklozenge",10731],["\\varnothing",8709],["\\complement",8705],["\\maltese",10016],["\\beth",8502],["\\daleth",8504],["\\gimel",8503]],"mord","ams"),St([["\\ ",160],["~",160]],"space"),qt(["!",",",":",";",">","enskip","enspace","quad","qquad"],"",{createAtom:r=>new Jf(r)}),qt("space","",{createAtom:r=>new Jf(r)}),St([["\\colon",58],["\\cdotp",8901],["\\vdots",8942,"mord"],["\\ldotp",46],[",",44],[";",59]],"mpunct"),St([["\\cdots",8943],["\\ddots",8945],["\\ldots",8230],["\\mathellipsis",8230]],"minner"),St([["\\/",47],["|",8739,"mord"],["\\imath",305],["\\jmath",567],["\\degree",176],["'",8242],['"',8221]]);var C0="<mo>&#x2061;</mo>",mp="<mo>&#8290;</mo>";function gl(r){return r.replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Mo(r,o){return!r||!o.generateID?"":` extid="${r}"`}function dv(r,o,u){var d,g,b,M,N,I,F,$,it,gt,_t;let zt=!1;o=o!=null?o:r.atoms.length;let Ne="",Bi="",Ee=r.atoms[r.index];const hi=(g=(d=Ee.style)==null?void 0:d.variant)!=null?g:"",$i=(M=(b=Ee.style)==null?void 0:b.variantStyle)!=null?M:"";let xi="";if(hi||$i){const Rn=ze(Ee.value,(N=Ee.style)==null?void 0:N.variant,(I=Ee.style)==null?void 0:I.variantStyle);if(Rn!==Ee.value)return r.index+=1,Ne=`<mi${Mo(Ee.id,u)}>${Rn}</mi>`,_n(Ne,r,u)||(r.mathML+=Ne,r.lastType="mi"),!0;xi=(F={upnormal:"normal",boldnormal:"bold",italicmain:"italic",bolditalicmain:"bold-italic","updouble-struck":"double-struck","double-struck":"double-struck",boldfraktur:"bold-fraktur",calligraphic:"script",upcalligraphic:"script",script:"script",boldscript:"bold-script",boldcalligraphic:"bold-script",fraktur:"fraktur","upsans-serif":"sans-serif","boldsans-serif":"bold-sans-serif","italicsans-serif":"sans-serif-italic","bolditalicsans-serif":"sans-serif-bold-italic",monospace:"monospace"}[$i+hi])!=null?F:"",xi=` mathvariant="${xi}"`}const bn={"\\exponentialE":"&#x02147;","\\imaginaryI":"&#x2148;","\\differentialD":"&#x2146;","\\capitalDifferentialD":"&#x2145;","\\alpha":"&#x03b1;","\\pi":"&#x03c0;","\\infty":"&#x221e;","\\forall":"&#x2200;","\\nexists":"&#x2204;","\\exists":"&#x2203;","\\hbar":"\u210F","\\cdotp":"\u22C5","\\ldots":"\u2026","\\cdots":"\u22EF","\\ddots":"\u22F1","\\vdots":"\u22EE","\\ldotp":"."};if(Ee.command==="!")return r.index+=1,Ne="<mo>!</mo>",_n(Ne,r,u)||(r.mathML+=Ne,r.lastType="mo"),!0;if(bn[Ee.command]){r.index+=1;let Rn=`<mi${Mo(Ee.id,u)}${xi}>${bn[Ee.command]}</mi>`;return(r.lastType==="mi"||r.lastType==="mn"||r.lastType==="mtext"||r.lastType==="fence")&&(Rn=mp+Rn),_n(Rn,r,u)||(r.mathML+=Rn,r.lastType="mi"),!0}if(Ee.command==="\\operatorname")Bi=fd(Ee.body),r.index+=1;else if(hi||$i)for(;r.index<o&&(Ee.type==="mord"||Ee.type==="macro")&&!Ee.isDigit()&&hi===((it=($=Ee.style)==null?void 0:$.variant)!=null?it:"")&&$i===((_t=(gt=Ee.style)==null?void 0:gt.variantStyle)!=null?_t:"");)Bi+=fd([Ee]),r.index+=1,Ee=r.atoms[r.index];else(Ee.type==="mord"||Ee.type==="macro")&&!Ee.isDigit()&&(Bi+=fd([Ee]),r.index+=1);if(Bi.length>0){zt=!0,Ne=`<mi${xi}>${Bi}</mi>`;const Rn=r.lastType;Ne.endsWith(">f</mi>")||Ne.endsWith(">g</mi>")?(Ne+=C0,r.lastType="applyfunction"):r.lastType=/^<mo>(.*)<\/mo>$/.test(Ne)?"mo":"mi",_n(Ne,r,u)||((Rn==="mi"||Rn==="mn"||Rn==="mtext"||Rn==="fence")&&(Ne=mp+Ne),r.mathML+=Ne)}return zt}function Hm(r){return r.index<r.atoms.length&&r.atoms[r.index].superscript&&r.atoms[r.index].type==="subsup"}function fv(r){let o=-1,u=r.index,d=!1,g=!1;for(;u<r.atoms.length&&!d&&!g;){const b=r.atoms[u];d=!b.isDigit(),g=!d&&b.superscript!==void 0,u++}return g&&(o=u-1),o}function _n(r,o,u){var d;let g=o.atoms[o.index-1];if(!g)return!1;if(!g.superscript&&!g.subscript)if(((d=o.atoms[o.index])==null?void 0:d.type)==="subsup")g=o.atoms[o.index],o.index+=1;else return!1;const b=o.lastType;o.lastType="";const M=Gr(g.superscript,u);o.lastType="";const N=Gr(g.subscript,u);if(o.lastType=b,!M&&!N)return!1;let I="";return M&&N?I=`<msubsup>${r}${N}${M}</msubsup>`:M?I=`<msup>${r}${M}</msup>`:N&&(I=`<msub>${r}${N}</msub>`),o.mathML+=I,o.lastType="",!0}function S1(r,o,u){o=o!=null?o:r.atoms.length;const d=r.index;let g="";for(;r.index<o&&r.atoms[r.index].mode==="text";)g+=r.atoms[r.index].value?r.atoms[r.index].value:" ",r.index+=1;return g.length>0?(r.mathML+=`<mtext ${Mo(r.atoms[d].id,u)}>${g}</mtext>`,r.lastType="mtext",!0):!1}function M1(r,o,u){o=o!=null?o:r.atoms.length;const d=r.index;let g="",b=fv(r);for(b>=0&&b<o&&(o=b);r.index<o&&r.atoms[r.index].isDigit();)g+=r.atoms[r.index].asDigit(),r.index+=1;return g.length<=0?!1:(g="<mn"+Mo(r.atoms[d].id,u)+">"+g+"</mn>",b<0&&Hm(r)&&(b=r.index,r.index+=1),_n(g,r,u)||(r.mathML+=g,r.lastType="mn"),!0)}function ky(r,o,u){let d=!1;o=o!=null?o:r.atoms.length;let g="",b="";if(r.index<o&&r.atoms[r.index].type==="mopen"){let M=!1,N=0;const I=r.index;let F=-1,$=I+1;for(;$<o&&!M;)r.atoms[$].type==="mopen"?N+=1:r.atoms[$].type==="mclose"&&(N-=1),N===-1&&(M=!0,F=$),$+=1;M&&(g="<mrow>",g+=dd(r.atoms[I],u),g+=Gr(r.atoms,u,I+1,F),g+=dd(r.atoms[F],u),g+="</mrow>",r.index=F+1,(r.lastType==="mi"||r.lastType==="mn"||r.lastType==="mfrac"||r.lastType==="fence")&&(r.mathML+=mp),_n(g,r,u)&&(d=!0,r.lastType="",g=""),b="fence")}return g.length>0&&(d=!0,r.mathML+=g,r.lastType=b),d}function C1(r,o,u){let d=!1;o=o!=null?o:r.atoms.length;let g="",b="";const M=r.atoms[r.index];if(!M)return!1;const N={"\\ne":"&ne;","\\neq":"&neq;","\\pm":"&#177;","\\times":"&#215;","\\colon":":","\\vert":"|","\\Vert":"\u2225","\\mid":"\u2223","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lbrack":"[","\\rbrack":"]","\\lparen":"(","\\rparen":")","\\langle":"\u27E8","\\rangle":"\u27E9","\\lfloor":"\u230A","\\rfloor":"\u230B","\\lceil":"\u2308","\\rceil":"\u2309"};if(N[M.command]){r.index+=1;const I=`<mo${Mo(M.id,u)}>${N[M.command]}</mo>`;return _n(I,r,u)||(r.mathML+=I,r.lastType="mo"),!0}if(r.index<o&&(M.type==="mbin"||M.type==="mrel"))g+=pv(r.atoms[r.index],u),r.index+=1,b="mo";else if(r.index<o&&(M.type==="mop"||M.type==="operator"||M.type==="extensible-symbol")){if(M.subsupPlacement==="over-under"&&(M.superscript||M.subscript)){const I=dd(M,u);return M.superscript&&M.subscript?(g+="<munderover>"+I,g+=Gr(M.subscript,u),g+=Gr(M.superscript,u),g+="</munderover>"):M.superscript?(g+="<mover>"+I,g+=Gr(M.superscript,u),g+="</mover>"):M.subscript&&(g+="<munder>"+I,g+=Gr(M.subscript,u),g+="</munder>"),r.mathML+=g,r.lastType="mo",r.index+=1,!0}{const I=r.atoms[r.index],F=I.value==="\\operatorname",$=F?'<mi class="MathML-Unit"'+Mo(I.id,u)+">"+fd(I.value)+"</mi>":dd(I,u);g+=$,!F&&!/^<mo>(.*)<\/mo>$/.test($)?(g+=C0,b="applyfunction"):b=F?"mi":"mo"}(r.lastType==="mi"||r.lastType==="mn")&&!/^<mo>(.*)<\/mo>$/.test(g)&&(g=mp+g),r.index+=1}return g.length>0&&(d=!0,_n(g,r,u)||(r.mathML+=g,r.lastType=b)),d}function Gr(r,o,u,d){o!=null||(o={});const g={atoms:[],index:u!=null?u:0,mathML:"",lastType:""};if(typeof r=="number"||typeof r=="boolean")g.mathML=r.toString();else if(typeof r=="string")g.mathML=r;else if(r instanceof oi)g.mathML=pv(r,o);else if(Array.isArray(r)){g.atoms=r;let b=0;for(d=d||(r?r.length:0);g.index<d;)if(S1(g,d,o)||M1(g,d,o)||dv(g,d,o)||C1(g,d,o)||ky(g,d,o))b+=1;else if(g.index<d){let M=pv(g.atoms[g.index],o);g.lastType==="mn"&&M.length>0&&g.atoms[g.index].type==="genfrac"&&(M="<mo>&#x2064;</mo>"+M),g.atoms[g.index].type==="genfrac"?g.lastType="mfrac":g.lastType="",g.index+=1,_n(M,g,o)?b+=1:M.length>0&&(g.mathML+=M,b+=1)}b>1&&(g.mathML="<mrow>"+g.mathML+"</mrow>")}return g.mathML}function dd(r,o){let u="";const d=fd(r.value);return d&&(u="<mo"+Mo(r.id,o)+">"+d+"</mo>"),u}function fd(r){if(!r)return"";if(typeof r=="string")return gl(r);if(!Array.isArray(r)&&typeof r.body=="string")return gl(r.body);let o="";for(const u of r)typeof u.value=="string"&&(o+=u.value);return gl(o)}function pv(r,o){var u,d,g,b,M,N,I,F,$,it,gt,_t,zt,Ne,Bi,Ee,hi,$i,xi,bn,Rn,En;if(r.mode==="text")return`<mi${Mo(r.id,o)}>${r.value}</mi>`;const Fr={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",longleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",longrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",overgroup:"\u23E0",undergroup:"\u23E1",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21D2",xRightarrow:"\u21D2",overleftharpoon:"\u21BC",xleftharpoonup:"\u21BC",overrightharpoon:"\u21C0",xrightharpoonup:"\u21C0",xLeftarrow:"\u21D0",xLeftrightarrow:"\u21D4",xhookleftarrow:"\u21A9",xhookrightarrow:"\u21AA",xmapsto:"\u21A6",xrightharpoondown:"\u21C1",xleftharpoondown:"\u21BD",xrightleftharpoons:"\u21CC",longrightleftharpoons:"\u21CC",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xleftrightarrows:"\u21C4",xRightleftharpoons:"\u21CC",longRightleftharpoons:"\u21CC",xLeftrightharpoons:"\u21CB",longLeftrightharpoons:"\u21CB"},Po={"\\!":-3/18,"\\ ":6/18,"\\,":3/18,"\\:":4/18,"\\>":4/18,"\\;":5/18,"\\enspace":.5,"\\quad":1,"\\qquad":2,"\\enskip":.5};let Yi="",Nu="",Au,Du,pa,Iu,el,Vr;const{command:No}=r;if(r.command==="\\error")return`<merror${Mo(r.id,o)}>${Gr(r.body,o)}</merror>`;const Gs={"\\vert":"|","\\Vert":"\u2225","\\mid":"\u2223","\\lbrack":"[","\\rbrack":"]","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"\u27E8","\\rangle":"\u27E9","\\lfloor":"\u230A","\\rfloor":"\u230B","\\lceil":"\u2308","\\rceil":"\u2309"},ph={"\\vec":"&#x20d7;","\\acute":"&#x00b4;","\\grave":"&#x0060;","\\dot":"&#x02d9;","\\ddot":"&#x00a8;","\\tilde":"&#x007e;","\\bar":"&#x00af;","\\breve":"&#x02d8;","\\check":"&#x02c7;","\\hat":"&#x005e;"};switch(r.type){case"first":break;case"group":case"root":Yi=Gr(r.body,o);break;case"array":if((r.leftDelim&&r.leftDelim!=="."||r.rightDelim&&r.rightDelim!==".")&&(Yi+="<mrow>",r.leftDelim&&r.leftDelim!=="."&&(Yi+="<mo>"+(Gs[r.leftDelim]||r.leftDelim)+"</mo>")),Yi+="<mtable",r.colFormat){for(Yi+=' columnalign="',pa=0;pa<r.colFormat.length;pa++)r.colFormat[pa].align&&(Yi+={l:"left",c:"center",r:"right"}[r.colFormat[pa].align]+" ");Yi+='"'}for(Yi+=">",Du=0;Du<r.array.length;Du++){for(Yi+="<mtr>",Au=0;Au<r.array[Du].length;Au++)Yi+="<mtd>"+Gr(r.array[Du][Au],o)+"</mtd>";Yi+="</mtr>"}Yi+="</mtable>",(r.leftDelim&&r.leftDelim!=="."||r.rightDelim&&r.rightDelim!==".")&&(r.rightDelim&&r.rightDelim!=="."&&(Yi+="<mo>"+(Gs[r.leftDelim]||r.rightDelim)+"</mo>"),Yi+="</mrow>");break;case"genfrac":(r.leftDelim||r.rightDelim)&&(Yi+="<mrow>"),r.leftDelim&&r.leftDelim!=="."&&(Yi+="<mo"+Mo(r.id,o)+">"+(Gs[r.leftDelim]||r.leftDelim)+"</mo>"),r.hasBarLine?(Yi+="<mfrac>",Yi+=Gr(r.above,o)||"<mi>&nbsp;</mi>",Yi+=Gr(r.below,o)||"<mi>&nbsp;</mi>",Yi+="</mfrac>"):(Yi+="<mtable"+Mo(r.id,o)+">",Yi+="<mtr>"+Gr(r.above,o)+"</mtr>",Yi+="<mtr>"+Gr(r.below,o)+"</mtr>",Yi+="</mtable>"),r.rightDelim&&r.rightDelim!=="."&&(Yi+="<mo"+Mo(r.id,o)+">"+(Gs[r.rightDelim]||r.rightDelim)+"</mo>"),(r.leftDelim||r.rightDelim)&&(Yi+="</mrow>");break;case"surd":r.hasEmptyBranch("above")?(Yi+="<msqrt"+Mo(r.id,o)+">",Yi+=Gr(r.body,o),Yi+="</msqrt>"):(Yi+="<mroot"+Mo(r.id,o)+">",Yi+=Gr(r.body,o),Yi+=Gr(r.above,o),Yi+="</mroot>");break;case"leftright":const fu=r,Ou=fu.leftDelim;Yi="<mrow>",Ou&&Ou!=="."&&(Yi+=`<mo${Mo(r.id,o)}>${(u=Gs[Ou])!=null?u:Ou}</mo>`),r.body&&(Yi+=Gr(r.body,o));const mh=fu.matchingRightDelim();mh&&mh!=="."&&(Yi+=`<mo${Mo(r.id,o)}>${(d=Gs[mh])!=null?d:mh}</mo>`),Yi+="</mrow>";break;case"sizeddelim":case"delim":Yi+=`<mo${Mo(r.id,o)}>${Gs[r.value]||r.value}</mo>`;break;case"accent":Yi+='<mover accent="true"'+Mo(r.id,o)+">",Yi+=Gr(r.body,o),Yi+="<mo>"+(ph[No]||r.accent)+"</mo>",Yi+="</mover>";break;case"line":case"overlap":break;case"overunder":el=r.above,Iu=r.below,(r.svgAbove||el)&&(r.svgBelow||Iu)?Vr=r.body:el&&el.length>0?(Vr=r.body,(b=(g=r.body)==null?void 0:g[0])!=null&&b.below?(Iu=r.body[0].below,Vr=r.body[0].body):((N=(M=r.body)==null?void 0:M[0])==null?void 0:N.type)==="first"&&((F=(I=r.body)==null?void 0:I[1])!=null&&F.below)&&(Iu=r.body[1].below,Vr=r.body[1].body)):Iu&&Iu.length>0&&(Vr=r.body,(it=($=r.body)==null?void 0:$[0])!=null&&it.above?(el=r.body[0].above,Vr=r.body[0].body):((_t=(gt=r.body)==null?void 0:gt[0])==null?void 0:_t.type)==="first"&&((Ne=(zt=r.body)==null?void 0:zt[1])!=null&&Ne.above)&&(el=r.body[1].overscript,Vr=r.body[1].body)),(r.svgAbove||el)&&(r.svgBelow||Iu)?(Yi+=`<munderover ${Mo(r.id,o)}>`,Yi+=(Bi=Fr[r.svgBody])!=null?Bi:Gr(Vr,o),Yi+=(Ee=Fr[r.svgBelow])!=null?Ee:Gr(Iu,o),Yi+=(hi=Fr[r.svgAbove])!=null?hi:Gr(el,o),Yi+="</munderover>"):r.svgAbove||el?(Yi+=`<mover ${Mo(r.id,o)}>`+(($i=Fr[r.svgBody])!=null?$i:Gr(Vr,o)),Yi+=(xi=Fr[r.svgAbove])!=null?xi:Gr(el,o),Yi+="</mover>"):(r.svgBelow||Iu)&&(Yi+=`<munder ${Mo(r.id,o)}>`+((bn=Fr[r.svgBody])!=null?bn:Gr(Vr,o)),Yi+=(Rn=Fr[r.svgBelow])!=null?Rn:Gr(Iu,o),Yi+="</munder>");break;case"placeholder":Yi+="?";break;case"mord":{Yi=typeof r.value=="string"?r.value:No,No==="\\char"?Yi="&#x"+("000000"+r.args[0].number.toString(16)).slice(-4)+";":Yi.length>0&&Yi.startsWith("\\")&&(typeof r.value=="string"&&r.value.charCodeAt(0)>255?Yi="&#x"+("000000"+r.value.charCodeAt(0).toString(16)).slice(-4)+";":typeof r.value=="string"?Yi=r.value.charAt(0):(console.error("Did not expect this"),Yi=""));const Bu=/\d/.test(Yi)?"mn":"mi";Yi=`<${Bu}${Mo(r.id,o)}>${gl(Yi)}</${Bu}>`;break}case"mbin":case"mrel":case"minner":Yi=dd(r,o);break;case"mpunct":Yi='<mo separator="true"'+Mo(r.id,o)+">"+No+"</mo>";break;case"mop":case"operator":case"extensible-symbol":r.body!=="\u200B"&&(Yi="<mo"+Mo(r.id,o)+">",Yi+=No==="\\operatorname"?r.body:No||r.body,Yi+="</mo>");break;case"box":Yi='<menclose notation="box"',r.backgroundcolor&&(Yi+=' mathbackground="'+r.backgroundcolor+'"'),Yi+=Mo(r.id,o)+">"+Gr(r.body,o)+"</menclose>";break;case"spacing":Yi+='<mspace width="'+((En=Po[No])!=null?En:0)+'em"/>';break;case"enclose":Yi='<menclose notation="';for(const Bu in r.notation)Object.prototype.hasOwnProperty.call(r.notation,Bu)&&r.notation[Bu]&&(Yi+=Nu+Bu,Nu=" ");Yi+=Mo(r.id,o)+'">'+Gr(r.body,o)+"</menclose>";break;case"prompt":Yi='<menclose notation="roundexbox""">'+Gr(r.body,o)+"</menclose>";break;case"space":Yi+="&nbsp;";break;case"subsup":break;case"phantom":break;case"composition":break;case"rule":break;case"chem":break;case"mopen":Yi+=dd(r,o);break;case"mclose":Yi+=dd(r,o);break;case"macro":{const Bu=r.command+fd(r.macroArgs);Bu&&(Yi+=`<mo ${Mo(r.id,o)}>${Bu}</mo>`)}break;case"latexgroup":Yi+=Gr(r.body,o);break;case"latex":Yi+="<mtext"+Mo(r.id,o)+">"+r.value+"</mtext>";break;case"tooltip":Yi+=Gr(r.body,o);break;case"text":Yi+=`<mtext ${Mo(r.id,o)}x>${r.value}</mtext>`;break;default:if(r.command==="\\displaystyle")return`<mrow ${Mo(r.id,o)} displaystyle="true">${Gr(r.body,o)}</mrow>`;if(r.command==="\\textstyle")return`<mrow ${Mo(r.id,o)} displaystyle="false">${Gr(r.body,o)}</mrow>`;console.info("Unexpected element in conversion to MathML:",r)}return Yi}var gp={"\\alpha":"alpha ","\\mu":"mew ","\\sigma":"sigma ","\\pi":"pie ","\\imaginaryI":"imaginary eye ","\\imaginaryJ":"imaginary jay ","\\sum":"Summation ","\\prod":"Product ","+":"plus ","-":"minus ",";":'<break time="150ms"/> semi-colon <break time="150ms"/>',",":'<break time="150ms"/> comma <break time="150ms"/>',"|":'<break time="150ms"/>Vertical bar<break time="150ms"/>',"(":'<break time="150ms"/>Open paren. <break time="150ms"/>',")":'<break time="150ms"/> Close paren. <break time="150ms"/>',"=":"equals ","<":"is less than ","\\lt":"is less than ","<=":"is less than or equal to ","\\le":"is less than or equal to ","\\gt":"is greater than ",">":"is greater than ","\\pm":"plus or minus","\\mp":"minus or plus","\\ge":"is greater than or equal to ","\\geq":"is greater than or equal to ","\\leq":"is less than or equal to ","\\ne":"is not equal to ","\\neq":"is not equal to ","!":"factorial ","\\sin":"sine ","\\cos":"cosine ","\u200B":"","\u2212":"minus ",":":'<break time="150ms"/> such that <break time="200ms"/> ',"\\colon":'<break time="150ms"/> such that <break time="200ms"/> ',"\\hbar":"etch bar ","\\iff":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\Longleftrightarrow":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\land":"and ","\\lor":"or ","\\neg":"not ","\\div":"divided by ","\\forall":"for all ","\\exists":"there exists ","\\nexists":"there does not exists ","\\in":"element of ","\\N":'the set <break time="150ms"/><say-as interpret-as="character">n</say-as>',"\\C":'the set <break time="150ms"/><say-as interpret-as="character">c</say-as>',"\\Z":'the set <break time="150ms"/><say-as interpret-as="character">z</say-as>',"\\Q":'the set <break time="150ms"/><say-as interpret-as="character">q</say-as>',"\\infty":"infinity ","\\nabla":"nabla ","\\partial":"partial derivative of ","\\cdot":"times ","\\cdots":"dot dot dot ","\\Rightarrow":"implies ","\\lparen":'<break time="150ms"/>open paren<break time="150ms"/>',"\\rparen":'<break time="150ms"/>close paren<break time="150ms"/>',"\\lbrace":'<break time="150ms"/>open brace<break time="150ms"/>',"\\{":'<break time="150ms"/>open brace<break time="150ms"/>',"\\rbrace":'<break time="150ms"/>close brace<break time="150ms"/>',"\\}":'<break time="150ms"/>close brace<break time="150ms"/>',"\\langle":'<break time="150ms"/>left angle bracket<break time="150ms"/>',"\\rangle":'<break time="150ms"/>right angle bracket<break time="150ms"/>',"\\lfloor":'<break time="150ms"/>open floor<break time="150ms"/>',"\\rfloor":'<break time="150ms"/>close floor<break time="150ms"/>',"\\lceil":'<break time="150ms"/>open ceiling<break time="150ms"/>',"\\rceil":'<break time="150ms"/>close ceiling<break time="150ms"/>',"\\vert":'<break time="150ms"/>vertical bar<break time="150ms"/>',"\\mvert":'<break time="150ms"/>divides<break time="150ms"/>',"\\lvert":'<break time="150ms"/>left vertical bar<break time="150ms"/>',"\\rvert":'<break time="150ms"/>right vertical bar<break time="150ms"/>',"\\lbrack":'<break time="150ms"/> open square bracket <break time="150ms"/>',"\\rbrack":'<break time="150ms"/> close square bracket <break time="150ms"/>',mm:"millimeters",cm:"centimeters",km:"kilometers",kg:"kilograms"},mv={array:"array",matrix:"matrix",pmatrix:"parenthesis matrix",bmatrix:"square brackets matrix",Bmatrix:"braces matrix",vmatrix:"bars matrix",Vmatrix:"double bars matrix","matrix*":"matrix",smallmatrix:"small matrix"};function Zo(r){let o="";return r.startsWith("\\")&&(o=" "+r.replace("\\","")+" "),o}function k0(r){let o=0;if(pt(r))for(const u of r)u.type!=="first"&&(o+=1);return o===1}function k1(r){if(pt(r)){for(const o of r)if(o.type!=="first"&&o.id)return o.id.toString()}return""}function Ly(r){let o="";if(pt(r))for(const u of r)u.type!=="first"&&typeof u.value=="string"&&(o+=u.value);return o}function vl(r){return r?r.map(o=>o.value).join(""):""}function kr(r,o){var u,d,g,b,M;function N($){return window.MathfieldElement.textToSpeechMarkup?/[a-z]/.test($)?` <say-as interpret-as="character">${$}</say-as>`:/[A-Z]/.test($)?`capital <say-as interpret-as="character">${$.toLowerCase()}</say-as>`:$:/[a-z]/.test($)?" '"+$.toUpperCase()+"'":/[A-Z]/.test($)?" 'capital "+$.toUpperCase()+"'":$}function I($){return"<emphasis>"+$+"</emphasis>"}if(!o)return"";let F="";if(pt(o)){let $=!1,it=!1;for(let gt=0;gt<o.length;gt++)o[gt].type!=="first"&&(o[gt].mode!=="text"&&(it=!1),gt<o.length-2&&o[gt].type==="mopen"&&o[gt+2].type==="mclose"&&o[gt+1].type==="mord"?(F+=" of ",F+=I(kr(r,o[gt+1])),gt+=2):o[gt].mode==="text"?it?F+=(u=o[gt].value)!=null?u:" ":(it=!0,F+=kr("text",o[gt])):o[gt].isDigit()?$?F+=o[gt].asDigit():($=!0,F+=kr(r,o[gt])):($=!1,F+=kr(r,o[gt])))}else if(o.mode==="text")o.id&&r==="math"&&(F+='<mark name="'+o.id.toString()+'"/>'),F+=o.value;else{o.id&&r==="math"&&(F+='<mark name="'+o.id.toString()+'"/>');let $="",it="",gt="",_t=!1;const{command:zt}=o;switch(zt){case"\\vec":return"vector "+kr(r,o.body);case"\\acute":return kr(r,o.body)+" acute";case"\\grave":return kr(r,o.body)+" grave";case"\\dot":return"dot over"+kr(r,o.body);case"\\ddot":return"double dot over"+kr(r,o.body);case"\\mathring":return"ring over"+kr(r,o.body);case"\\tilde":case"\\widetilde":return"tilde over"+kr(r,o.body);case"\\bar":return kr(r,o.body)+" bar";case"\\breve":return kr(r,o.body)+" breve";case"\\check":case"\\widecheck":return"check over "+kr(r,o.body);case"\\hat":case"\\widehat":return"hat over"+kr(r,o.body);case"\\overarc":case"\\overparen":case"\\wideparen":return"arc over "+kr(r,o.body);case"\\underarc":case"\\underparen":return"arc under "+kr(r,o.body)}switch(o.type){case"prompt":const Ne=o.body.length>1?'start input . <break time="500ms"/> '+kr(r,o.body)+'. <break time="500ms"/> end input':"blank";F+=' <break time="300ms"/> '+Ne+'. <break time="700ms"/>'+((d=o.correctness)!=null?d:"")+' . <break time="700ms"/> ';break;case"array":const Bi=o.array,Ee=o.environmentName;if(Object.keys(mv).includes(Ee)){F+=` begin ${mv[Ee]} `;for(let xi=0;xi<Bi.length;xi++){xi>0&&(F+=","),F+=` row ${xi+1} `;for(let bn=0;bn<Bi[xi].length;bn++)bn>0&&(F+=","),F+=` column ${bn+1}: `,F+=kr("math",Bi[xi][bn])}F+=` end ${mv[Ee]} `}break;case"group":zt==="\\ne"?F+=" not equal ":(zt==="\\not"&&(F+=" not "),F+=kr("math",o.body));break;case"root":F+=kr("math",o.body);break;case"genfrac":if($=kr("math",o.above),it=kr("math",o.below),k0(o.above)&&k0(o.below)){const bn={"1/2":" half ","1/3":" one third ","2/3":" two third","1/4":" one quarter ","3/4":" three quarter ","1/5":" one fifth ","2/5":" two fifths ","3/5":" three fifths ","4/5":" four fifths ","1/6":" one sixth ","5/6":" five sixths ","1/8":" one eight ","3/8":" three eights ","5/8":" five eights ","7/8":" seven eights ","1/9":" one ninth ","2/9":" two ninths ","4/9":" four ninths ","5/9":" five ninths ","7/9":" seven ninths ","8/9":" eight ninths "}[Ly(o.above)+"/"+Ly(o.below)];bn?F=bn:F+=$+" over "+it}else F+=' the fraction <break time="150ms"/>'+$+' over <break time="150ms"/>'+it+'.<break time="150ms"/> End fraction.<break time="150ms"/>';break;case"surd":if(gt=kr("math",o.body),o.hasEmptyBranch("above"))F+=k0(o.body)?" the square root of "+gt+" , ":' the square root of <break time="200ms"/>'+gt+'. <break time="200ms"/> End square root';else{let xi=kr("math",o.above);xi=xi.trim();const bn=xi.replace(/<mark([^/]*)\/>/g,"");bn==="3"?F+=' the cube root of <break time="200ms"/>'+gt+'. <break time="200ms"/> End cube root':bn==="n"?F+=' the nth root of <break time="200ms"/>'+gt+'. <break time="200ms"/> End root':F+=' the root with index: <break time="200ms"/>'+xi+', of <break time="200ms"/>'+gt+'. <break time="200ms"/> End root'}break;case"leftright":{const xi=o;F+=(g=xi.leftDelim?gp[xi.leftDelim]:void 0)!=null?g:xi.leftDelim,F+=kr("math",o.body),F+=(b=xi.rightDelim?gp[xi.rightDelim]:void 0)!=null?b:xi.rightDelim}break;case"rule":break;case"overunder":break;case"overlap":break;case"macro":const hi=zt.replace(/^\\/g,""),$i=ln()[hi];$i&&($i!=null&&$i.expand?F+=kr("math",o.body):F+=`${hi} `);break;case"placeholder":F+="placeholder ";break;case"delim":case"sizeddelim":case"mord":case"minner":case"mbin":case"mrel":case"mpunct":case"mopen":case"mclose":{if(zt==="\\mathbin"||zt==="\\mathrel"||zt==="\\mathopen"||zt==="\\mathclose"||zt==="\\mathpunct"||zt==="\\mathord"||zt==="\\mathinner"){F=kr(r,o.body);break}let xi=o.isDigit()?o.asDigit():o.value,bn=o.command;if((o.type==="delim"||o.type==="sizeddelim")&&(bn=o.value,xi=bn),r==="text")F+=xi;else{if(o.type==="mbin"&&(F+='<break time="150ms"/>'),xi){const Rn=gp[xi]||(bn?gp[bn.trim()]:"");if(Rn)F+=" "+Rn;else{const En=bn?Zo(bn.trim()):"";F+=En||N(xi)}}else F+=kr("math",o.body);o.type==="mbin"&&(F+='<break time="150ms"/>')}break}case"mop":case"operator":case"extensible-symbol":if(o.value!=="\u200B"){const xi=o.command;if(xi==="\\sum")if(!o.hasEmptyBranch("superscript")&&!o.hasEmptyBranch("subscript")){let bn=kr("math",o.superscript);bn=bn.trim();let Rn=kr("math",o.subscript);Rn=Rn.trim(),F+=' the summation from <break time="200ms"/>'+Rn+'<break time="200ms"/> to <break time="200ms"/>'+bn+'<break time="200ms"/> of <break time="150ms"/>',_t=!0}else if(o.hasEmptyBranch("subscript"))F+=" the summation of";else{let bn=kr("math",o.subscript);bn=bn.trim(),F+=' the summation from <break time="200ms"/>'+bn+'<break time="200ms"/> of <break time="150ms"/>',_t=!0}else if(xi==="\\prod")if(!o.hasEmptyBranch("superscript")&&!o.hasEmptyBranch("subscript")){let bn=kr("math",o.superscript);bn=bn.trim();let Rn=kr("math",o.subscript);Rn=Rn.trim(),F+=' the product from <break time="200ms"/>'+Rn+'<break time="200ms"/> to <break time="200ms"/>'+bn+'<break time="200ms"/> of <break time="150ms"/>',_t=!0}else if(o.hasEmptyBranch("subscript"))F+=" the product of ";else{let bn=kr("math",o.subscript);bn=bn.trim(),F+=' the product from <break time="200ms"/>'+bn+'<break time="200ms"/> of <break time="150ms"/>',_t=!0}else if(xi==="\\int")if(!o.hasEmptyBranch("superscript")&&!o.hasEmptyBranch("subscript")){let bn=kr("math",o.superscript);bn=bn.trim();let Rn=kr("math",o.subscript);Rn=Rn.trim(),F+=' the integral from <break time="200ms"/>'+I(Rn)+'<break time="200ms"/> to <break time="200ms"/>'+I(bn)+' <break time="200ms"/> of ',_t=!0}else F+=' the integral of <break time="200ms"/> ';else if(typeof o.value=="string"){const bn=(M=gp[o.value])!=null?M:o.command?gp[o.command]:void 0;F+=bn||" "+o.value}else o.command&&(o.command==="\\mathop"?F+=kr("math",o.body):o.command==="\\operatorname"?F+=vl(o.body):F+=o.command.startsWith("\\")?" "+o.command.slice(1):" "+o.command)}break;case"enclose":gt=kr("math",o.body),F+=" crossed out "+gt+". End crossed out.";break;case"space":case"spacing":break}if(!_t&&!o.hasEmptyBranch("superscript")){let Ne=kr(r,o.superscript);Ne=Ne.trim();const Bi=Ne.replace(/<[^>]*>/g,"");if(k0(o.superscript)){if(r==="math"){const Ee=k1(o.superscript);Ee&&(F+='<mark name="'+Ee+'"/>')}Bi==="\u2032"?F+=" prime ":Bi==="2"?F+=" squared ":Bi==="3"?F+=" cubed ":Number.isNaN(Number.parseInt(Bi))?F+=" to the "+Ne+"; ":F+=' to the <say-as interpret-as="ordinal">'+Bi+"</say-as> power; "}else Number.isNaN(Number.parseInt(Bi))?F+=" raised to the "+Ne+"; ":F+=' raised to the <say-as interpret-as="ordinal">'+Bi+"</say-as> power; "}if(!_t&&!o.hasEmptyBranch("subscript")){let Ne=kr("math",o.subscript);Ne=Ne.trim(),F+=k0(o.subscript)?" sub "+Ne:" subscript "+Ne+". End subscript. "}}return F}function Ve(r){var o,u;if(window.MathfieldElement.textToSpeechRules==="sre"&&("sre"in window||"SRE"in window)){const g=Gr(r);if(g){window.MathfieldElement.textToSpeechMarkup&&(window.MathfieldElement.textToSpeechRulesOptions=(o=window.MathfieldElement.textToSpeechRulesOptions)!=null?o:{},window.MathfieldElement.textToSpeechRulesOptions=rt(Q({},window.MathfieldElement.textToSpeechRulesOptions),{markup:window.MathfieldElement.textToSpeechMarkup}),window.MathfieldElement.textToSpeechRulesOptions.markup==="ssml"&&(window.MathfieldElement.textToSpeechRulesOptions=rt(Q({},window.MathfieldElement.textToSpeechRulesOptions),{markup:"ssml_step"})),window.MathfieldElement.textToSpeechRulesOptions=rt(Q({},window.MathfieldElement.textToSpeechRulesOptions),{rate:window.MathfieldElement.speechEngineRate}));const b=(u=window.SRE)!=null?u:window.sre.System.getInstance();window.MathfieldElement.textToSpeechRulesOptions&&b.setupEngine(window.MathfieldElement.textToSpeechRulesOptions);let M="";try{M=b.toSpeech(g)}catch(N){console.error("MathLive 0.98.5: `SRE.toSpeech()` runtime error",N)}return M}return""}let d=kr("math",r);if(window.MathfieldElement.textToSpeechMarkup==="ssml"){let g="";window.MathfieldElement.speechEngineRate&&(g='<prosody rate="'+window.MathfieldElement.speechEngineRate+'">'),d='<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"><amazon:auto-breaths>'+g+"<p><s>"+d+"</s></p>"+(g?"</prosody>":"")+"</amazon:auto-breaths></speak>"}else window.MathfieldElement.textToSpeechMarkup==="mac"&&Ht()==="macos"?d=d.replace(/<mark([^/]*)\/>/g,"").replace(/<emphasis>/g,"[[emph+]]").replace(/<\/emphasis>/g,"").replace(/<break time="(\d*)ms"\/>/g,"[[slc $1]]").replace(/<say-as[^>]*>/g,"").replace(/<\/say-as>/g,""):d=d.replace(/<[^>]*>/g,"").replace(/\s{2,}/g," ");return d}var Ec={"\\ne":"\u2260","\\neq":"\u2260","\u2212":"-","-":"-","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\delta":"delta","\\epsilon":"epsilon","\\varepsilon":"varepsilon","\\zeta":"zeta","\\eta":"eta","\\theta":"theta","\\vartheta":"vartheta","\\iota":"iota","\\kappa":"kappa","\\lambda":"lambda","\\mu":"mu","\\nu":"nu","\\xi":"xi","\\pi":"pi","\\rho":"rho","\\sigma":"sigma","\\tau":"tau","\\upsilon":"upsilon","\\phi":"phi","\\varphi":"varphi","\\chi":"chi","\\psi":"psi","\\omega":"omega","\\Gamma":"Gamma","\\Delta":"Delta","\\Theta":"Theta","\\Lambda":"Lambda","\\Xi":"Xi","\\Pi":"Pi","\\Sigma":"Sigma","\\Phi":"Phi","\\Psi":"Psi","\\Omega":"Omega","\\exponentialE":"e","\\imaginaryI":"i","\\imaginaryJ":"j","\\!":" ","\\,":" ","\\:":" ","\\>":" ","\\;":" ","\\enskip":" ","\\enspace":" ","\\qquad":" ","\\quad":" ","\\infty":"oo"},L0={"\\pm":"+-","\\colon":":","\\vert":"|","\\Vert":"||","\\mid":"|","\\lbrack":"[","\\rbrack":"]","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"(:","\\rangle":":)","\\sum":" sum ","\\prod":" prod ","\\bigcap":" nnn ","\\bigcup":" uuu ","\\int":" int ","\\oint":" oint ","\\ge":">=","\\le":"<=","\\ne":"!=","\\neq":"!=","\\lt":"<","\\gt":">","\\gets":"<-","\\to":"->","\\land":" and ","\\lor":" or ","\\lnot":" not ","\\forall":" AA ","\\exists":" EE ","\\in":" in ","\\notin":" !in ","\\mapsto":"|->","\\implies":"=>","\\iff":"<=>","\\cdot":"*","\\ast":"**","\\star":"***","\\times":"xx","\\div":"-:","\\ltimes":"|><","\\rtimes":"><|","\\bowtie":"|><|","\\circ":"@"};function L1(r){let o="";for(const u of r){const d=o[o.length-1];d!==void 0&&/\d/.test(d)&&/^\d/.test(u)&&(o+=" "),o+=u}return o}function _s(r){var o,u,d,g,b,M,N,I,F,$,it,gt,_t;if(!r)return"";if(pt(r)){if(r.length===0)return"";if(r[0].mode==="latex")return r.map(_s).join("");if(r[0].mode==="text"){let $i=0,xi="";for(;((o=r[$i])==null?void 0:o.mode)==="text";)xi+=r[$i].body?_s(r[$i].body):r[$i].value,$i++;return`"${xi}" ${_s(r.slice($i))}`}let Ee=0;const hi=[];for(;r[Ee]&&r[Ee].mode==="math";){let $i="";for(;r[Ee]&&r[Ee].type==="mord"&&/\d/.test(r[Ee].value);)$i+=r[Ee++].value;$i?hi.push($i):hi.push(_s(r[Ee++]))}return hi.push(_s(r.slice(Ee))),L1(hi)}if(r.mode==="text")return`"${r.value}"`;let zt="";const{command:Ne}=r;let Bi;if(Ne==="\\placeholder")return`(${_s(r.body)})`;switch(r.type){case"accent":const Ee={"\\vec":"vec","\\dot":"dot","\\ddot":"ddot","\\bar":"bar","\\hat":"hat","\\acute":"acute;","\\grave":"grave","\\tilde":"tilde","\\breve":"breave","\\check":"check"}[Ne];zt=`${Ee!=null?Ee:""} ${_s(r.body)} `;break;case"first":return"";case"latexgroup":return r.body.map(En=>En.value).join("");case"group":case"root":zt=(u=Ec[Ne])!=null?u:_s(r.body);break;case"genfrac":{const En=r;(En.leftDelim||En.rightDelim)&&(zt=En.leftDelim==="."||!En.leftDelim?"{:":En.leftDelim),En.hasBarLine?(zt+="(",zt+=_s(En.above),zt+=")/(",zt+=_s(En.below),zt+=")"):(zt+="("+_s(En.above)+"),",zt+="("+_s(En.below)+")"),(En.leftDelim||En.rightDelim)&&(zt+=En.rightDelim==="."||!En.rightDelim?"{:":En.rightDelim)}break;case"surd":zt+=r.hasEmptyBranch("above")?"sqrt("+_s(r.body)+")":"root("+_s(r.above)+")("+_s(r.body)+")";break;case"latex":zt=r.value;break;case"leftright":{const En=r,Fr=En.leftDelim;zt+=Fr==="."||!Fr?"{:":Fr,zt+=_s(En.body);const Po=En.matchingRightDelim();zt+=Po==="."||!Po?":}":Po}break;case"sizeddelim":case"delim":zt=r.value;break;case"overlap":break;case"overunder":break;case"mord":zt=(g=(d=Ec[Ne])!=null?d:Ne)!=null?g:typeof r.value=="string"?r.value:"",zt.startsWith("\\")&&(zt+=" "),Bi=Ne?Ne.match(/{?\\char"([\dabcdefABCDEF]+)}?/):null,Bi?zt=String.fromCodePoint(Number.parseInt("0x"+Bi[1])):zt.length>0&&zt.startsWith("\\")&&(zt=typeof r.value=="string"?r.value.charAt(0):r.command),zt=gv(zt,r.style);break;case"mbin":case"mrel":case"minner":zt=(M=(b=Ec[Ne])!=null?b:L0[Ne])!=null?M:r.value;break;case"mopen":case"mclose":zt=r.value;break;case"mpunct":zt=(N=L0[Ne])!=null?N:Ne;break;case"mop":case"operator":case"extensible-symbol":r.value!=="\u200B"&&(L0[Ne]?zt=L0[Ne]:zt=Ne==="\\operatorname"?_s(r.body):(I=r.value)!=null?I:Ne,zt+=" ");break;case"array":const hi=r.array,$i=r.environmentName,xi=(F={bmatrix:["[","]"],"bmatrix*":["[","]"]}[$i])!=null?F:["(",")"],bn=[];for(const En of hi){const Fr=[];for(const Po of En)Fr.push(xi[0]+_s(Po)+xi[1]);bn.push(Fr.join(","))}const Rn=($={bmatrix:["[","]"],"bmatrix*":["[","]"],cases:["{",":}"]}[$i])!=null?$:["(",")"];zt=Rn[0]+bn.join(",")+Rn[1];break;case"box":break;case"spacing":zt=(it=Ec[Ne])!=null?it:" ";break;case"enclose":zt="("+_s(r.body)+")";break;case"space":zt=" ";break;case"subsup":zt="";break;case"macro":zt=(_t=(gt=Ec[Ne])!=null?gt:L0[Ne])!=null?_t:_s(r.body);break}if(!r.hasEmptyBranch("subscript")){zt+="_";const Ee=_s(r.subscript);zt+=Ee.length!==1?`(${Ee})`:Ee}if(!r.hasEmptyBranch("superscript")){zt+="^";const Ee=_s(r.superscript);zt+=Ee.length!==1?`(${Ee})`:Ee}return zt}function gv(r,o){if(!o)return r;let u=r;return o.variant==="double-struck"&&(u=`bbb "${u}"`),o.variant==="script"&&(u=`cc "${u}"`),o.variant==="fraktur"&&(u=`fr "${u}"`),o.variant==="sans-serif"&&(u=`sf "${u}"`),o.variant==="monospace"&&(u=`tt "${u}"`),o.variantStyle==="bold"&&(u=`bb "${u}"`),o.color?`color({${o.color}})(${u})`:u}function hs(r,o){var u,d;o!=null||(o={}),o.mathstyle=(u=o.mathstyle)!=null?u:"displaystyle";const g=new Dr({from:rt(Q({},Od()),{renderPlaceholder:()=>new zi(160,{maxFontSize:1}),letterShapeStyle:(d=o==null?void 0:o.letterShapeStyle)!=null?d:"tex"}),mathstyle:o.mathstyle}),M=new oi({mode:"math",type:"root",body:vs(r,{context:g,parseMode:"math",mathstyle:o.mathstyle})}).render(g);return M?(Dh(uh(M,g)),Id(M,{classes:"ML__latex"}).toMarkup()):""}function vx(r){return ed(r,{context:Od()})}function ia(r,o={}){return Gr(vs(r,{parseMode:"math",args:()=>"",mathstyle:"displaystyle"}),o)}function Ey(r){const o=vs(r,{parseMode:"math",mathstyle:"displaystyle"});return Ve(o)}var Ts;function yx(r){var o,u;if(!Ts){const d=(o=globalThis[Symbol.for("io.cortexjs.compute-engine")])==null?void 0:o.ComputeEngine;d?Ts=new d:console.error(`MathLive 0.98.5: The CortexJS Compute Engine library is not available.
Load the library, for example with:
import "https://unpkg.com/@cortex-js/compute-engine?module"`)}return(u=Ts==null?void 0:Ts.box(r).latex)!=null?u:""}function Co(r,o="math"){return _s(new oi({type:"root",body:vs(r,{parseMode:o})}))}function cf(r){return qc(r,{format:"ascii-math"})[1]}function vv(r){if(typeof r=="string"){const o=du(r);if(!o)throw new Error(`Invalid color: ${r}`);return o}return"C"in r?eo(r):"a"in r?yv(r):r}function vp(r){return r<0?0:r>255?255:Math.round(r)}function du(r){if(!r||r[0]!=="#")return;r=r.slice(1);let o;return r.length<=4?(o={r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16)},r.length===4&&(o.a=parseInt(r[3]+r[3],16)/255)):(o={r:parseInt(r[0]+r[1],16),g:parseInt(r[2]+r[3],16),b:parseInt(r[4]+r[5],16)},r.length===8&&(o.a=parseInt(r[6]+r[7],16)/255)),o&&typeof o.a=="undefined"&&(o.a=1),o}function Al(r){const[o,u,d]=[r.L,r.C,r.H],g=d*Math.PI/180,b={L:o,a:u*Math.cos(g),b:u*Math.sin(g)};return r.alpha!==void 0&&(b.alpha=r.alpha),b}function Vm(r){const[o,u,d]=[r.L,r.a,r.b],g=Math.sqrt(u*u+d*d),M=Math.atan2(d,u)*180/Math.PI,N={L:o,C:g,H:M};return r.alpha!==void 0&&(N.alpha=r.alpha),N}function E0(r){const[o,u,d]=[r.L,r.a,r.b],g=Math.pow(.9999999984505198*o+.39633779217376786*u+.2158037580607588*d,3),b=Math.pow(1.00000000888176*o-.10556134232365635*u-.0638541747717059*d,3),M=Math.pow(o*1.000000054672411-.0894841820949657*u-1.2914855378640917*d,3),N=4.076741661347994*g-3.307711590408193*b+.230969928729428*M,I=-1.2684380040921763*g+2.6097574006633715*b-.3413193963102197*M,F=-.004196086541837188*g-.7034186144594493*b+1.7076147009309444*M,$=it=>{const gt=Math.abs(it);return gt<=.0031308?it*12.92:(Math.sign(it)||1)*(1.055*Math.pow(gt,1/2.4)-.055)};return[$(N),$(I),$(F)]}function Wm(r){const[o,u,d]=r;return o>=0&&o<=1&&u>=0&&u<=1&&d>=0&&d<=1}function yp(r,o){let[u,d,g]=r;return u=vp(u*255),d=vp(d*255),g=vp(g*255),o!==void 0?{r:u,g:d,b:g,alpha:o}:{r:u,g:d,b:g}}function yv(r){let[o,u,d]=E0(r);if(Wm([o,u,d]))return yp([o,u,d],r.alpha);const g=Vm(r);if(g.C=0,[o,u,d]=E0(Al(g)),!Wm([o,u,d]))return yp([o,u,d],r.alpha);let b=0,M=r.L,N=(b+M)/2;g.C=N;const I=.36/Math.pow(2,12);for(;M-b>I;)N=(b+M)/2,g.C=N,[o,u,d]=E0(Al(g)),Wm([o,u,d])?b=N:M=N;return yp([o,u,d],r.alpha)}function eo(r){return yv(Al(r))}function mr(r,o){const u=vv(r),d=vv(o),g=.56,b=.57,M=.62,N=.65,I=.022,F=1.414,$=.1,it=5e-4,gt=1.14,_t=.027,zt=1.14,Ne=.027;function Bi(En){return En>=I?En:En+Ef(I-En,F)}function Ee(En){return(En<0?-1:1)*Math.pow(Math.abs(En),2.4)}const hi=Bi(Ee(d.r/255)*.2126729+Ee(d.g/255)*.7151522+Ee(d.b/255)*.072175),$i=Bi(Ee(u.r/255)*.2126729+Ee(u.g/255)*.7151522+Ee(u.b/255)*.072175);let xi,bn,Rn;return Math.abs($i-hi)<it?bn=0:$i>hi?(xi=Ef($i,g)-Ef(hi,b),bn=xi*gt):(xi=Ef($i,N)-Ef(hi,M),bn=xi*zt),Math.abs(bn)<$?Rn=0:bn>0?Rn=bn-Ne:Rn=bn+_t,Rn*100}function _y(r,o,u){u!=null||(u="#fff"),o!=null||(o="#000");const d=mr(r,u),g=mr(r,o);return Math.abs(d)>Math.abs(g)?u:o}function Xl(r){const o=vv(r);let u=((1<<24)+(vp(o.r)<<16)+(vp(o.g)<<8)+vp(o.b)).toString(16).slice(1);return o.alpha!==void 0&&o.alpha<1&&(u+=("00"+Math.round(o.alpha*255).toString(16)).slice(-2)),u[0]===u[1]&&u[2]===u[3]&&u[4]===u[5]&&u[6]===u[7]&&(u=u[0]+u[2]+u[4]+(o.alpha!==void 0&&o.alpha<1?u[6]:"")),"#"+u}function Un(r){const o=Ty(r);let u="";for(const d of o){if(typeof d.value!="string")return"";u+=d.value}return u}function Ty(r){const u=r.model.selection.ranges;return u.length!==1?[]:r.model.getAtoms(u[0])}function xx(r,o){const u=Ty(r);if(u.length!==1)return!1;const d=Wd[o];return d?!!d.test(u[0].value):!1}function E1(r,o){return Un(r).length>0}function Um(r){return[Lr(r,"double-struck","mathbb","tooltip.blackboard"),Lr(r,"fraktur","mathfrak","tooltip.fraktur"),Lr(r,"calligraphic","mathcal","tooltip.caligraphic"),xp(r,"up","mathrm","tooltip.roman-upright"),xp(r,"bold","mathbf","tooltip.bold"),xp(r,"italic","mathit","tooltip.italic")]}function xn(r){return[{label:()=>hs(`\\vec{${Un(r)}}`),visible:()=>Un(r).length===1,onMenuSelect:()=>r.insert("\\vec{#@}",{selectionMode:"item"})},{label:()=>hs(`\\overrightarrow{${Un(r)}}`),visible:()=>Un(r).length>0,onMenuSelect:()=>r.insert("\\overrightarrow{#@}",{selectionMode:"item"})},{label:()=>hs(`\\overleftarrow{${Un(r)}}`),visible:()=>Un(r).length>0,onMenuSelect:()=>r.insert("\\overleftarrow{#@}",{selectionMode:"item"})},{label:()=>hs(`\\dot{${Un(r)}}`),visible:()=>Un(r).length===1,onMenuSelect:()=>r.insert("\\dot{#@}",{selectionMode:"item"})},{label:()=>hs(`\\ddot{${Un(r)}}`),visible:()=>Un(r).length===1,onMenuSelect:()=>r.insert("\\ddot{#@}",{selectionMode:"item"})},{label:()=>hs(`\\bar{${Un(r)}}`),visible:()=>Un(r).length===1,onMenuSelect:()=>r.insert("\\bar{#@}",{selectionMode:"item"})},{label:()=>hs(`\\overline{${Un(r)}}`),visible:()=>Un(r).length>0,onMenuSelect:()=>r.insert("\\overline{#@}",{selectionMode:"item"})},{label:()=>hs(`\\overgroup{${Un(r)}}`),visible:()=>Un(r).length>0,onMenuSelect:()=>r.insert("\\overgroup{#@}",{selectionMode:"item"})},{label:()=>hs(`\\overbrace{${Un(r)}}`),visible:()=>Un(r).length>0,onMenuSelect:()=>r.insert("\\overbrace{#@}",{selectionMode:"item"})},{label:()=>hs(`\\underline{${Un(r)}}`),visible:()=>Un(r).length>0,onMenuSelect:()=>r.insert("\\underline{#@}",{selectionMode:"item"})},{label:()=>hs(`\\undergroup{${Un(r)}}`),visible:()=>Un(r).length>0,onMenuSelect:()=>r.insert("\\undergroup{#@}",{selectionMode:"item"})},{label:()=>hs(`\\underbrace{${Un(r)}}`),visible:()=>Un(r).length>0,onMenuSelect:()=>r.insert("\\underbrace{#@}",{selectionMode:"item"})}]}function _1(r){return[{label:()=>hs(`\\boxed{${r.getValue(r.model.selection)}}}`),onMenuSelect:()=>r.insert("\\boxed{#@}",{selectionMode:"item"})},{label:()=>hs(`\\bbox[5px, border: 2px solid red]{${r.getValue(r.model.selection)}}`),onMenuSelect:()=>r.insert("\\bbox[5px, border: 2px solid red]{#@}",{selectionMode:"item"})},{label:()=>hs(`\\bbox[5px, border: 2px dashed black]{${r.getValue(r.model.selection)}}`),onMenuSelect:()=>r.insert("\\bbox[5px, border: 2px dashed black]{#@}",{selectionMode:"item"})}]}function tl(r){const o=[];for(const u of Object.keys(Et))o.push({class:(Xl(_y(Et[u]))==="#000"?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${Et[u]} "></span>`,ariaLabel:()=>{var d;return(d=Xt(u))!=null?d:u},checked:()=>{var d;return{some:"mixed",all:!0}[(d=r.queryStyle({backgroundColor:u}))!=null?d:!1]},onMenuSelect:()=>{r.applyStyle({backgroundColor:u},{operation:"toggle"}),r.adoptStyle="none"}});return o}function _0(r){const o=[];for(const u of Object.keys(Bt))o.push({class:(_y(Bt[u])==="#000"?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${Bt[u]} "></span>`,ariaLabel:()=>{var d;return(d=Xt(u))!=null?d:u},checked:()=>{var d;return{some:"mixed",all:!0}[(d=r.queryStyle({color:u}))!=null?d:!1]},onMenuSelect:()=>{r.applyStyle({color:u},{operation:"toggle"}),r.adoptStyle="none"}});return o}var xv=class extends M0{constructor(r,o,u,d){super(r,o),this.row=u,this.col=d}set active(r){const o=this.parentMenu.children;if(r)for(const u of o)u.element.classList.toggle("active",u.row<=this.row&&u.col<=this.col);else for(const u of o)u.element.classList.remove("active")}};function T0(r){const o=[];for(let u=1;u<=5;u++)for(let d=1;d<=5;d++)o.push({onCreate:(g,b)=>new xv(g,b,u,d),label:"\u2610",tooltip:()=>Xt("tooltip.row-by-col",u,d),data:{row:u,col:d},onMenuSelect:()=>{r.insert(`\\begin{pmatrix}${Array(u).fill(Array(d).fill("#?").join(" & ")).join("\\\\")}\\end{pmatrix}`,{selectionMode:"item"})}});return o}function T1(r){return[{label:()=>Xt("menu.array.add row above"),id:"add-row-above",onMenuSelect:()=>r.executeCommand("addRowBefore"),visible:()=>df(r)},{label:()=>Xt("menu.array.add row below"),id:"add-row-below",onMenuSelect:()=>r.executeCommand("addRowAfter"),visible:()=>df(r)},{label:()=>Xt("menu.array.add column before"),id:"add-column-before",onMenuSelect:()=>r.executeCommand("addColumnBefore"),visible:()=>df(r),enabled:()=>{const o=r.model.parentEnvironment;if(!o)return!1;const[u,d]=P1(r);return u<o.maxColumns}},{label:()=>Xt("menu.array.add column after"),id:"add-column-after",onMenuSelect:()=>r.executeCommand("addColumnAfter"),visible:()=>df(r)},{type:"divider"},{label:()=>Xt("menu.array.delete row"),id:"delete-row",onMenuSelect:()=>r.executeCommand("removeRow"),visible:()=>df(r)},{label:()=>Xt("menu.array.delete column"),id:"delete-column",onMenuSelect:()=>r.executeCommand("removeColumn"),visible:()=>df(r)},{type:"divider"},{label:()=>Xt("menu.borders"),visible:()=>(Py(r)||df(r))&&r.isSelectionEditable,submenu:[{label:" \u22F1 ",id:"environment-no-border",onMenuSelect:()=>ff(r,"matrix")},{label:"(\u22F1)",id:"environment-parentheses",onMenuSelect:()=>ff(r,"pmatrix")},{label:"[\u22F1]",id:"environment-brackets",onMenuSelect:()=>ff(r,"bmatrix")},{label:"|\u22F1|",id:"environment-bar",onMenuSelect:()=>ff(r,"vmatrix")},{label:"{\u22F1}",id:"environment-braces",onMenuSelect:()=>ff(r,"Bmatrix")}],submenuClass:"border-submenu"},{type:"divider"},{label:()=>Xt("menu.insert matrix"),id:"insert-matrix",visible:()=>r.isSelectionEditable,submenu:T0(r),submenuClass:"insert-matrix-submenu",columnCount:5},{label:()=>Xt("menu.mode"),id:"mode",visible:()=>r.isSelectionEditable&&r.model.selectionIsCollapsed,submenu:[{label:()=>Xt("menu.mode-math"),id:"mode-math",onMenuSelect:()=>{Yd(r,"accept-all"),r.executeCommand(["switchMode","math"])},checked:()=>r.model.mode==="math"},{label:()=>Xt("menu.mode-text"),id:"mode-text",onMenuSelect:()=>{Yd(r,"accept-all"),r.executeCommand(["switchMode","text"])},checked:()=>r.model.mode==="text"},{label:()=>Xt("menu.mode-latex"),id:"mode-latex",onMenuSelect:()=>r.executeCommand(["switchMode","latex"]),checked:()=>r.model.mode==="latex"}]},{type:"divider"},{label:()=>Xt("menu.font-style"),id:"variant",visible:()=>r.isSelectionEditable,submenu:Um(r),submenuClass:"variant-submenu"},{label:()=>Xt("menu.color"),id:"color",visible:()=>r.isSelectionEditable,submenu:_0(r),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>Xt("menu.background-color"),id:"background-color",visible:()=>r.isSelectionEditable,submenu:tl(r),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>Xt("menu.accent"),id:"accent",visible:()=>r.isSelectionEditable,submenu:xn(r),submenuClass:"variant-submenu"},{label:()=>Xt("menu.decoration"),id:"decoration",visible:()=>r.isSelectionEditable&&Un(r).length>0,submenu:_1(r),submenuClass:"variant-submenu"},{type:"divider"},{label:()=>Xt("menu.evaluate"),id:"ce-evaluate",visible:()=>r.isSelectionEditable&&window.MathfieldElement.computeEngine!==null,onMenuSelect:()=>{const o=na(r);if(!o){r.model.announce("plonk");return}r.model.selectionIsCollapsed?(r.model.position=r.model.lastOffset,r.insert(`=${o}`,{insertionMode:"insertAfter",selectionMode:"item"})):r.insert(o,{insertionMode:"replaceSelection",selectionMode:"item"})}},{label:()=>Xt("menu.simplify"),id:"ce-simplify",visible:()=>r.isSelectionEditable&&window.MathfieldElement.computeEngine!==null,onMenuSelect:()=>{var o,u;if(r.model.selectionIsCollapsed){const d=(o=r.expression)==null?void 0:o.simplify();if(r.model.position=r.model.lastOffset,!d){r.model.announce("plonk");return}r.insert(`=${d.latex}`,{insertionMode:"insertAfter",selectionMode:"item"})}else{const d=(u=window.MathfieldElement.computeEngine)==null?void 0:u.parse(r.getValue(r.model.selection)).simplify();if(!d){r.model.announce("plonk");return}r.insert(d.latex,{insertionMode:"replaceSelection",selectionMode:"item"})}}},{label:()=>{var o;if(window.MathfieldElement.computeEngine===null)return"";const u=(o=r.expression)==null?void 0:o.unknowns[0];return u?Xt("menu.solve-for",hs(u)):Xt("menu.solve")},id:"ce-solve",visible:()=>{var o;return r.isSelectionEditable&&window.MathfieldElement.computeEngine!==null&&((o=r.expression)==null?void 0:o.unknowns.length)===1&&r.expression.unknowns[0]!=="Nothing"},onMenuSelect:()=>{var o;const u=r.expression,d=u==null?void 0:u.unknowns[0],g=(o=u.solve(d))==null?void 0:o.map(b=>{var M;return(M=b.simplify().latex)!=null?M:""});if(!g){r.model.announce("plonk");return}r.insert(`${d}=${g.length===1?g[0]:"\\left\\lbrace"+(g==null?void 0:g.join(", "))+"\\right\\rbrace"}`,{insertionMode:"replaceAll",selectionMode:"item"})}},{type:"divider"},{label:()=>Xt("menu.cut"),onMenuSelect:()=>r.executeCommand("cutToClipboard"),visible:()=>!r.options.readOnly&&r.isSelectionEditable,keyboardShortcut:"meta+X"},{label:()=>Xt("menu.copy"),id:"copy",submenu:[{label:()=>Xt("menu.copy-as-latex"),id:"copy-latex",onMenuSelect:()=>Bn.copyToClipboard(r,"latex"),keyboardShortcut:"meta+C"},{label:()=>Xt("menu.copy-as-ascii-math"),id:"copy-ascii-math",onMenuSelect:()=>Bn.copyToClipboard(r,"ascii-math")},{label:()=>Xt("menu.copy-as-mathml"),id:"copy-math-ml",onMenuSelect:()=>Bn.copyToClipboard(r,"math-ml")}]},{label:()=>Xt("menu.paste"),id:"paste",onMenuSelect:()=>r.executeCommand("pasteFromClipboard"),visible:()=>r.hasEditableContent,keyboardShortcut:"meta+V"},{label:()=>Xt("menu.select-all"),id:"select-all",keyboardShortcut:"meta+A",onMenuSelect:()=>r.executeCommand("selectAll")}]}function df(r){var o;return!!((o=r.model.parentEnvironment)!=null&&o.array)}function Py(r){return r.model.at(r.model.position).type==="array"}function P1(r){var o;const u=(o=r.model.parentEnvironment)==null?void 0:o.array;return u?[u.length,u.reduce((d,g)=>Math.max(d,g.length),0)]:[0,0]}function ff(r,o){Xd(r),r.flushInlineShortcutBuffer(),Pm(r.model,o),ls(r)}function na(r){var o,u;let d;if(r.model.selectionIsCollapsed?d=(o=window.MathfieldElement.computeEngine)==null?void 0:o.parse(r.getValue(),{canonical:!1}):d=(u=window.MathfieldElement.computeEngine)==null?void 0:u.parse(r.getValue(r.model.selection),{canonical:!1}),!d)return"";let g=d.evaluate();return g.isSame(d)&&(g=d.N()),g.latex}function Lr(r,o,u,d){return{label:()=>hs(`\\${u}{${Un(r)}}`),tooltip:()=>{var g;return(g=Xt(d))!=null?g:d},visible:()=>xx(r,o),checked:()=>{var g;return{some:"mixed",all:!0}[(g=r.queryStyle({variant:o}))!=null?g:!1]},onMenuSelect:()=>{r.applyStyle({variant:o},{operation:"toggle"}),r.adoptStyle="none"}}}function xp(r,o,u,d){return{label:()=>hs(`\\${u}{${Un(r)}}`),tooltip:()=>{var g;return(g=Xt(d))!=null?g:d},visible:()=>E1(r,o),checked:()=>{var g;return{some:"mixed",all:!0}[(g=r.queryStyle({variantStyle:o}))!=null?g:!1]},onMenuSelect:()=>{r.applyStyle({variantStyle:o},{operation:"toggle"}),r.adoptStyle="none"}}}function _c(r,o){return r+Ve(o)}bs({speak:(r,o,u)=>Zm(r,o,u)},{target:"mathfield"});function Zm(r,o,u){var d,g;u=u!=null?u:{withHighlighting:!1};const{model:b}=r;function M($){let it=null;switch($){case"all":it=b.root;break;case"selection":it=b.getAtoms(b.selection);break;case"left":{it=b.getAtoms(b.offsetOf(b.at(b.position).leftSibling),b.position);break}case"right":{it=b.getAtoms(b.position,b.offsetOf(b.at(b.position).rightSibling));break}case"group":it=b.getAtoms(b.getSiblingsRange(b.position));break;case"parent":{const{parent:gt}=b.at(b.position);gt!=null&&gt.parent?it=gt:it=b.root;break}default:it=b.root}return it}function N($){let it="";switch($){case"all":console.log("Internal failure: speak all failed");break;case"selection":it="no selection";break;case"left":it="at start";break;case"right":it="at end";break;case"group":console.log("Internal failure: speak group failed");break;case"parent":it="no parent";break;default:console.log('unknown speak_ param value: "'+$+'"');break}return it}const I=M(o);if(I===null)return(g=(d=window.MathfieldElement).speakHook)==null||g.call(d,N(o)),!1;(u.withHighlighting||window.MathfieldElement.speechEngine==="amazon")&&(window.MathfieldElement.textToSpeechMarkup=window.sre&&window.MathfieldElement.textToSpeechRules==="sre"?"ssml_step":"ssml");const F=Ve(I);return Ce()&&u.withHighlighting?(Xh().readAloudMathfield=r,qd(r,{forHighlighting:!0}),window.MathfieldElement.readAloudHook&&window.MathfieldElement.readAloudHook(r.field,F)):window.MathfieldElement.speakHook&&window.MathfieldElement.speakHook(F),!1}function N1(r){var o,u;if(!Ce()){console.log("Speak:",r);return}if(!window.MathfieldElement.speechEngine||window.MathfieldElement.speechEngine==="local"){const d=new SpeechSynthesisUtterance(r);window.speechSynthesis.speak(d)}else if(window.MathfieldElement.speechEngine==="amazon")if(!("AWS"in window))console.error("MathLive 0.98.5: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");else{const d=new window.AWS.Polly({apiVersion:"2016-06-10"}),g={OutputFormat:"mp3",VoiceId:(o=window.MathfieldElement.speechEngineVoice)!=null?o:"Joanna",Engine:["Amy","Emma","Brian","Ivy","Joanna","Kendra","Kimberly","Salli","Joey","Justin","Matthew"].includes((u=window.MathfieldElement.speechEngineVoice)!=null?u:"Joanna")?"neural":"standard",Text:r,TextType:"ssml"};d.synthesizeSpeech(g,(b,M)=>{if(b)console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech()\` error: ${b}`);else if(M!=null&&M.AudioStream){const N=new Uint8Array(M.AudioStream),I=new Blob([N.buffer],{type:"audio/mpeg"}),F=URL.createObjectURL(I);new Audio(F).play().catch(it=>console.log(it))}else console.log("polly.synthesizeSpeech():",M)})}else window.MathfieldElement.speechEngine==="google"&&console.error("MathLive 0.98.5: The Google speech engine is not supported yet. Please come again.")}function Ny(r){var o;let u;if(r.parent.type==="prompt")r.parentBranch==="body"&&(u="prompt");else if(r.parentBranch==="body")u=r.type&&(o={enclose:"cross out",leftright:"delimiter",surd:"square root",root:"math field",mop:"operator",first:"first"}[r.type])!=null?o:"parent";else if(r.parent.type==="genfrac"){if(r.parentBranch==="above")return"numerator";if(r.parentBranch==="below")return"denominator"}else r.parent.type==="surd"?r.parentBranch==="above"&&(u="index"):r.parentBranch==="superscript"?u="superscript":r.parentBranch==="subscript"&&(u="subscript");return u||console.log("unknown relationship"),u!=null?u:"parent"}function A1(r,o,u,d){let g="";if(o==="plonk")window.MathfieldElement.playSound("plonk"),r.flushInlineShortcutBuffer();else if(o==="delete")g=_c("deleted: ",d);else if(o==="focus"||o.includes("move"))g=D1(r.model,u)+(r.model.selectionIsCollapsed?"":"selected: ")+I1(r.model);else if(o==="replacement")g=_c("",r.model.at(r.model.position));else if(o==="line"){const b=_c("",r.model.root);r.keyboardDelegate.setAriaLabel(b)}else g=d?_c(o+" ",d):o;if(g){const b=r.ariaLiveText.textContent.includes("\xA0")?" \u202F ":" \xA0 ";r.ariaLiveText.textContent=g+b}}function D1(r,o){if(Number.isNaN(o))return"";const u=r.at(o);if(!u||u.treeDepth<=r.at(r.position).treeDepth)return"";let d="",g=u.parent;const b=r.at(r.position).parent;for(;g!==r.root&&g!==b;)d+=`out of ${Ny(g)};`,g=g.parent;return d}function I1(r){if(!r.selectionIsCollapsed)return _c("",r.getAtoms(r.selection));let o="";const u=r.at(r.position),d=Ny(u);return u.isFirstSibling&&(o=(d?"start of "+d:"unknown")+": "),u.isLastSibling?u.isFirstSibling||(o+=d?"end of "+d:"unknown"):o+=_c("",u),o}var Ay=class{constructor(r,o,u){this.mathfield=r,this.mode=o,this.silenceNotifications=!1,this._selection={ranges:[[0,0]],direction:"none"},this._anchor=0,this._position=0,this.root=u}dispose(){this.mathfield=void 0}getState(){const r={ranges:[...this._selection.ranges]};return this.selection.direction&&this.selection.direction!=="none"&&(r.direction=this.selection.direction),{content:this.root.toJson(),selection:r,mode:this.mode}}setState(r,o){var u;const d=this.silenceNotifications;this.silenceNotifications=(u=o==null?void 0:o.silenceNotifications)!=null?u:!0;let g={};if((o==null?void 0:o.type)==="undo"&&(g={inputType:"historyUndo"}),(o==null?void 0:o.type)==="redo"&&(g={inputType:"historyRedo"}),this.contentWillChange(g)){const b=this.silenceNotifications;this.silenceNotifications=!0,this.mode=r.mode,this.root=nd(r.content),this.selection=r.selection,this.silenceNotifications=b,this.contentDidChange(g)}this.silenceNotifications=d}get atoms(){return this.root.children}get selection(){return this._selection}set selection(r){this.setSelection(r)}setSelection(r,o){return!this.mathfield.contentEditable&&this.mathfield.userSelect==="none"?!1:this.deferNotifications({selection:!0},()=>{var u,d,g;const b=this.normalizeSelection(r,o);if(b===void 0)throw new TypeError("Invalid selection");if(b.ranges.length===1&&b.ranges[0][0]===b.ranges[0][1]){const $=b.ranges[0][0];if(!this.mathfield.dirty&&!((u=this.at($))!=null&&u.parentPrompt)&&this.mathfield.hasEditablePrompts){if((d=this.at($-1))!=null&&d.parentPrompt){this._anchor=this.normalizeOffset($-1),this._position=this._anchor,this._selection=this.normalizeSelection(this._anchor);return}if((g=this.at($+1))!=null&&g.parentPrompt){this._anchor=this.normalizeOffset($+1),this._position=this._anchor,this._selection=this.normalizeSelection(this._anchor);return}this._anchor=0,this._position=0,this._selection={ranges:[[0,0]]};return}this._anchor=$,this._position=$,this._selection=b;return}const M=Yo(b);b.direction==="backward"?[this._position,this._anchor]=M:[this._anchor,this._position]=M;const N=this.at(M[0]+1),I=this.at(M[1]),F=oi.commonAncestor(N,I);(F==null?void 0:F.type)==="array"&&N.parent===F&&I.parent===F?this._selection={ranges:[M],direction:b.direction}:this._selection={ranges:[M],direction:b.direction},console.assert(this._position>=0&&this._position<=this.lastOffset)})}setPositionHandlingPlaceholder(r){var o;const u=this.at(r);(u==null?void 0:u.type)==="placeholder"?this.setSelection(r-1,r):((o=u==null?void 0:u.rightSibling)==null?void 0:o.type)==="placeholder"?this.setSelection(r,r+1):this.position=r,u instanceof Ea&&u.isSuggestion&&(u.isSuggestion=!1),this.mathfield.stopCoalescingUndo()}get position(){return this._position}set position(r){this.setSelection(r,r)}get anchor(){return this._anchor}get selectionIsCollapsed(){return this._anchor===this._position}get selectionIsPlaceholder(){return Math.abs(this._anchor-this._position)===1?this.at(Math.max(this._anchor,this._position)).type==="placeholder":!1}collapseSelection(r="forward"){return this._anchor===this._position?!1:(r==="backward"?this.position=Math.min(this._anchor,this._position):this.position=Math.max(this._anchor,this._position),!0)}get lastOffset(){return this.atoms.length-1}at(r){return this.atoms[r]}offsetOf(r){return this.atoms.indexOf(r)}getSiblingsRange(r){const o=this.at(r),{parent:u}=o;if(!u)return[0,this.lastOffset];const d=o.parent.branch(o.parentBranch);return[this.offsetOf(d[0]),this.offsetOf(d[d.length-1])]}getBranchRange(r,o){const u=this.at(r).branch(o);return[this.offsetOf(u[0]),this.offsetOf(u[u.length-1])]}getAtoms(r,o,u){let d=u!=null?u:{};if(Vf(r)){if(d=o!=null?o:{},r.ranges.length>1)return r.ranges.reduce((F,$)=>[...F,...this.getAtoms($,d)],[]);r=r.ranges[0]}let g,b;if(rh(r)){if(g=r,!rh(o))return[];b=o}else[g,b]=r,d=o!=null?o:{};if(!Number.isFinite(g))return[];d.includeChildren===void 0&&(d.includeChildren=!1),g<0&&(g=this.lastOffset-g+1),b<0&&(b=this.lastOffset-b+1);const M=Math.min(g,b)+1,N=Math.max(g,b);if(!d.includeChildren&&M===1&&N===this.lastOffset)return[this.root];let I=[];for(let F=M;F<=N;F++){const $=this.atoms[F];Gm(this,$,M,N)&&I.push($)}return d.includeChildren||(I=I.filter(F=>{let $=!1,{parent:it}=F;for(;it&&!$;)$=Gm(this,it,M,N),it=it.parent;return!$})),I}getAllAtoms(r=0){const o=[],u=this.lastOffset;for(let d=r;d<=u;d++)o.push(this.atoms[d]);for(let d=0;d<r;d++)o.push(this.atoms[d]);return o}findAtom(r,o=0,u="forward"){let d;const g=this.lastOffset;if(u==="forward"){for(let b=o;b<=g;b++)if(d=this.atoms[b],r(d))return d;for(let b=0;b<o;b++)if(d=this.atoms[b],r(d))return d;return}for(let b=o;b>=0;b--)if(d=this.atoms[b],r(d))return d;for(let b=g;b>o;b--)if(d=this.atoms[b],r(d))return d}extractAtoms(r){let o=this.getAtoms(r);if(o.length===1&&!o[0].parent)if(o[0].type==="root")o=[...o[0].body],o.shift();else return o=this.root.cells.flat(),this.root=new oi({type:"root",body:[]}),o;for(const u of o)u.parent.removeChild(u);return o}deleteAtoms(r){this.extractAtoms(r),this.position=r[0]}atomToString(r,o){const u=o!=null?o:"latex";if(u.startsWith("latex"))return oi.serialize([r],{expandMacro:u==="latex-expanded",skipStyles:u==="latex-unstyled",skipPlaceholders:u==="latex-without-placeholders",defaultMode:this.mathfield.options.defaultMode});if(u==="math-ml")return Gr(r);if(u==="spoken")return Ve(r);if(u==="spoken-text"){const d=window.MathfieldElement.textToSpeechMarkup;window.MathfieldElement.textToSpeechMarkup="";const g=Ve(r);return window.MathfieldElement.textToSpeechMarkup=d,g}if(u==="spoken-ssml"||u==="spoken-ssml-with-highlighting"){const d=window.MathfieldElement.textToSpeechMarkup;window.MathfieldElement.textToSpeechMarkup="ssml";const g=Ve(r);return window.MathfieldElement.textToSpeechMarkup=d,g}return u==="ascii-math"?_s(r):(console.error(`MathLive 0.98.5: Unexpected format "${u}`),"")}getValue(r,o,u){if(r===void 0)return this.atomToString(this.root,"latex");if(typeof r=="string"&&r!=="math-json")return this.atomToString(this.root,r);let d,g;if(rh(r)&&rh(o)?(d=[this.normalizeRange([r,o])],g=u):Jc(r)?(d=[this.normalizeRange(r)],g=o):Vf(r)?(d=r.ranges,g=o):(d=[this.normalizeRange([0,-1])],g=r),g!=null||(g="latex"),g==="math-json"){if(!window.MathfieldElement.computeEngine)return window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`The CortexJS Compute Engine library is not available.
Load the library, for example with:
import "https://unpkg.com/@cortex-js/compute-engine?module"`),'["Error", "compute-engine-not-available"]';const b=this.getValue({ranges:d},"latex-unstyled");try{const M=window.MathfieldElement.computeEngine.parse(b);return JSON.stringify(M.json)}catch(M){return JSON.stringify(["Error",`'${M.toString()}'`])}}if(g.startsWith("latex")){const b={expandMacro:g==="latex-expanded",skipStyles:g==="latex-unstyled",skipPlaceholders:g==="latex-without-placeholders",defaultMode:this.mathfield.options.defaultMode};return fr(d.map(M=>oi.serialize(this.getAtoms(M),b)))}return d.map(b=>this.getAtoms(b).map(M=>this.atomToString(M,g)).join("")).join("")}extendSelectionTo(r,o){return!this.mathfield.contentEditable&&this.mathfield.userSelect==="none"?!1:this.deferNotifications({selection:!0},()=>{const u=this.normalizeRange([r,o]);let[d,g]=u,{parent:b}=this.at(g);if(b&&(b.type==="genfrac"||b.type==="subsup"))for(;b!==this.root&&P0(this,b,[d,g]);)g=this.offsetOf(b),b=b.parent;for(b=this.at(d).parent;b!==this.root&&P0(this,b,[d,g]);)d=this.offsetOf(b.leftSibling),b=b.parent;if(b=this.at(g).parent,(b==null?void 0:b.type)==="genfrac")for(;b!==this.root&&P0(this,b,[d,g]);)g=this.offsetOf(b),console.assert(g>=0),b=b.parent;this._position=this.normalizeOffset(o),this._selection={ranges:[[d,g]],direction:"none"}})}announce(r,o,u=[]){var d,g;((g=(d=this.mathfield.host)==null?void 0:d.dispatchEvent(new CustomEvent("announce",{detail:{command:r,previousPosition:o,atoms:u},cancelable:!0,bubbles:!0,composed:!0})))!=null?g:!0)&&A1(this.mathfield,r,o,u)}deferNotifications(r,o){const u=this._selection,d=this._anchor,g=this._position,b=this.silenceNotifications;this.silenceNotifications=!0;const M=this.root.changeCounter;o();const N=this.root.changeCounter!==M,I=d!==this._anchor||g!==this._position||Yc(this._selection,u)==="different";return this.silenceNotifications=b,r.content&&N&&this.contentDidChange({inputType:r.type}),r.selection&&I&&this.selectionDidChange(),N||I}normalizeOffset(r){return r>0?r=Math.min(r,this.lastOffset):r<0&&(r=this.lastOffset+r+1),r}normalizeRange(r){let[o,u]=r;return o=this.normalizeOffset(o),u=this.normalizeOffset(u),o<u?[o,u]:[u,o]}normalizeSelection(r,o){var u;let d;if(rh(r)){const g=this.normalizeOffset(r);if(rh(o)){const b=this.normalizeOffset(o);d=g<=b?{ranges:[[g,b]],direction:"none"}:{ranges:[[b,g]],direction:"backward"}}else d={ranges:[[g,g]],direction:"none"}}else if(Jc(r)){const g=this.normalizeOffset(r[0]),b=this.normalizeOffset(r[1]);d=g<=b?{ranges:[[g,b]],direction:"none"}:{ranges:[[b,g]],direction:"backward"}}else Vf(r)&&(d={ranges:r.ranges.map(g=>this.normalizeRange(g)),direction:(u=r.direction)!=null?u:"none"});return console.assert(d!==void 0),d}get parentEnvironment(){let r=this.at(this.position).parent;if(r){for(;r.parent&&r.type!=="array";)r=r.parent;if(r.type==="array")return r}}get cell(){var r;let o=this.at(this.position);if(o){for(;o&&((r=o.parent)==null?void 0:r.type)!=="array";)o=o.parent;if(!(!(o!=null&&o.parent)||o.parent.type!=="array"))return o.parentBranch}}contentWillChange(r={}){if(this.silenceNotifications||!this.mathfield)return!0;const o=this.silenceNotifications;this.silenceNotifications=!0;const u=this.mathfield.onContentWillChange(r);return this.silenceNotifications=o,u}contentDidChange(r){var o;if(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update($a(this.mathfield)),this.silenceNotifications||!this.mathfield.host||!this.mathfield)return;const u=this.silenceNotifications;this.silenceNotifications=!0,this.mathfield.host.dispatchEvent(new InputEvent("input",rt(Q({},r),{data:r.data?r.data:(o=r.inputType)!=null?o:"",bubbles:!0,composed:!0}))),this.silenceNotifications=u}selectionDidChange(){if(!this.mathfield||(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update($a(this.mathfield)),this.silenceNotifications))return;const r=this.silenceNotifications;this.silenceNotifications=!0,this.mathfield.onSelectionDidChange(),this.silenceNotifications=r}};function Gm(r,o,u,d){const g=r.offsetOf(o);if(g<u||g>d)return!1;if(!o.hasChildren)return!0;const b=r.offsetOf(o.firstChild);if(b>=u&&b<=d){const M=r.offsetOf(o.lastChild);if(M>=u&&M<=d)return!0}return!1}function P0(r,o,u){if(!(o!=null&&o.hasChildren))return!1;const[d,g]=u,b=r.offsetOf(o.firstChild),M=r.offsetOf(o.lastChild);return b>=d&&b<=g&&M>=b&&M<=g}function Xm(r,o,u,d){var g,b,M,N,I,F;const $=u.parent;if($&&u instanceof Kr){const it=!d&&o==="forward"||d==="body"&&o==="backward";let gt=it?r.offsetOf(u.firstChild):r.offsetOf(u.lastChild);return it?u.rightDelim!=="?"&&u.rightDelim!=="."?(u.leftDelim=".",u.isDirty=!0):($.addChildrenAfter(u.removeBranch("body"),u),$.removeChild(u),gt--):u.leftDelim!=="?"&&u.leftDelim!=="."?(u.rightDelim=".",u.isDirty=!0):($.addChildrenAfter(u.removeBranch("body"),u),$.removeChild(u),gt--),r.position=gt,!0}if($&&u.type==="surd"){if(o==="forward"&&!d||o==="backward"&&d==="body"){const it=u.leftSibling;u.hasChildren&&$.addChildrenAfter(u.removeBranch("body"),u),$.removeChild(u),r.position=r.offsetOf(it)}else o==="forward"&&d==="body"?r.position=r.offsetOf(u):!d&&o==="backward"?u.hasChildren?r.position=r.offsetOf(u.lastChild):(r.position=Math.max(0,r.offsetOf(u)-1),$.removeChild(u)):d==="above"&&(u.hasEmptyBranch("above")&&u.removeBranch("above"),o==="backward"?r.position=r.offsetOf(u.leftSibling):r.position=r.offsetOf(u.body[0]));return!0}if($&&(u.type==="box"||u.type==="enclose")){const it=d&&o==="backward"||!d&&o==="forward"?u.leftSibling:u.lastChild;return $.addChildrenAfter(u.removeBranch("body"),u),$.removeChild(u),r.position=r.offsetOf(it),!0}if(u.type==="genfrac"||u.type==="overunder"){if(!d)return u.type==="overunder"&&u.hasEmptyBranch("body")||u.type==="genfrac"&&u.hasEmptyBranch("below")&&u.hasEmptyBranch("above")?!1:(r.position=r.offsetOf(o==="forward"?u.firstChild:u.lastChild),!0);const it=mf.fractionNavigationOrder==="numerator-denominator"?"above":"below",gt=it==="above"?"below":"above";if($&&(o==="forward"&&d===it||o==="backward"&&d===gt)){const _t=u.removeBranch(it),zt=u.removeBranch(gt);return $.addChildrenAfter([..._t,...zt],u),$.removeChild(u),r.position=r.offsetOf(_t.length>0?_t[_t.length-1]:zt[0]),!0}return o==="backward"?r.position=r.offsetOf(u.leftSibling):r.position=r.offsetOf(u),!0}if(u.isExtensibleSymbol||u.type==="subsup"){if(!d&&o==="forward")return!1;if(!d){if(u.subscript||u.superscript){const it=o==="forward"?(M=(g=u.superscript)==null?void 0:g[0])!=null?M:(b=u.subscript)==null?void 0:b[0]:(F=(N=u.subscript)==null?void 0:N[0].lastSibling)!=null?F:(I=u.superscript)==null?void 0:I[0].lastSibling;return it&&(r.position=r.offsetOf(it)),!0}return!1}if(!u.hasChildren&&u.type==="subsup"){const it=o==="forward"?r.offsetOf(u):Math.max(0,r.offsetOf(u)-1);return u.parent.removeChild(u),r.position=it,!0}if(d==="superscript")if(o==="backward"){const it=r.offsetOf(u.firstChild)-1;console.assert(it>=0),r.position=it}else u.subscript?r.position=r.offsetOf(u.subscript[0]):r.position=r.offsetOf(u);else d==="subscript"&&(o==="backward"&&u.superscript?r.position=r.offsetOf(u.superscript[0].lastSibling):o==="backward"?r.position=r.offsetOf(u.firstChild)-1:r.position=r.offsetOf(u));if(d&&u.hasEmptyBranch(d)&&(u.removeBranch(d),u.type==="subsup"&&!u.subscript&&!u.superscript)){const it=o==="forward"?r.offsetOf(u):Math.max(0,r.offsetOf(u)-1);u.parent.removeChild(u),r.position=it}return!0}if(($==null?void 0:$.type)==="genfrac"&&!d&&u.type!=="first"){let it=r.offsetOf(u.leftSibling);return $.removeChild(u),$.hasEmptyBranch("above")&&$.hasEmptyBranch("below")?(it=r.offsetOf($.leftSibling),$.parent.removeChild($),r.announce("delete",void 0,[$]),r.position=it,!0):(r.announce("delete",void 0,[u]),r.position=it,!0)}if(o==="backward"&&(($==null?void 0:$.command)==="\\ln"||($==null?void 0:$.command)==="\\log")&&u.parentBranch!=="body"){const it=r.offsetOf($.leftSibling);return $.parent.removeChild($),r.announce("delete",void 0,[$]),r.position=it,!0}return!1}function Yl(r){return!r.mathfield.isSelectionEditable||!r.contentWillChange({inputType:"deleteContentBackward"})?!1:r.selectionIsCollapsed?r.deferNotifications({content:!0,selection:!0,type:"deleteContentBackward"},()=>{let o=r.at(r.position);if(!(o&&Xm(r,"backward",o))){if(o!=null&&o.isFirstSibling){if(Xm(r,"backward",o.parent,o.parentBranch))return;o=null}if(!o){r.announce("plonk");return}r.position=r.offsetOf(o.leftSibling),o.parent.removeChild(o),r.announce("delete",void 0,[o])}}):Ha(r,Yo(r.selection),"deleteContentBackward")}function pd(r){return!r.mathfield.isSelectionEditable||!r.contentWillChange({inputType:"deleteContentForward"})?!1:r.selectionIsCollapsed?r.deferNotifications({content:!0,selection:!0,type:"deleteContentForward"},()=>{var o,u;let d=r.at(r.position).rightSibling;if(d&&Xm(r,"forward",d))return;if(d){if(r.at(r.position).isLastSibling&&Xm(r,"forward",d.parent,d.parentBranch))return}else{if(d=r.at(r.position),d.isLastSibling&&Xm(r,"forward",d.parent,d.parentBranch))return;d=void 0}if(r.position===r.lastOffset||!d){r.announce("plonk");return}d.parent.removeChild(d);let g=(o=r.at(r.position))==null?void 0:o.rightSibling;for(;(g==null?void 0:g.type)==="subsup";)g.parent.removeChild(g),g=(u=r.at(r.position))==null?void 0:u.rightSibling;r.announce("delete",void 0,[d])}):Ha(r,Yo(r.selection),"deleteContentForward")}function Ha(r,o,u){const d=r.getAtoms(o);if(d.length>0&&d[0].parent){let g=d[0].parent.firstChild;g.type==="first"&&(g=g.rightSibling);const b=d[d.length-1].parent.lastChild;let M=d[0];M.type==="first"&&(M=M.rightSibling);const N=d[d.length-1];if(M===g&&N===b){const I=d[0].parent;I.parent&&I.type!=="prompt"&&(o=[r.offsetOf(I.leftSibling),r.offsetOf(I)])}if(d.length===1&&d[0].type==="placeholder"&&d[0].parent.type==="genfrac"){const I=d[0].parent,F=d[0].parentBranch==="below"?"above":"below",$=r.offsetOf(I.leftSibling);return r.deferNotifications({content:!0,selection:!0,type:u},()=>{var it,gt;const _t=I.removeBranch(F);if(_t.length===1&&_t[0].type==="placeholder")(gt=I.parent)==null||gt.removeChild(I),r.position=Math.max(0,$);else{const zt=I.parent.addChildrenAfter(_t,I);(it=I.parent)==null||it.removeChild(I),r.position=r.offsetOf(zt)}})}}return r.deferNotifications({content:!0,selection:!0,type:u},()=>r.deleteAtoms(o))}bs({deleteAll:r=>r.contentWillChange({inputType:"deleteContent"})&&Ha(r,[0,-1],"deleteContent"),deleteForward:r=>pd(r),deleteBackward:r=>Yl(r),deleteNextWord:r=>r.contentWillChange({inputType:"deleteWordForward"})&&Ha(r,[r.anchor,Cn(r,r.position,"forward")],"deleteWordForward"),deletePreviousWord:r=>r.contentWillChange({inputType:"deleteWordBackward"})&&Ha(r,[r.anchor,Cn(r,r.position,"backward")],"deleteWordBackward"),deleteToGroupStart:r=>r.contentWillChange({inputType:"deleteSoftLineBackward"})&&Ha(r,[r.anchor,r.offsetOf(r.at(r.position).firstSibling)],"deleteSoftLineBackward"),deleteToGroupEnd:r=>r.contentWillChange({inputType:"deleteSoftLineForward"})&&Ha(r,[r.anchor,r.offsetOf(r.at(r.position).lastSibling)],"deleteSoftLineForward"),deleteToMathFieldStart:r=>r.contentWillChange({inputType:"deleteHardLineBackward"})&&Ha(r,[r.anchor,0],"deleteHardLineBackward"),deleteToMathFieldEnd:r=>r.contentWillChange({inputType:"deleteHardLineForward"})&&Ha(r,[r.anchor,-1],"deleteHardLineForward")},{target:"model",audioFeedback:"delete",canUndo:!0,changeContent:!0,changeSelection:!0});var Jl=`<svg xmlns="http://www.w3.org/2000/svg" style="width: 21px;" viewBox="0 0 576 512" role="img" aria-label="${Xt("tooltip.toggle virtual keyboard")}"><path d="M528 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h480c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm16 336c0 8.823-7.177 16-16 16H48c-8.823 0-16-7.177-16-16V112c0-8.823 7.177-16 16-16h480c8.823 0 16 7.177 16 16v288zM168 268v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-336 80v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm384 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zM120 188v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-96 152v-8c0-6.627-5.373-12-12-12H180c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h216c6.627 0 12-5.373 12-12z"/></svg>`,ra=`<svg xmlns="http://www.w3.org/2000/svg" style="height: 18px;" viewBox="0 0 448 512" role="img" aria-label="${Xt("tooltip.menu")}"><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`,md=class{constructor(r,o){this.focusBlurInProgress=!1;var u,d,g;this.options=Q(rt(Q({},p0()),{macros:ln(),registers:vc()}),lp(o)),this.eventController=new AbortController;const b=this.eventController.signal;o.eventSink&&(this.host=o.eventSink),this.element=r,r.mathfield=this,this.blurred=!0,this.keystrokeCaptionVisible=!1,this.suggestionIndex=0,this.inlineShortcutBuffer=[],this.inlineShortcutBufferFlushTimer=0,this.defaultStyle={},this.adoptStyle="left",this.options.defaultMode==="inline-math"?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline"),this.dirty=!1;let M=(d=(u=o.value)!=null?u:this.element.textContent)!=null?d:"";M=M.trim();const N=ui(this.options),I=new oi({type:"root",mode:N,body:vs(M,{context:this.context})});this.model=new Ay(this,N,I),this.undoManager=new f1(this.model);const F=[];if(F.push("<span contenteditable=true aria-multiline=false part=keyboard-sink class=ML__keyboard-sink autocapitalize=off autocomplete=off autocorrect=off spellcheck=false inputmode=none tabindex=0></span>"),F.push('<span part=container class=ML__container aria-hidden=true style="visibility:hidden">'),F.push("<span part=content class=ML__content>"),F.push(Jv(this)),F.push("</span>"),window.mathVirtualKeyboard&&(F.push(`<div part=virtual-keyboard-toggle class=ML__virtual-keyboard-toggle role=button ${this.hasEditableContent?"":'style="display:none;"'} data-l10n-tooltip="tooltip.toggle virtual keyboard">`),F.push(Jl),F.push("</div>")),F.push('<div part=menu-toggle class=ML__menu-toggle role=button data-l10n-tooltip="tooltip.menu">'),F.push(ra),F.push("</div>"),F.push("</span>"),F.push("<span class=ML__sr-only>"),F.push("<span role=status aria-live=assertive aria-atomic=true></span>"),F.push("</span>"),this.element.innerHTML=window.MathfieldElement.createHTML(F.join("")),!this.element.children){console.error("%cMathLive 0.98.5: Something went wrong and the mathfield could not be created.%c\nIf you are using Vue, this may be because you are using the runtime-only build of Vue. Make sure to include `runtimeCompiler: true` in your Vue configuration. There may a warning from Vue in the log above.","color:red;font-family:system-ui;font-size:1.2rem;font-weight:bold","color:inherit;font-family:system-ui;font-size:inherit;font-weight:inherit");return}this._l10Subscription=$t.subscribe(()=>$t.update(this.element)),$t.update(this.element),this.field=this.element.querySelector("[part=content]"),this.field.addEventListener("click",it=>it.stopImmediatePropagation(),{capture:!1,signal:b}),this.field.addEventListener("wheel",this,{passive:!1,signal:b}),"PointerEvent"in window?this.field.addEventListener("pointerdown",this,{signal:b}):this.field.addEventListener("mousedown",this,{signal:b}),(g=this.element.querySelector("[part=virtual-keyboard-toggle]"))==null||g.addEventListener("click",()=>{window.mathVirtualKeyboard.visible?window.mathVirtualKeyboard.hide():(window.mathVirtualKeyboard.show({animate:!0}),window.mathVirtualKeyboard.update($a(this)))},{signal:b}),this._menu=new gx(T1(this),{host:this.host}),this.field.addEventListener("contextmenu",this,{signal:b});const $=this.element.querySelector("[part=menu-toggle]");$==null||$.addEventListener("pointerdown",it=>{if(it.currentTarget!==$||this._menu.state!=="closed")return;this.element.classList.add("tracking");const gt=$.getBoundingClientRect();this._menu.modifiers=wc(it),this._menu.show({target:$,location:{x:gt.left,y:gt.bottom},onDismiss:()=>this.element.classList.remove("tracking")}),it.preventDefault(),it.stopPropagation()},{signal:b}),(this.model.atoms.length<=1||this.disabled||this.readOnly&&!this.hasEditableContent||this.userSelect==="none")&&($.style.display="none"),this.ariaLiveText=this.element.querySelector("[role=status]"),this.keyboardDelegate=cx(this.element.querySelector(".ML__keyboard-sink"),this.element,this),window.addEventListener("resize",this,{signal:b}),document.addEventListener("scroll",this,{signal:b}),this.resizeObserver=new ResizeObserver(()=>ls(this)),this.resizeObserver.observe(this.field),window.mathVirtualKeyboard.addEventListener("virtual-keyboard-toggle",this,{signal:b}),Gd&&!$t.locale.startsWith(Gd.locale)&&qy($t.locale),Pa!=="ready"&&document.fonts.ready.then(()=>Wl(this)),r.querySelector("[part=container]").style.removeProperty("visibility"),this.undoManager.startRecording(),this.undoManager.snapshot("set-value")}get defaultStyle(){return this._defaultStyle}set defaultStyle(r){this._defaultStyle=r}get effectiveStyle(){if(this.adoptStyle==="none")return this.defaultStyle;const r=this.model.at(this.model.position),o=this.adoptStyle==="right"?r.rightSibling:r;if(!o)return this.defaultStyle;if(o.type==="group"){const u=o.branch("body");return!u||u.length<2?{}:this.adoptStyle==="right"?u[1].computedStyle:u[u.length-1].computedStyle}return o.computedStyle}connectToVirtualKeyboard(){this.connectedToVirtualKeyboard||(this.connectedToVirtualKeyboard=!0,window.addEventListener("message",this,{signal:this.eventController.signal}),window.mathVirtualKeyboard.connect(),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update($a(this)),Gl(this))}disconnectFromVirtualKeyboard(){this.connectedToVirtualKeyboard&&(window.removeEventListener("message",this),window.mathVirtualKeyboard.disconnect(),this.connectedToVirtualKeyboard=!1,cu())}showMenu(r){var o,u;const d=(u=(o=r==null?void 0:r.location)!=null?o:ku(this.field))!=null?u:void 0,g=r==null?void 0:r.modifiers,b=this.element.querySelector("[part=container]");return this._menu.show({target:b,location:d,modifiers:g})}get colorMap(){return r=>{var o,u,d;return(d=(u=(o=this.options).colorMap)==null?void 0:u.call(o,r))!=null?d:We(r)}}get backgroundColorMap(){return r=>{var o,u,d,g,b,M;return(M=(b=(u=(o=this.options).backgroundColorMap)==null?void 0:u.call(o,r))!=null?b:(g=(d=this.options).colorMap)==null?void 0:g.call(d,r))!=null?M:ee(r)}}get smartFence(){var r;return(r=this.options.smartFence)!=null?r:!1}get readOnly(){var r;return(r=this.options.readOnly)!=null?r:!1}get disabled(){var r,o;return(o=(r=this.host)==null?void 0:r.disabled)!=null?o:!1}get contentEditable(){return this.host?this.host.getAttribute("contenteditable")!=="false":!1}get userSelect(){if(!this.host)return"";const r=getComputedStyle(this.host);return r.getPropertyValue("user-select")||r.getPropertyValue("-webkit-user-select")}get hasEditableContent(){return this.disabled||!this.contentEditable?!1:!this.readOnly||this.hasEditablePrompts}get hasEditablePrompts(){return this.readOnly&&!this.disabled&&this.contentEditable&&this.model.findAtom(r=>r.type==="prompt"&&!r.locked)!==void 0}get isSelectionEditable(){if(this.disabled||!this.contentEditable)return!1;if(!this.readOnly)return!0;const r=this.model.at(this.model.anchor),o=this.model.at(this.model.position),u=oi.commonAncestor(r,o);return!!((u==null?void 0:u.type)==="prompt"||u!=null&&u.parentPrompt)}get letterShapeStyle(){var r;return(r=this.options.letterShapeStyle)!=null?r:"tex"}get minFontScale(){return this.options.minFontScale}get selectionStyle(){if(this.model.selectionIsCollapsed)return this.effectiveStyle;const r=this.model.getAtoms(this.model.selection);if(r.length===0)return{};const o=Q({},r[0].style);for(const u of r)for(const[d,g]of Object.entries(u.style))o[d]!==g&&delete o[d];return o}queryStyle(r){const o=Fm(this,r);"verbatimColor"in o&&delete o.verbatimColor,"verbatimBackgroundColor"in o&&delete o.verbatimBackgroundColor;const u=Object.keys(o).length;if(u===0)return"all";if(u>1){for(const I of Object.keys(o)){const F=this.queryStyle({[I]:o[I]});if(F==="none")return"none";if(F==="some")return"some"}return"all"}const d=Object.keys(o)[0],g=o[d];if(this.model.selectionIsCollapsed)return this.effectiveStyle[d]===g?"all":"none";const b=this.model.getAtoms(this.model.selection,{includeChildren:!0});let M=b.length;if(M===0)return"none";let N=0;for(const I of b){if(I.type==="first"){M-=1;continue}I.style[d]===g&&(N+=1)}return N===0?"none":N===M?"all":"some"}get keybindings(){var r,o;if(this._keybindings)return this._keybindings;const[u,d]=e1(this.options.keybindings,(r=rd())!=null?r:ne());return((o=rd())==null?void 0:o.score)>0&&(this._keybindings=u,d.length>0&&console.error("MathLive 0.98.5: Invalid keybindings for current keyboard layout",d)),u}get menu(){return this._menu}setOptions(r){var o;this.options=Q(Q({},this.options),lp(r)),this._keybindings=void 0,this.options.defaultMode==="inline-math"?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline");let u=this.options.defaultMode;u==="inline-math"&&(u="math"),((o=this.model.root.firstChild)==null?void 0:o.mode)!==u&&(this.model.root.firstChild.mode=u),this.options.readOnly&&this.hasFocus()&&window.mathVirtualKeyboard.visible&&this.executeCommand("hideVirtualKeyboard");const d=oi.serialize([this.model.root],{expandMacro:!1,defaultMode:this.options.defaultMode});("macros"in r||this.model.getValue()!==d)&&Bn.insert(this.model,d,{insertionMode:"replaceAll",selectionMode:"after",format:"latex",silenceNotifications:!0,mode:"math"}),("value"in r||"macros"in r||"registers"in r||"colorMap"in r||"backgroundColorMap"in r||"letterShapeStyle"in r||"minFontScale"in r||"readOnly"in r||"placeholderSymbol"in r)&&ls(this)}getOptions(r){return Uo(this.options,r)}getOption(r){return Uo(this.options,r)}handleEvent(r){return $0(this,null,function*(){var o;if(Jo(this)){if($g(r)){if(!ah(r.origin,(o=this.options.originValidator)!=null?o:"none"))throw new DOMException(`Message from unknown origin (${r.origin}) cannot be handled`,"SecurityError");const{action:u}=r.data;if(u==="execute-command"){const d=r.data.command;if(Sc(d)==="virtual-keyboard")return;this.executeCommand(d)}else u==="update-state"||(u==="focus"?this.focus({preventScroll:!0}):u==="blur"&&this.blur());return}switch(r.type){case"focus":this.onFocus();break;case"blur":this.onBlur();break;case"mousedown":this.userSelect!=="none"&&hd(this,r);break;case"pointerdown":this.userSelect!=="none"&&(hd(this,r),r.shiftKey===!1&&(yield Na(r,this.element.querySelector("[part=container]"),this._menu))&&tv.stop());break;case"contextmenu":this.userSelect!=="none"&&r.shiftKey===!1&&(yield Na(r,this.element.querySelector("[part=container]"),this._menu))&&tv.stop();break;case"virtual-keyboard-toggle":this.hasFocus()&&Gl(this);break;case"resize":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>Jo(this)&&this.onGeometryChange());break;case"scroll":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>Jo(this)&&this.onGeometryChange());break;case"wheel":this.onWheel(r);break;default:console.warn("Unexpected event type",r.type)}}})}dispose(){if(!Jo(this))return;$t.unsubscribe(this._l10Subscription),this.keyboardDelegate.dispose(),this.keyboardDelegate=void 0,this.eventController.abort(),this.eventController=void 0,this.resizeObserver.disconnect(),window.mathVirtualKeyboard.removeEventListener("virtual-keyboard-toggle",this),this.disconnectFromVirtualKeyboard(),this.model.dispose();const r=this.element;delete r.mathfield,this.element=void 0,this.host=void 0,this.field=void 0,this.ariaLiveText=void 0,ue(),pl(),b1()}flushInlineShortcutBuffer(r){if(r!=null||(r={defer:!1}),!r.defer){this.inlineShortcutBuffer=[],clearTimeout(this.inlineShortcutBufferFlushTimer),this.inlineShortcutBufferFlushTimer=0;return}this.options.inlineShortcutTimeout>0&&(clearTimeout(this.inlineShortcutBufferFlushTimer),this.inlineShortcutBufferFlushTimer=setTimeout(()=>this.flushInlineShortcutBuffer(),this.options.inlineShortcutTimeout))}executeCommand(r){return Sc(r)==="virtual-keyboard"?(this.focus({preventScroll:!0}),window.mathVirtualKeyboard.executeCommand(r),requestAnimationFrame(()=>window.mathVirtualKeyboard.update($a(this))),!1):Qv(this,r)}get errors(){return ed(this.model.getValue(),{context:this.context})}getValue(r,o,u){return this.model.getValue(r,o,u)}setValue(r,o){var u;o=o!=null?o:{mode:"math"},o.insertionMode===void 0&&(o.insertionMode="replaceAll"),(o.format===void 0||o.format==="auto")&&(o.format="latex"),(o.mode===void 0||o.mode==="auto")&&(o.mode=(u=im(this.model,this.model.position))!=null?u:"math");const d=this.undoManager.canUndo();Bn.insert(this.model,r,o)&&(ls(this),d||this.undoManager.reset(),this.undoManager.snapshot("set-value"))}get expression(){const r=window.MathfieldElement.computeEngine;return r?r.box(r.parse(this.model.getValue("latex-unstyled"))):(console.error("MathLive 0.98.5: no compute engine available. Make sure the Compute Engine library is loaded."),null)}scrollIntoView(){var r;if(!this.element)return;if(this.host){if(this.options.onScrollIntoView)this.options.onScrollIntoView(this);else if(this.host.scrollIntoView({block:"nearest",inline:"nearest"}),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.container===window.document.body){const d=window.mathVirtualKeyboard.boundingRect,g=this.host.getBoundingClientRect();g.bottom>d.top&&((r=window.document.scrollingElement)==null||r.scrollBy(0,g.bottom-d.top+8))}}this.dirty&&qd(this,{interactive:!0});const o=this.field.getBoundingClientRect();let u=null;if(this.model.selectionIsCollapsed)u=ku(this.field);else{const d=Zp(this);if(d.length>0){let g=-1/0,b=-1/0;for(const M of d)M.right>g&&(g=M.right),M.top<b&&(b=M.top);u={x:g+o.left-this.field.scrollLeft,y:b+o.top-this.field.scrollTop,height:0}}}if(this.host&&u){const d=this.host.getBoundingClientRect(),g=u.y;let b=this.host.scrollTop;g<d.top?b=g-d.top+this.host.scrollTop:g>d.bottom&&(b=g-d.bottom+this.host.scrollTop+u.height),this.host.scroll({top:b,left:0})}if(u){const d=u.x-window.scrollX;let g=this.field.scrollLeft;d<o.left?g=d-o.left+this.field.scrollLeft-20:d>o.right&&(g=d-o.right+this.field.scrollLeft+20),this.field.scroll({top:this.field.scrollTop,left:g})}}insert(r,o){return typeof r!="string"||r.length===0&&((o==null?void 0:o.insertionMode)==="insertBefore"||(o==null?void 0:o.insertionMode)==="insertAfter")||r.length===0&&this.model.selectionIsCollapsed?!1:(this.flushInlineShortcutBuffer(),o=o!=null?o:{mode:"math"},o.focus&&this.focus(),o.feedback&&(window.MathfieldElement.keypressVibration&&Jt()&&navigator.vibrate(zg),window.MathfieldElement.playSound("keypress")),r==="\\\\"?Mc(this.model):r==="&"?Gg(this.model):this.model.selectionIsCollapsed?Bn.insert(this.model,r,Q({style:this.model.at(this.model.position).computedStyle},o)):Bn.insert(this.model,r,o),this.snapshot(`insert-${this.model.at(this.model.position).type}`),ls(this),o.scrollIntoView&&this.scrollIntoView(),!0)}switchMode(r,o="",u=""){var d;if(this.model.mode===r||!this.hasEditableContent||!this.contentEditable||this.disabled)return;const g=this.model.mode;if(this.model.mode=r,!((d=this.host)!=null&&d.dispatchEvent(new Event("mode-change",{bubbles:!0,composed:!0,cancelable:!0})))){this.model.mode=g;return}const b=this.model.mode,{model:M}=this;M.deferNotifications({content:!!u||!!o,selection:!0,type:"insertText"},()=>{let N=!1;if(this.flushInlineShortcutBuffer(),this.stopCoalescingUndo(),o&&r!=="latex"){const I=vs(o,{context:this.context,parseMode:r});M.collapseSelection("forward");const F=M.at(M.position);M.position=M.offsetOf(F.parent.addChildrenAfter(I,F)),N=!0}if(this.model.mode=r,r==="latex"){let I=M.selectionIsCollapsed;Yd(this,"accept");let F,$=M.at(M.position);if(I)F="\\";else{const gt=Yo(M.selection);F=this.model.getValue(gt,"latex");const _t=this.model.extractAtoms(gt);_t.length===1&&_t[0].type==="placeholder"&&(F=o,I=!0),$=M.at(gt[0])}const it=new Xp(F);$.parent.addChildAfter(it,$),I?M.position=M.offsetOf(it.lastChild):M.setSelection(M.offsetOf(it.firstChild),M.offsetOf(it.lastChild))}else _a(M).forEach(I=>{I.isError=!1});if(u){const I=vs(u,{context:this.context,parseMode:b});M.collapseSelection("forward");const F=M.at(M.position);M.position=M.offsetOf(F.parent.addChildrenAfter(I,F)),N=!0}return ls(this),this.undoManager.snapshot(r==="latex"?"insert-latex":"insert"),N}),this.model.mode=r,window.mathVirtualKeyboard.update($a(this))}hasFocus(){return!this.blurred}focus(r){var o;this.hasFocus()||(this.keyboardDelegate.focus(),this.connectToVirtualKeyboard(),this.onFocus(),this.model.announce("line")),(o=r==null?void 0:r.preventScroll)!=null&&o||this.scrollIntoView()}blur(){this.disconnectFromVirtualKeyboard(),this.hasFocus()&&this.keyboardDelegate.blur()}select(){this.model.selection={ranges:[[0,this.model.lastOffset]]},this.focus()}applyStyle(r,o={}){var u,d;const g={operation:"set",silenceNotifications:!1};Jc(o)?g.range=o:(o.operation==="toggle"&&(g.operation="toggle"),g.range=o.range,g.silenceNotifications=(u=o.silenceNotifications)!=null?u:!1);const b=Fm(this,r),M=(d=g.operation)!=null?d:"set";if(g.range===void 0&&this.model.selectionIsCollapsed){if(M==="set"){this.defaultStyle=Q(Q({},this.defaultStyle),b);return}const N=Q({},this.defaultStyle);for(const I of Object.keys(b))N[I]===b[I]?(I==="color"&&delete N.verbatimColor,I==="backgroundColor"&&delete N.verbatimBackgroundColor,delete N[I]):N[I]=b[I];this.defaultStyle=N;return}this.model.deferNotifications({content:!g.silenceNotifications,type:"insertText"},()=>{if(g.range===void 0)for(const N of this.model.selection.ranges)_m(this.model,N,b,{operation:M});else _m(this.model,g.range,b,{operation:M})}),ls(this)}toggleContextMenu(){var r;return this._menu.visible?this._menu.state==="open"?(this._menu.hide(),!0):(this._menu.show({target:this.element.querySelector("[part=container]"),location:(r=this.getCaretPoint())!=null?r:void 0,onDismiss:()=>{var o;return(o=this.element)==null?void 0:o.focus()}}),!0):!1}getCaretPoint(){const r=ku(this.field);return r?{x:r.x,y:r.y}:null}setCaretPoint(r,o){const u=cd(this,r,o,{bias:0});if(u<0)return!1;const d=this.model.position;return this.model.position=u,this.model.announce("move",d),ls(this),!0}getPrompt(r){const o=this.model.findAtom(u=>u.type==="prompt"&&u.placeholderId===r);return console.assert(o!==void 0,"MathLive 0.98.5: no prompts with matching ID found"),o}getPromptValue(r,o){const u=this.getPrompt(r);if(!u)return"";const d=this.model.offsetOf(u.firstChild),g=this.model.offsetOf(u.lastChild);return this.model.getValue(d,g,o)}getPrompts(r){return this.model.getAllAtoms().filter(o=>o.type!=="prompt"?!1:r?!(r.id&&o.placeholderId!==r.id||r.locked&&o.locked!==r.locked||r.correctness==="undefined"&&o.correctness||r.correctness&&o.correctness!==r.correctness):!0).map(o=>o.placeholderId)}setPromptValue(r,o,u){if(o!==void 0){const d=this.getPrompt(r);if(!d){console.error(`MathLive 0.98.5: unknown prompt ${r}`);return}const g=this.model.getBranchRange(this.model.offsetOf(d),"body");this.model.setSelection(g),this.insert(o,rt(Q({},u),{insertionMode:"replaceSelection"}))}u!=null&&u.silenceNotifications&&(this.valueOnFocus=this.getValue()),ls(this)}setPromptState(r,o,u){const d=this.getPrompt(r);if(!d){console.error(`MathLive 0.98.5: unknown prompt ${r}`);return}o==="undefined"?d.correctness=void 0:typeof o=="string"&&(d.correctness=o),typeof u=="boolean"&&(d.locked=u,d.captureSelection=u),ls(this)}getPromptState(r){const o=this.getPrompt(r);return o?[o.correctness,o.locked]:(console.error(`MathLive 0.98.5: unknown prompt ${r}`),[void 0,!0])}getPromptRange(r){const o=this.getPrompt(r);return o?this.model.getBranchRange(this.model.offsetOf(o),"body"):(console.error(`MathLive 0.98.5: unknown prompt ${r}`),[0,0])}canUndo(){return this.undoManager.canUndo()}canRedo(){return this.undoManager.canRedo()}popUndoStack(){this.undoManager.pop()}snapshot(r){var o;this.undoManager.snapshot(r)&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update($a(this)),(o=this.host)==null||o.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"snapshot"}})))}stopCoalescingUndo(){this.undoManager.stopCoalescing(this.model.selection)}stopRecording(){this.undoManager.stopRecording()}startRecording(){this.undoManager.startRecording()}undo(){var r;this.undoManager.undo()&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update($a(this)),(r=this.host)==null||r.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}redo(){var r;this.undoManager.redo()&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update($a(this)),(r=this.host)==null||r.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}resetUndo(){var r;(r=this.undoManager)==null||r.reset()}onSelectionDidChange(){var r,o;const u=this.model;this.keyboardDelegate.setValue(u.getValue(this.model.selection,"latex-expanded"));{const d=u.at(u.position),g=(r=d.mode)!=null?r:ui(this.options);this.model.mode!==g&&(this.model.mode==="latex"?(Yd(this,"accept",{mode:g}),u.position=u.offsetOf(d)):this.switchMode(g))}(o=this.host)==null||o.dispatchEvent(new Event("selection-change",{bubbles:!0,composed:!0})),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update($a(this)),Gl(this)}onContentWillChange(r){var o,u,d;return(d=(u=this.host)==null?void 0:u.dispatchEvent(new InputEvent("beforeinput",rt(Q({},r),{data:r.data?r.data:(o=r.inputType)!=null?o:"",cancelable:!0,bubbles:!0,composed:!0}))))!=null?d:!0}onFocus(){this.focusBlurInProgress||!this.blurred||(this.focusBlurInProgress=!0,this.blurred=!1,this.keyboardDelegate.focus(),this.stopCoalescingUndo(),qd(this,{interactive:!0}),this.valueOnFocus=this.model.getValue(),this.hasEditablePrompts&&!this.model.at(this.model.anchor).parentPrompt&&this.executeCommand("moveToNextPlaceholder"),this.focusBlurInProgress=!1)}onBlur(){var r,o,u;if(this.focusBlurInProgress||this.blurred)return;this.focusBlurInProgress=!0,this.stopCoalescingUndo(),this.blurred=!0,this.ariaLiveText.textContent="",Ta(this),this.model.getValue()!==this.valueOnFocus&&((r=this.host)==null||r.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),this.disconnectFromVirtualKeyboard(),(o=this.host)==null||o.dispatchEvent(new Event("blur",{bubbles:!1,composed:!0})),(u=this.host)==null||u.dispatchEvent(new UIEvent("focusout",{bubbles:!0,composed:!0})),ls(this),this.focusBlurInProgress=!1,cu();const d=new AbortController,g=d.signal;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&document.addEventListener("visibilitychange",()=>{Jo(this)&&document.visibilityState==="visible"&&this.focus({preventScroll:!0})},{once:!0,signal:g})},{once:!0,signal:g}),setTimeout(()=>d.abort(),100)}onInput(r){qg(this,r)}onKeystroke(r){return hp(this,r)}onCompositionStart(r){this.model.deleteAtoms(Yo(this.model.selection));const o=ku(this.field);o&&requestAnimationFrame(()=>{qd(this),this.keyboardDelegate.moveTo(o.x,o.y-o.height)})}onCompositionUpdate(r){px(this.model,r),ls(this)}onCompositionEnd(r){Zg(this.model),qg(this,r,{simulateKeystroke:!0})}onCut(r){if(!this.isSelectionEditable){this.model.announce("plonk");return}this.model.contentWillChange({inputType:"deleteByCut"})&&(this.stopCoalescingUndo(),Bn.onCopy(this,r),Ha(this.model,Yo(this.model.selection),"deleteByCut"),this.snapshot("cut"),ls(this))}onCopy(r){Bn.onCopy(this,r)}onPaste(r){let o=this.isSelectionEditable;return o&&(o=Bn.onPaste(this.model.at(this.model.position).mode,this,r.clipboardData)),o||this.model.announce("plonk"),r.preventDefault(),r.stopPropagation(),o}onGeometryChange(){this._menu.hide(),xm(this),Gl(this)}onWheel(r){const o=5*r.deltaX;if(!Number.isFinite(o)||o===0)return;const u=this.field;o<0&&u.scrollLeft===0||o>0&&u.offsetWidth+u.scrollLeft>=u.scrollWidth||(u.scrollBy({top:0,left:o}),r.preventDefault(),r.stopPropagation())}getHTMLElement(r){let o=r;for(;!o.id&&o.hasChildren;)o=r.children[0];return this.field.querySelector(`[data-atom-id="${o.id}"]`)}get context(){var r,o;return{registers:(r=this.options.registers)!=null?r:{},smartFence:this.smartFence,letterShapeStyle:this.letterShapeStyle,minFontScale:this.minFontScale,placeholderSymbol:(o=this.options.placeholderSymbol)!=null?o:"\u25A2",colorMap:u=>this.colorMap(u),backgroundColorMap:u=>this.backgroundColorMap(u),getMacro:u=>Ii(u,this.options.macros),atomIdsSettings:{seed:"random",groupNumbers:!1}}}};function gd(r){if(r&&(r.classList.remove("ML__highlight"),r.children))for(const o of r.children)gd(o)}function pf(r,o){var u;r&&(!o||((u=r.dataset)==null?void 0:u.atomId)===o?(r.classList.add("ML__highlight"),r.children&&r.children.length>0&&[...r.children].forEach(d=>{d instanceof HTMLElement&&pf(d)})):(r.classList.remove("ML__highlight"),r.children&&r.children.length>0&&[...r.children].forEach(d=>{d instanceof HTMLElement&&pf(d,o)})))}function wv(r,o){var u;if(!Ce())return;if(window.MathfieldElement.speechEngine!=="amazon"){console.error("MathLive 0.98.5: Use Amazon TTS Engine for synchronized highlighting"),typeof window.MathfieldElement.speakHook=="function"&&window.MathfieldElement.speakHook(o);return}if(!window.AWS){console.error("MathLive 0.98.5: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");return}const d=new window.AWS.Polly({apiVersion:"2016-06-10"}),g={OutputFormat:"json",VoiceId:(u=window.MathfieldElement.speechEngineVoice)!=null?u:"Joanna",Engine:"standard",Text:o,TextType:"ssml",SpeechMarkTypes:["ssml"]};Xh().readAloudElement=r,d.synthesizeSpeech(g,(b,M)=>{if(b){console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech()\` error: ${b}`);return}if(!(M!=null&&M.AudioStream)){console.log("polly.synthesizeSpeech():",M);return}const N=new TextDecoder("utf-8").decode(new Uint8Array(M.AudioStream));Xh().readAloudMarks=N.split(`
`).map(I=>I?JSON.parse(I):{}),Xh().readAloudTokens=[];for(const I of Xh().readAloudMarks)I.value&&Xh().readAloudTokens.push(I.value);Xh().readAloudCurrentMark="",g.OutputFormat="mp3",g.SpeechMarkTypes=[],d.synthesizeSpeech(g,(I,F)=>{if(I){console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech("${o}") error:${I}`);return}if(!(F!=null&&F.AudioStream))return;const $=new Uint8Array(F.AudioStream),it=new Blob([$.buffer],{type:"audio/mpeg"}),gt=URL.createObjectURL(it),_t=Xh();_t.readAloudAudio?_t.readAloudAudio.pause():(_t.readAloudAudio=new Audio,_t.readAloudAudio.addEventListener("ended",()=>{const zt=_t.readAloudMathfield;_t.readAloudStatus="ended",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),zt?(qd(zt),_t.readAloudElement=null,_t.readAloudMathfield=null,_t.readAloudTokens=[],_t.readAloudMarks=[],_t.readAloudCurrentMark=""):gd(_t.readAloudElement)}),_t.readAloudAudio.addEventListener("timeupdate",()=>{let zt="";const Ne=_t.readAloudAudio.currentTime*1e3+100;for(const Bi of _t.readAloudMarks)Bi.time<Ne&&(zt=Bi.value);_t.readAloudCurrentMark!==zt&&(_t.readAloudCurrentToken=zt,zt&&zt===_t.readAloudFinalToken?_t.readAloudAudio.pause():(_t.readAloudCurrentMark=zt,pf(_t.readAloudElement,_t.readAloudCurrentMark)))})),_t.readAloudAudio.src=gt,_t.readAloudStatus="playing",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),_t.readAloudAudio.play()})})}Ce()||console.error('MathLive 0.98.5: this version of the MathLive library is for use in the browser. A subset of the API is available on the server side in the "mathlive-ssr" library. If using server side rendering (with React for example) you may want to do a dynamic import of the MathLive library inside a `useEffect()` call.');var zr=new WeakMap,bv=.5,Zh={letterShapeStyle:"mf.letterShapeStyle = ...",horizontalSpacingScale:'Removed. Use `"thinmuskip"`, `"medmuskip"`, and `"thickmuskip"` registers ',macros:"mf.macros = ...",registers:"mf.registers = ...",backgroundColorMap:"mf.backgroundColorMap = ...",colorMap:"mf.colorMap = ...",enablePopover:"mf.popoverPolicy = ...",mathModeSpace:"mf.mathModeSpace = ...",placeholderSymbol:"mf.placeholderSymbol = ...",readOnly:"mf.readOnly = ...",removeExtraneousParentheses:"mf.removeExtraneousParentheses = ...",scriptDepth:"mf.scriptDepth = ...",smartFence:"mf.smartFence = ...",smartMode:"mf.smartMode = ...",smartSuperscript:"mf.smartSuperscript = ...",inlineShortcutTimeout:"mf.inlineShortcutTimeout = ...",inlineShortcuts:"mf.inlineShortcuts = ...",keybindings:"mf.keybindings = ...",virtualKeyboardMode:"mf.mathVirtualKeyboardPolicy = ...",customVirtualKeyboardLayers:"mathVirtualKeyboard.layers = ...",customVirtualKeyboards:"mathVirtualKeyboard.layouts = ...",keypressSound:"mathVirtualKeyboard.keypressSound = ...",keypressVibration:"mathVirtualKeyboard.keypressVibration = ...",plonkSound:"mathVirtualKeyboard.plonkSound = ...",virtualKeyboardContainer:"mathVirtualKeyboard.container = ...",virtualKeyboardLayout:"mathVirtualKeyboard.alphabeticLayout = ...",virtualKeyboardTheme:"No longer supported",virtualKeyboardToggleGlyph:"No longer supported",virtualKeyboardToolbar:"mathVirtualKeyboard.editToolbar = ...",virtualKeyboards:"Use `mathVirtualKeyboard.layouts`",speechEngine:"`MathfieldElement.speechEngine`",speechEngineRate:"`MathfieldElement.speechEngineRate`",speechEngineVoice:"`MathfieldElement.speechEngineVoice`",textToSpeechMarkup:"`MathfieldElement.textToSpeechMarkup`",textToSpeechRules:"`MathfieldElement.textToSpeechRules`",textToSpeechRulesOptions:"`MathfieldElement.textToSpeechRulesOptions`",readAloudHook:"`MathfieldElement.readAloudHook`",speakHook:"`MathfieldElement.speakHook`",computeEngine:"`MathfieldElement.computeEngine`",fontsDirectory:"`MathfieldElement.fontsDirectory`",soundsDirectory:"`MathfieldElement.soundsDirectory`",createHTML:"`MathfieldElement.createHTML`",onExport:"`MathfieldElement.onExport`",onInlineShortcut:"`MathfieldElement.onInlineShortcut`",onScrollIntoView:"`MathfieldElement.onScrollIntoView`",locale:"MathfieldElement.locale = ...",strings:"MathfieldElement.strings = ...",decimalSeparator:"MathfieldElement.decimalSeparator = ...",fractionNavigationOrder:"MathfieldElement.fractionNavigationOrder = ..."},Fs=class cg extends HTMLElement{static get formAssociated(){return Gh()}static get optionsAttributes(){return{"default-mode":"string","letter-shape-style":"string","min-font-scale":"number","popover-policy":"string","math-mode-space":"string","read-only":"boolean","remove-extraneous-parentheses":"on/off","smart-fence":"on/off","smart-mode":"on/off","smart-superscript":"on/off","inline-shortcut-timeout":"string","script-depth":"string",placeholder:"string","virtual-keyboard-target-origin":"string","math-virtual-keyboard-policy":"string"}}static get observedAttributes(){return[...Object.keys(this.optionsAttributes),"contenteditable","disabled","readonly","read-only"]}static get fontsDirectory(){return this._fontsDirectory}static set fontsDirectory(o){o!==this._fontsDirectory&&(this._fontsDirectory=o,r0())}get fontsDirectory(){throw new Error("Use MathfieldElement.fontsDirectory instead")}set fontsDirectory(o){throw new Error("Use MathfieldElement.fontsDirectory instead")}static get soundsDirectory(){return this._soundsDirectory}static set soundsDirectory(o){this._soundsDirectory=o,this.audioBuffers={}}get soundsDirectory(){throw new Error("Use MathfieldElement.soundsDirectory instead")}set soundsDirectory(o){throw new Error("Use MathfieldElement.soundsDirectory instead")}static get keypressSound(){return this._keypressSound}static set keypressSound(o){var u,d,g;this.audioBuffers={},o===null?this._keypressSound={spacebar:null,return:null,delete:null,default:null}:typeof o=="string"?this._keypressSound={spacebar:o,return:o,delete:o,default:o}:typeof o=="object"&&"default"in o&&(this._keypressSound={spacebar:(u=o.spacebar)!=null?u:o.default,return:(d=o.return)!=null?d:o.default,delete:(g=o.delete)!=null?g:o.default,default:o.default})}static get plonkSound(){return this._plonkSound}static set plonkSound(o){this.audioBuffers={},this._plonkSound=o}static get audioContext(){return this._audioContext||(this._audioContext=new AudioContext),this._audioContext}static get speechEngine(){return this._speechEngine}static set speechEngine(o){this._speechEngine=o}static get speechEngineRate(){return this._speechEngineRate}static set speechEngineRate(o){this._speechEngineRate=o}static get speechEngineVoice(){return this._speechEngineVoice}static set speechEngineVoice(o){this._speechEngineVoice=o}static get textToSpeechMarkup(){return this._textToSpeechMarkup}static set textToSpeechMarkup(o){this._textToSpeechMarkup=o}static get textToSpeechRules(){return this._textToSpeechRules}static set textToSpeechRules(o){this._textToSpeechRules=o}static get textToSpeechRulesOptions(){return this._textToSpeechRulesOptions}static set textToSpeechRulesOptions(o){this._textToSpeechRulesOptions=o}static get locale(){return $t.locale}static set locale(o){o==="auto"&&(o=navigator.language.slice(0,5)),$t.locale=o}get locale(){throw new Error("Use MathfieldElement.locale instead")}set locale(o){throw new Error("Use MathfieldElement.locale instead")}static get strings(){return $t.strings}static set strings(o){$t.merge(o)}get strings(){throw new Error("Use MathfieldElement.strings instead")}set strings(o){throw new Error("Use MathfieldElement.strings instead")}static get decimalSeparator(){return this._decimalSeparator}static set decimalSeparator(o){this._decimalSeparator=o,this._computeEngine&&(this._computeEngine.latexOptions.decimalMarker=this.decimalSeparator===","?"{,}":".")}get decimalSeparator(){throw new Error("Use MathfieldElement.decimalSeparator instead")}set decimalSeparator(o){throw new Error("Use MathfieldElement.decimalSeparator instead")}static get computeEngine(){var o,u;if(this._computeEngine===void 0){const d=(o=window[Symbol.for("io.cortexjs.compute-engine")])==null?void 0:o.ComputeEngine;if(!d)return null;this._computeEngine=new d,this._computeEngine&&this.decimalSeparator===","&&(this._computeEngine.latexOptions.decimalMarker="{,}")}return(u=this._computeEngine)!=null?u:null}static set computeEngine(o){this._computeEngine=o}get computeEngine(){throw new Error("Use MathfieldElement.computeEngine instead")}set computeEngine(o){throw new Error("Use MathfieldElement.computeEngine instead")}static get isFunction(){return typeof this._isFunction!="function"?()=>!1:this._isFunction}static set isFunction(o){this._isFunction=o}static loadSound(o){return $0(this,null,function*(){delete this.audioBuffers[o];let u="";switch(o){case"keypress":u=this._keypressSound.default;break;case"return":u=this._keypressSound.return;break;case"spacebar":u=this._keypressSound.spacebar;break;case"delete":u=this._keypressSound.delete;break;case"plonk":u=this.plonkSound;break}if(typeof u!="string")return;u=u.trim();const d=this.soundsDirectory;if(!(d==null||d==="null"||u==="none"||u==="null"))try{const b=yield(yield fetch(yield bm(`${d}/${u}`))).arrayBuffer(),M=yield this.audioContext.decodeAudioData(b);this.audioBuffers[o]=M}catch(g){}})}static playSound(o){return $0(this,null,function*(){if((this.audioContext.state==="suspended"||this.audioContext.state==="interrupted")&&(yield this.audioContext.resume()),this.audioBuffers[o]||(yield this.loadSound(o)),!this.audioBuffers[o])return;const u=this.audioContext.createBufferSource();u.buffer=this.audioBuffers[o];const d=this.audioContext.createGain();d.gain.value=bv,u.connect(d).connect(this.audioContext.destination),u.start()})}constructor(o){if(super(),o){const u=[];for(const d of Object.keys(o))if(Zh[d])if(Zh[d].startsWith("mf."))if(Zh[d].startsWith(`mf.${d}`))u.push(`Option \`${d}\` cannot be used as a constructor option. Use ${Zh[d]}`);else{const g=Zh[d].match(/([a-zA-Z]+) =/);u.push(`Option \`${d}\` has been renamed \`${g[1]}\``)}else u.push(`Option \`${d}\` cannot be used as a constructor option. Use ${Zh[d]}`);if(u.length>0){console.group("%cMathLive 0.98.5: %cInvalid Options","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),console.warn("Some of the options passed to `new MathfieldElement(...)` are invalid. \n See https://cortexjs.io/mathlive/changelog/ for details.");for(const d of u)console.warn(d);console.groupEnd()}}if(Gh()&&(this._internals=this.attachInternals(),this._internals.role="math",this._internals.ariaLabel="math input field",this._internals.ariaMultiLine="false"),this.attachShadow({mode:"open",delegatesFocus:!0}),this.shadowRoot&&"adoptedStyleSheets"in this.shadowRoot){this.shadowRoot.adoptedStyleSheets=[Lu("core"),Lu("mathfield"),Lu("mathfield-element"),Lu("ui"),Lu("menu")],this.shadowRoot.appendChild(document.createElement("span"));const u=document.createElement("slot");u.style.display="none",this.shadowRoot.appendChild(u)}else this.shadowRoot.innerHTML="<style>"+xc("core")+xc("mathfield")+xc("mathfield-element")+xc("ui")+xc("menu")+'</style><span></span><slot style="display:none"></slot>';o&&this._setOptions(o),this.shadowRoot.addEventListener("slotchange",()=>{var u;const d=this.shadowRoot.querySelector("slot:not([name])");this.value=(u=d==null?void 0:d.assignedNodes().map(g=>g.nodeType===3?g.textContent:"").join("").trim())!=null?u:""})}showMenu(o){var u,d;return(d=(u=this._mathfield)==null?void 0:u.showMenu(o))!=null?d:!1}get mathVirtualKeyboard(){throw new Error("The `mathVirtualKeyboard` property is not available on the MathfieldElement. Use `window.mathVirtualKeyboard` instead.")}onPointerDown(){window.addEventListener("pointerup",o=>{var u;o.target===this&&!((u=this._mathfield)!=null&&u.disabled)&&this.dispatchEvent(new MouseEvent("click",{altKey:o.altKey,button:o.button,buttons:o.buttons,clientX:o.clientX,clientY:o.clientY,ctrlKey:o.ctrlKey,metaKey:o.metaKey,movementX:o.movementX,movementY:o.movementY,relatedTarget:o.relatedTarget,screenX:o.screenX,screenY:o.screenY,shiftKey:o.shiftKey}))},{once:!0})}getPromptValue(o,u){var d,g;return(g=(d=this._mathfield)==null?void 0:d.getPromptValue(o,u))!=null?g:""}setPromptValue(o,u,d){var g;(g=this._mathfield)==null||g.setPromptValue(o,u,d)}getPromptRange(o){var u,d;return(d=(u=this._mathfield)==null?void 0:u.getPromptRange(o))!=null?d:null}getPrompts(o){var u,d;return(d=(u=this._mathfield)==null?void 0:u.getPrompts(o))!=null?d:[]}get form(){var o;return(o=this._internals)==null?void 0:o.form}get name(){var o;return(o=this.getAttribute("name"))!=null?o:""}get type(){return this.localName}get mode(){var o,u;return(u=(o=this._mathfield)==null?void 0:o.model.mode)!=null?u:this.defaultMode==="text"?"text":"math"}set mode(o){var u;(u=this._mathfield)==null||u.switchMode(o)}get expression(){if(this._mathfield)return window[Symbol.for("io.cortexjs.compute-engine")]?this._mathfield.expression:(console.error(`MathLive 0.98.5: The CortexJS Compute Engine library is not available.
Load the library, for example with:
import "https://unpkg.com/@cortex-js/compute-engine?module"`),null)}set expression(o){var u,d;if(!this._mathfield)return;const g=(d=(u=cg.computeEngine)==null?void 0:u.box(o).latex)!=null?d:null;g!==null&&this._mathfield.setValue(g),window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`MathLive 0.98.5: The CortexJS Compute Engine library is not available.
Load the library, for example with:
import "https://unpkg.com/@cortex-js/compute-engine?module"`)}get errors(){var o,u;return(u=(o=this._mathfield)==null?void 0:o.errors)!=null?u:[]}_getOptions(o){return this._mathfield?Uo(this._mathfield.options,o):zr.has(this)?Q({},Uo(Q(Q({},p0()),lp(zr.get(this).options)),o)):null}getOptions(o){return console.warn("%cMathLive 0.98.5: %cDeprecated Usage%c\n `mf.getOptions()` is deprecated. Read the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem","color: inherit, font-size: 1rem"),this._mathfield?Uo(this._mathfield.options,o):zr.has(this)?Uo(Q(Q({},p0()),lp(zr.get(this).options)),o):null}reflectAttributes(){const o=p0(),u=this._getOptions();Object.keys(cg.optionsAttributes).forEach(d=>{const g=ql(d);cg.optionsAttributes[d]==="on/off"?o[g]!==u[g]?this.setAttribute(d,u[g]?"on":"off"):this.removeAttribute(d):o[g]!==u[g]&&(cg.optionsAttributes[d]==="boolean"?u[g]?this.setAttribute(d,""):this.removeAttribute(d):(typeof u[g]=="string"||typeof u[g]=="number")&&this.setAttribute(d,u[g].toString()))})}getOption(o){return console.warn("%cMathLive 0.98.5: %cDeprecated Usage%c\n `mf.getOption()` is deprecated. Read the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem","color: inherit, font-size: 1rem"),this._getOptions([o])[o]}_getOption(o){return this._getOptions([o])[o]}_setOptions(o){if(this._mathfield)this._mathfield.setOptions(o);else if(zr.has(this)){const u=Q(Q({},zr.get(this).options),o);zr.set(this,rt(Q({},zr.get(this)),{selection:{ranges:u.readOnly?[[0,0]]:[[0,-1]]},options:u}))}else zr.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:o,menuItems:void 0});this.reflectAttributes()}setOptions(o){console.group("%cMathLive 0.98.5: %cDeprecated Usage","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),console.warn(" `mf.setOptions()` is deprecated. Set the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.");for(const u of Object.keys(o))Zh[u]&&console.warn(`\`mf.setOptions({${u}:...})\` -> ${Zh[u]}`);console.groupEnd(),this._setOptions(o)}executeCommand(o){var u,d;return(d=(u=this._mathfield)==null?void 0:u.executeCommand(o))!=null?d:!1}getValue(o,u,d){var g,b;if(this._mathfield)return this._mathfield.model.getValue(o,u,d);if(zr.has(this)){let M,N,I;if(Vf(o)?([M,N]=o.ranges[0],I=u):Jc(o)?([M,N]=o,I=u):rh(o)&&rh(u)?(M=o,N=u,I=d):(M=0,N=-1,I=o),(I===void 0||I==="latex")&&M===0&&N===-1)return(b=(g=zr.get(this).value)!=null?g:this.textContent)!=null?b:""}return""}setValue(o,u){if(this._mathfield&&o!==void 0){u!=null||(u={silenceNotifications:!0,mode:"math"}),this._mathfield.setValue(o,u);return}if(zr.has(this)){const g=zr.get(this).options;zr.set(this,{value:o,selection:{ranges:[[-1,-1]],direction:"forward"},options:g,menuItems:void 0});return}const d=vd(this);zr.set(this,{value:o,selection:{ranges:[[-1,-1]],direction:"forward"},options:d,menuItems:void 0})}hasFocus(){var o,u;return(u=(o=this._mathfield)==null?void 0:o.hasFocus())!=null?u:!1}focus(){var o;(o=this._mathfield)==null||o.focus()}blur(){var o;(o=this._mathfield)==null||o.blur()}select(){var o;(o=this._mathfield)==null||o.select()}insert(o,u){var d,g;return(g=(d=this._mathfield)==null?void 0:d.insert(o,u))!=null?g:!1}applyStyle(o,u){var d;return(d=this._mathfield)==null?void 0:d.applyStyle(o,u)}queryStyle(o){var u,d;return(d=(u=this._mathfield)==null?void 0:u.queryStyle(o))!=null?d:"none"}get caretPoint(){var o,u;return(u=(o=this._mathfield)==null?void 0:o.getCaretPoint())!=null?u:null}set caretPoint(o){var u;o&&((u=this._mathfield)==null||u.setCaretPoint(o.x,o.y))}setCaretPoint(o,u){var d,g;return(g=(d=this._mathfield)==null?void 0:d.setCaretPoint(o,u))!=null?g:!1}offsetFromPoint(o,u,d){return this._mathfield?cd(this._mathfield,o,u,d):-1}hitboxFromOffset(o){if(!this._mathfield)return null;const u=this._mathfield.model.at(o);if(!u)return null;const d=td(this._mathfield,u);return d?new DOMRect(d.left,d.top,d.right-d.left,d.bottom-d.top):null}resetUndo(){var o;(o=this._mathfield)==null||o.resetUndo()}canUndo(){return this._mathfield?this._mathfield.canUndo():!1}canRedo(){return this._mathfield?this._mathfield.canRedo():!1}handleEvent(o){var u,d,g,b;Vh.state==="closed"&&((d=(u=this._mathfield)==null?void 0:u.menu)==null?void 0:d.state)==="closed"&&(o.type==="pointerdown"&&this.onPointerDown(),o.type==="focus"&&((g=this._mathfield)==null||g.focus()),o.type==="blur"&&((b=this._mathfield)==null||b.blur()))}connectedCallback(){var o,u,d,g;const b=window.getComputedStyle(this),M=this.shadowRoot,N=b.userSelect!=="none";if(N)M.host.addEventListener("pointerdown",this,!0);else{const $=M.querySelector("span");$.style.pointerEvents="none"}M.host.addEventListener("focus",this,!0),M.host.addEventListener("blur",this,!0),Gh()||(this.hasAttribute("role")||this.setAttribute("role","math"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","math input field"),this.setAttribute("aria-multiline","false")),N&&!this.hasAttribute("contenteditable")&&this.setAttribute("contenteditable","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const I=M.querySelector("slot:not([name])");if(I)try{this._style=I.assignedElements().filter($=>$.tagName.toLowerCase()==="style").map($=>$.textContent).join("")}catch($){console.error($)}if(this._style){const $=document.createElement("style");$.textContent=this._style,M.appendChild($)}let F="";if(this.hasAttribute("value")?F=this.getAttribute("value"):F=(o=I==null?void 0:I.assignedNodes().map($=>$.nodeType===3?$.textContent:"").join("").trim())!=null?o:"",this._mathfield=new md(M.querySelector(":host > span"),rt(Q({},(d=(u=zr.get(this))==null?void 0:u.options)!=null?d:vd(this)),{eventSink:this,value:F})),!zr.has(this)){this.upgradeProperty("disabled"),this.upgradeProperty("readonly");for(const $ of Object.keys(cg.optionsAttributes))this.upgradeProperty(ql($))}if(!((g=this._mathfield)!=null&&g.model)){this._mathfield=null;return}if(zr.has(this)){const $=this._mathfield,it=zr.get(this),gt=it.menuItems;$.model.deferNotifications({content:!1,selection:!1},()=>{const _t=it.value;_t!==void 0&&$.setValue(_t),$.model.selection=it.selection,zr.delete(this)}),gt&&(this.menuItems=gt)}window.queueMicrotask(()=>{this.isConnected&&this.dispatchEvent(new Event("mount",{cancelable:!1,bubbles:!0,composed:!0}))}),o0()}disconnectedCallback(){var o,u;if(this.shadowRoot.host.removeEventListener("pointerdown",this,!0),!this._mathfield)return;window.queueMicrotask(()=>this.dispatchEvent(new Event("unmount",{cancelable:!1,bubbles:!0,composed:!0})));const d=Uo(this._mathfield.options,Object.keys(cg.optionsAttributes).map(g=>ql(g)));zr.set(this,{value:this._mathfield.getValue(),selection:this._mathfield.model.selection,menuItems:(u=(o=this._mathfield.menu)==null?void 0:o.menuItems)!=null?u:void 0,options:d}),this._mathfield.dispose(),this._mathfield=null}upgradeProperty(o){if(this.hasOwnProperty(o)){const u=this[o];delete this[o],(o==="readonly"||o==="read-only")&&(o="readOnly"),this[o]=u}}attributeChangedCallback(o,u,d){if(u===d)return;const g=d!==null;switch(o){case"contenteditable":ls(this._mathfield);break;case"disabled":this.disabled=g;break;case"read-only":case"readonly":this.readOnly=g;break;default:}}get readonly(){return this.hasAttribute("readonly")||this.hasAttribute("read-only")}set readonly(o){const u=!!o;u?(this.setAttribute("readonly",""),Gh()?this._internals.ariaReadOnly="true":this.setAttribute("aria-readonly","true"),this.setAttribute("aria-readonly","true")):(Gh()?this._internals.ariaReadOnly="false":this.removeAttribute("aria-readonly"),this.removeAttribute("readonly"),this.removeAttribute("read-only")),this._setOptions({readOnly:u})}get disabled(){return this.hasAttribute("disabled")}set disabled(o){var u;const d=!!o;d?this.setAttribute("disabled",""):this.removeAttribute("disabled"),Gh()?this._internals.ariaDisabled=d?"true":"false":this.setAttribute("aria-disabled",d?"true":"false"),d&&((u=this._mathfield)!=null&&u.hasFocus)&&window.mathVirtualKeyboard.visible&&this._mathfield.executeCommand("hideVirtualKeyboard")}get value(){return this.getValue()}set value(o){this.setValue(o)}get defaultMode(){return this._getOption("defaultMode")}set defaultMode(o){this._setOptions({defaultMode:o})}get macros(){return this._getOption("macros")}set macros(o){this._setOptions({macros:o})}get registers(){const o=this;return new Proxy({},{get:(u,d)=>{if(typeof d=="string")return o._getOption("registers")[d]},set(u,d,g){return typeof d!="string"?!1:(o._setOptions({registers:rt(Q({},o._getOption("registers")),{[d]:g})}),!0)}})}set registers(o){this._setOptions({registers:o})}get colorMap(){return this._getOption("colorMap")}set colorMap(o){this._setOptions({colorMap:o})}get backgroundColorMap(){return this._getOption("backgroundColorMap")}set backgroundColorMap(o){this._setOptions({backgroundColorMap:o})}get letterShapeStyle(){return this._getOption("letterShapeStyle")}set letterShapeStyle(o){this._setOptions({letterShapeStyle:o})}get minFontScale(){return this._getOption("minFontScale")}set minFontScale(o){this._setOptions({minFontScale:o})}get smartMode(){return this._getOption("smartMode")}set smartMode(o){this._setOptions({smartMode:o})}get smartFence(){return this._getOption("smartFence")}set smartFence(o){this._setOptions({smartFence:o})}get smartSuperscript(){return this._getOption("smartSuperscript")}set smartSuperscript(o){this._setOptions({smartSuperscript:o})}get scriptDepth(){return this._getOption("scriptDepth")}set scriptDepth(o){this._setOptions({scriptDepth:o})}get removeExtraneousParentheses(){return this._getOption("removeExtraneousParentheses")}set removeExtraneousParentheses(o){this._setOptions({removeExtraneousParentheses:o})}get mathModeSpace(){return this._getOption("mathModeSpace")}set mathModeSpace(o){this._setOptions({mathModeSpace:o})}get placeholderSymbol(){return this._getOption("placeholderSymbol")}set placeholderSymbol(o){this._setOptions({placeholderSymbol:o})}get popoverPolicy(){return this._getOption("popoverPolicy")}set popoverPolicy(o){this._setOptions({popoverPolicy:o})}get environmentPopoverPolicy(){return this._getOption("environmentPopoverPolicy")}set environmentPopoverPolicy(o){this._setOptions({environmentPopoverPolicy:o})}get menuItems(){var o,u,d;return this._mathfield?(o=this._mathfield.menu._menuItems.map(g=>g.menuItem))!=null?o:[]:(d=(u=zr.get(this))==null?void 0:u.menuItems)!=null?d:[]}set menuItems(o){var u;if(this._mathfield){const d=(u=this._mathfield.element)==null?void 0:u.querySelector("[part=menu-toggle]");d&&(d.style.display=o.length===0?"none":""),this._mathfield.menu.menuItems=o}zr.has(this)?zr.set(this,rt(Q({},zr.get(this)),{menuItems:o})):zr.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:vd(this),menuItems:o})}get mathVirtualKeyboardPolicy(){return this._getOption("mathVirtualKeyboardPolicy")}set mathVirtualKeyboardPolicy(o){this._setOptions({mathVirtualKeyboardPolicy:o})}get inlineShortcuts(){return this._getOption("inlineShortcuts")}set inlineShortcuts(o){this._setOptions({inlineShortcuts:o})}get inlineShortcutTimeout(){return this._getOption("inlineShortcutTimeout")}set inlineShortcutTimeout(o){this._setOptions({inlineShortcutTimeout:o})}get keybindings(){return this._getOption("keybindings")}set keybindings(o){this._setOptions({keybindings:o})}get onInlineShortcut(){return this._getOption("onInlineShortcut")}set onInlineShortcut(o){this._setOptions({onInlineShortcut:o})}get onScrollIntoView(){return this._getOption("onScrollIntoView")}set onScrollIntoView(o){this._setOptions({onScrollIntoView:o})}get onExport(){return this._getOption("onExport")}set onExport(o){this._setOptions({onExport:o})}get readOnly(){return this._getOption("readOnly")}set readOnly(o){this._setOptions({readOnly:o})}get isSelectionEditable(){var o,u;return(u=(o=this._mathfield)==null?void 0:o.isSelectionEditable)!=null?u:!1}setPromptState(o,u,d){var g;(g=this._mathfield)==null||g.setPromptState(o,u,d)}getPromptState(o){var u,d;return(d=(u=this._mathfield)==null?void 0:u.getPromptState(o))!=null?d:[void 0,!0]}get virtualKeyboardTargetOrigin(){return this._getOption("virtualKeyboardTargetOrigin")}set virtualKeyboardTargetOrigin(o){this._setOptions({virtualKeyboardTargetOrigin:o})}get selection(){return this._mathfield?this._mathfield.model.selection:zr.has(this)?zr.get(this).selection:{ranges:[[0,0]],direction:"forward"}}set selection(o){if(typeof o=="number"&&(o={ranges:[[o,o]]}),this._mathfield){this._mathfield.model.selection=o,ls(this._mathfield);return}if(zr.has(this)){zr.set(this,rt(Q({},zr.get(this)),{selection:o}));return}zr.set(this,{value:void 0,selection:o,options:vd(this),menuItems:void 0})}get selectionIsCollapsed(){const o=this.selection;return o.ranges.length===1&&o.ranges[0][0]===o.ranges[0][1]}get position(){return this._mathfield?this._mathfield.model.position:zr.has(this)?zr.get(this).selection.ranges[0][0]:0}set position(o){if(this._mathfield&&(this._mathfield.model.position=o,ls(this._mathfield)),zr.has(this)){zr.set(this,rt(Q({},zr.get(this)),{selection:{ranges:[[o,o]]}}));return}zr.set(this,{value:void 0,selection:{ranges:[[o,o]]},options:vd(this),menuItems:void 0})}getOffsetDepth(o){var u,d;return this._mathfield?((d=(u=this._mathfield.model.at(o))==null?void 0:u.treeDepth)!=null?d:2)-2:0}get lastOffset(){var o,u;return(u=(o=this._mathfield)==null?void 0:o.model.lastOffset)!=null?u:-1}};Fs.version="0.98.5",Fs._fontsDirectory="./fonts",Fs._soundsDirectory="./sounds",Fs.keypressVibration=!0,Fs._keypressSound={spacebar:"keypress-spacebar.wav",return:"keypress-return.wav",delete:"keypress-delete.wav",default:"keypress-standard.wav"},Fs._plonkSound="plonk.wav",Fs.audioBuffers={},Fs.createHTML=r=>r,Fs._speechEngineRate="100%",Fs._speechEngineVoice="Joanna",Fs._textToSpeechMarkup="",Fs._textToSpeechRules="mathlive",Fs._textToSpeechRulesOptions={},Fs.speakHook=N1,Fs.readAloudHook=wv,Fs._decimalSeparator=".",Fs.fractionNavigationOrder="numerator-denominator",Fs._isFunction=r=>{var o,u;const d=window.MathfieldElement.computeEngine;return(u=(o=d==null?void 0:d.parse(r).domain)==null?void 0:o.isFunction)!=null?u:!1};var mf=Fs;function ql(r){return r.replace(/[^a-zA-Z\d]+(.)/g,(o,u)=>u.toUpperCase())}function vd(r){const o={readOnly:!1},u=mf.optionsAttributes;return Object.keys(u).forEach(d=>{if(r.hasAttribute(d)){const g=r.getAttribute(d);d==="placeholder"?o.contentPlaceholder=g!=null?g:"":u[d]==="boolean"?o[ql(d)]=!0:u[d]==="on/off"?g==="on"?o[ql(d)]=!0:g==="off"?o[ql(d)]=!1:o[ql(d)]=void 0:u[d]==="number"?o[ql(d)]=Number.parseFloat(g!=null?g:"0"):o[ql(d)]=g}}),o}function Gh(){return!(!("ElementInternals"in window)||!HTMLElement.prototype.attachInternals||!("role"in window.ElementInternals.prototype))}var N0=mf,Tc,Ym,ys,Dy;if(Ce()&&!((Tc=window.customElements)!=null&&Tc.get("math-field"))){(ys=window[Ym=Symbol.for("io.cortexjs.mathlive")])!=null||(window[Ym]={});const r=window[Symbol.for("io.cortexjs.mathlive")];r.version="0.98.5",window.MathfieldElement=mf,(Dy=window.customElements)==null||Dy.define("math-field",mf)}function wx(r,o,u){let d=u,g=0;const b=r.length;for(;d<o.length;){const M=o[d];if(g<=0&&o.slice(d,d+b)===r)return d;M==="\\"?d++:M==="{"?g++:M==="}"&&g--,d++}return-1}function Sv(r,o,u,d,g="latex"){const b=[];for(const M of r)if(M.type==="text"){const N=M.data;let I=!0,F=0,$;$=N.indexOf(o),$!==-1&&(F=$,F>0&&b.push({type:"text",data:N.slice(0,F)}),I=!1);let it=!1;for(;!it;){if(I){if($=N.indexOf(o,F),$===-1){it=!0;break}F!==$&&b.push({type:"text",data:N.slice(F,$)}),F=$}else{if($=wx(u,N,F+o.length),$===-1){it=!0;break}let gt=N.slice(F+o.length,$);g==="ascii-math"&&([,gt]=qc(gt,{format:"ascii-math"})),b.push({type:"math",data:gt,rawData:N.slice(F,$+u.length),mathstyle:d}),F=$+u.length}I=!I}F<N.length&&b.push({type:"text",data:N.slice(F)})}else b.push(M);return b}function O1(r,o,u){let d=[{type:"text",data:r}];return o!=null&&o.inline&&o.inline.forEach(([g,b])=>{d=Sv(d,g,b,"textstyle")}),o!=null&&o.display&&o.display.forEach(([g,b])=>{d=Sv(d,g,b,"displaystyle")}),u!=null&&u.inline&&u.inline.forEach(([g,b])=>{d=Sv(d,g,b,"textstyle","ascii-math")}),u!=null&&u.display&&u.display.forEach(([g,b])=>{d=Sv(d,g,b,"displaystyle","ascii-math")}),d}function bx(r,o){const u=document.createElement("span");u.setAttribute("translate","no");try{const d="<math xmlns='http://www.w3.org/1998/Math/MathML'>"+o.renderToMathML(r)+"</math>";u.innerHTML=window.MathfieldElement.createHTML(d)}catch(d){console.error(`MathLive 0.98.5: Could not convert "${r}"' to MathML with ${d}`),u.textContent=r}return u.className="ML__sr-only",u}function B1(r,o,u,d){try{const g=o.renderToMarkup(r,{mathstyle:u,format:"html"}),b=document.createElement("span");return b.dataset.latex=r,b.style.display=u==="displaystyle"?"flex":"inline-flex",b.setAttribute("aria-hidden","true"),b.setAttribute("translate","no"),b.innerHTML=window.MathfieldElement.createHTML(g),b}catch(g){if(console.error("Could not parse'"+r+"' with ",g),d)return document.createTextNode(r)}return null}function wp(r,o,u,d){var g;const b=B1(r,u,o||"textstyle",d),M=(g=u.renderAccessibleContent)!=null?g:"";if(b&&/\b(mathml|speakable-text)\b/i.test(M)){const N=document.createElement("span");if(/\bmathml\b/i.test(M)&&u.renderToMathML&&N.append(bx(r,u)),/\bspeakable-text\b/i.test(M)&&u.renderToSpeakableText){const I=document.createElement("span");I.setAttribute("translate","no");const F=u.renderToSpeakableText(r);I.innerHTML=window.MathfieldElement.createHTML(F),I.className="ML__sr-only",N.append(I)}return N.append(b),N}return b}function F1(r,o){var u,d,g;let b=null;if((u=o.TeX)!=null&&u.processEnvironments&&/^\s*\\begin/.test(r)){b=document.createDocumentFragment();const M=wp(r,"",o,!0);M&&b.appendChild(M)}else{if(!r.trim())return null;const M=O1(r,(d=o.TeX)==null?void 0:d.delimiters,(g=o.asciiMath)==null?void 0:g.delimiters);if(M.length===1&&M[0].type==="text")return null;b=document.createDocumentFragment();for(const N of M)if(N.type==="text")b.appendChild(document.createTextNode(N.data));else{const I=wp(N.data,N.mathstyle==="textstyle"?"textstyle":"displaystyle",o,!0);I&&b.appendChild(I)}}return b}function R1(r,o){var u,d,g,b,M,N,I,F,$,it,gt,_t,zt,Ne,Bi,Ee;if(r.childNodes.length===1&&r.childNodes[0].nodeType===3){const hi=(u=r.childNodes[0].textContent)!=null?u:"";if((d=o.TeX)!=null&&d.processEnvironments&&/^\s*\\begin/.test(hi)){r.textContent="";const xi=wp(hi,"",o,!0);xi&&r.append(xi);return}const $i=O1(hi,(g=o.TeX)==null?void 0:g.delimiters,(b=o.asciiMath)==null?void 0:b.delimiters);if($i.length===1&&$i[0].type==="math"){r.textContent="";const xi=wp($i[0].data,$i[0].mathstyle==="textstyle"?"textstyle":"displaystyle",o,!0);xi&&r.append(xi);return}if($i.length===1&&$i[0].type==="text")return}for(let hi=r.childNodes.length-1;hi>=0;hi--){const $i=r.childNodes[hi];if($i.nodeType===3){const xi=F1((M=$i.textContent)!=null?M:"",o);xi&&(hi+=xi.childNodes.length-1,$i.replaceWith(xi))}else if($i.nodeType===1){const xi=$i,bn=$i.nodeName.toLowerCase();if(bn==="script"){const Rn=$i;let En;if((N=o.processScriptTypePattern)!=null&&N.test(Rn.type))En=(I=Rn.textContent)!=null?I:"";else if((F=o.processMathJSONScriptTypePattern)!=null&&F.test(Rn.type))try{En=(it=o.serializeToLatex)==null?void 0:it.call(o,JSON.parse(($=Rn.textContent)!=null?$:""))}catch(Fr){console.error(Fr)}if(En){let Fr="textstyle";for(const Yi of Rn.type.split(";")){const[Nu,Au]=Yi.toLowerCase().split("=");Nu.trim()==="mode"&&(Fr=Au.trim()==="display"?"displaystyle":"textstyle")}const Po=wp(En,Fr,o,!0);Po&&Rn.parentNode.replaceChild(Po,Rn)}}else if(((_t=(gt=o.processClassPattern)==null?void 0:gt.test(xi.className))!=null?_t:!1)||!((Ne=(zt=o.skipTags)==null?void 0:zt.includes(bn))!=null&&Ne||(Ee=(Bi=o.ignoreClassPattern)==null?void 0:Bi.test(xi.className))!=null&&Ee))if(r.childNodes.length===1&&r.childNodes[0].nodeType===3){const En=r.textContent;r.textContent="";const Fr=wp(En!=null?En:"","displaystyle",o,!0);Fr&&r.append(Fr)}else R1(xi,o)}}}var z1={skipTags:["math-field","noscript","style","textarea","pre","code","annotation","annotation-xml"],processScriptType:"math/tex",processMathJSONScriptType:"math/json",ignoreClass:"tex2jax_ignore",processClass:"tex2jax_process",renderAccessibleContent:"mathml",asciiMath:{delimiters:{inline:[["`","`"]]}},TeX:{processEnvironments:!0,delimiters:{inline:[["\\(","\\)"]],display:[["$$","$$"],["\\[","\\]"]]}}};function bp(r,o){var u,d,g,b;try{const M=Q(Q({},z1),o);M.ignoreClassPattern=new RegExp((u=M.ignoreClass)!=null?u:""),M.processClassPattern=new RegExp((d=M.processClass)!=null?d:""),M.processScriptTypePattern=new RegExp((g=M.processScriptType)!=null?g:""),M.processMathJSONScriptTypePattern=new RegExp((b=M.processMathJSONScriptType)!=null?b:""),o0(),Hl("core"),R1(r,M)}catch(M){M instanceof Error?console.error("renderMathInElement(): "+M.message):console.error("renderMathInElement(): Could not render math for element",r)}}function Jm(r,o){const u=tf.singleton;return u?(u.show(),u0(),u.currentLayer=o,u.render(),u.focus(),!0):!1}function qm(){const r=window.mathVirtualKeyboard;return r.visible?r.hide({animate:!0}):r.show({animate:!0}),!1}bs({switchKeyboardLayer:Jm,toggleVirtualKeyboard:qm,hideVirtualKeyboard:()=>(window.mathVirtualKeyboard.hide({animate:!0}),!1),showVirtualKeyboard:()=>(window.mathVirtualKeyboard.show({animate:!0}),!1)},{target:"virtual-keyboard"});function Xh(){var r,o;return(o=globalThis[r=Symbol.for("io.cortexjs.mathlive")])!=null||(globalThis[r]={}),globalThis[Symbol.for("io.cortexjs.mathlive")]}function Zn(){return console.warn("%cMathLive 0.98.5: %cmakeSharedVirtualKeyboard() is deprecated. \n Use `window.mathVirtualKeyboard` to access the virtual keyboard instance.\n See https://cortexjs.io/mathlive/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),window.mathVirtualKeyboard}function j1(r){yl(document.body,r)}function fa(r){if(typeof r=="string"){const o=document.getElementById(r);if(o===null)throw new Error(`The element with ID "${r}" could not be found.`);return o}return typeof r=="string"?null:r}function yl(r,o){var u,d,g,b;const M=fa(r);if(!M)return;const N=o!=null?o:{};(u=N.renderToMarkup)!=null||(N.renderToMarkup=hs),(d=N.renderToMathML)!=null||(N.renderToMathML=ia),(g=N.renderToSpeakableText)!=null||(N.renderToSpeakableText=Ey),(b=N.serializeToLatex)!=null||(N.serializeToLatex=yx),bp(M,N)}var Sx={mathlive:"0.98.5"}},16722:function(qn,Li,G){"use strict";G.d(Li,{Z:function(){return Q}});const Mt=rt=>typeof rt=="object"&&rt!=null&&rt.nodeType===1,kt=(rt,yt)=>(!yt||rt!=="hidden")&&rt!=="visible"&&rt!=="clip",vt=(rt,yt)=>{if(rt.clientHeight<rt.scrollHeight||rt.clientWidth<rt.scrollWidth){const be=getComputedStyle(rt,null);return kt(be.overflowY,yt)||kt(be.overflowX,yt)||(pt=>{const Rt=(Ce=>{if(!Ce.ownerDocument||!Ce.ownerDocument.defaultView)return null;try{return Ce.ownerDocument.defaultView.frameElement}catch(jt){return null}})(pt);return!!Rt&&(Rt.clientHeight<pt.scrollHeight||Rt.clientWidth<pt.scrollWidth)})(rt)}return!1},le=(rt,yt,be,pt,Rt,Ce,jt,Jt)=>Ce<rt&&jt>yt||Ce>rt&&jt<yt?0:Ce<=rt&&Jt<=be||jt>=yt&&Jt>=be?Ce-rt-pt:jt>yt&&Jt<be||Ce<rt&&Jt>be?jt-yt+Rt:0,ut=rt=>{const yt=rt.parentElement;return yt==null?rt.getRootNode().host||null:yt},ft=(rt,yt)=>{var be,pt,Rt,Ce;if(typeof document=="undefined")return[];const{scrollMode:jt,block:Jt,inline:Ht,boundary:de,skipOverflowHiddenElements:De}=yt,$t=typeof de=="function"?de:Me=>Me!==de;if(!Mt(rt))throw new TypeError("Invalid target");const Xt=document.scrollingElement||document.documentElement,Ct=[];let q=rt;for(;Mt(q)&&$t(q);){if(q=ut(q),q===Xt){Ct.push(q);break}q!=null&&q===document.body&&vt(q)&&!vt(document.documentElement)||q!=null&&vt(q,De)&&Ct.push(q)}const Et=(pt=(be=window.visualViewport)==null?void 0:be.width)!=null?pt:innerWidth,Bt=(Ce=(Rt=window.visualViewport)==null?void 0:Rt.height)!=null?Ce:innerHeight,{scrollX:ve,scrollY:Vt}=window,{height:We,width:ee,top:xe,right:Nt,bottom:_e,left:ti}=rt.getBoundingClientRect(),{top:je,right:Be,bottom:Se,left:dt}=(Me=>{const ye=window.getComputedStyle(Me);return{top:parseFloat(ye.scrollMarginTop)||0,right:parseFloat(ye.scrollMarginRight)||0,bottom:parseFloat(ye.scrollMarginBottom)||0,left:parseFloat(ye.scrollMarginLeft)||0}})(rt);let W=Jt==="start"||Jt==="nearest"?xe-je:Jt==="end"?_e+Se:xe+We/2-je+Se,Zt=Ht==="center"?ti+ee/2-dt+Be:Ht==="end"?Nt+Be:ti-dt;const ze=[];for(let Me=0;Me<Ct.length;Me++){const ye=Ct[Me],{height:se,width:Ue,top:Fi,right:wi,bottom:Ai,left:ri}=ye.getBoundingClientRect();if(jt==="if-needed"&&xe>=0&&ti>=0&&_e<=Bt&&Nt<=Et&&(ye===Xt&&!vt(ye)||xe>=Fi&&_e<=Ai&&ti>=ri&&Nt<=wi))return ze;const sn=getComputedStyle(ye),Zi=parseInt(sn.borderLeftWidth,10),j=parseInt(sn.borderTopWidth,10),P=parseInt(sn.borderRightWidth,10),E=parseInt(sn.borderBottomWidth,10);let B=0,U=0;const D="offsetWidth"in ye?ye.offsetWidth-ye.clientWidth-Zi-P:0,St="offsetHeight"in ye?ye.offsetHeight-ye.clientHeight-j-E:0,ae="offsetWidth"in ye?ye.offsetWidth===0?0:Ue/ye.offsetWidth:0,$e="offsetHeight"in ye?ye.offsetHeight===0?0:se/ye.offsetHeight:0;if(Xt===ye)B=Jt==="start"?W:Jt==="end"?W-Bt:Jt==="nearest"?le(Vt,Vt+Bt,Bt,j,E,Vt+W,Vt+W+We,We):W-Bt/2,U=Ht==="start"?Zt:Ht==="center"?Zt-Et/2:Ht==="end"?Zt-Et:le(ve,ve+Et,Et,Zi,P,ve+Zt,ve+Zt+ee,ee),B=Math.max(0,B+Vt),U=Math.max(0,U+ve);else{B=Jt==="start"?W-Fi-j:Jt==="end"?W-Ai+E+St:Jt==="nearest"?le(Fi,Ai,se,j,E+St,W,W+We,We):W-(Fi+se/2)+St/2,U=Ht==="start"?Zt-ri-Zi:Ht==="center"?Zt-(ri+Ue/2)+D/2:Ht==="end"?Zt-wi+P+D:le(ri,wi,Ue,Zi,P+D,Zt,Zt+ee,ee);const{scrollLeft:Ae,scrollTop:Qe}=ye;B=$e===0?0:Math.max(0,Math.min(Qe+B/$e,ye.scrollHeight-se/$e+St)),U=ae===0?0:Math.max(0,Math.min(Ae+U/ae,ye.scrollWidth-Ue/ae+D)),W+=Qe-B,Zt+=Ae-U}ze.push({el:ye,top:B,left:U})}return ze},Pt=rt=>rt===!1?{block:"end",inline:"nearest"}:(yt=>yt===Object(yt)&&Object.keys(yt).length!==0)(rt)?rt:{block:"start",inline:"nearest"};function Q(rt,yt){if(!rt.isConnected||!(Rt=>{let Ce=Rt;for(;Ce&&Ce.parentNode;){if(Ce.parentNode===document)return!0;Ce=Ce.parentNode instanceof ShadowRoot?Ce.parentNode.host:Ce.parentNode}return!1})(rt))return;const be=(Rt=>{const Ce=window.getComputedStyle(Rt);return{top:parseFloat(Ce.scrollMarginTop)||0,right:parseFloat(Ce.scrollMarginRight)||0,bottom:parseFloat(Ce.scrollMarginBottom)||0,left:parseFloat(Ce.scrollMarginLeft)||0}})(rt);if((Rt=>typeof Rt=="object"&&typeof Rt.behavior=="function")(yt))return yt.behavior(ft(rt,yt));const pt=typeof yt=="boolean"||yt==null?void 0:yt.behavior;for(const{el:Rt,top:Ce,left:jt}of ft(rt,Pt(yt))){const Jt=Ce-be.top+be.bottom,Ht=jt-be.left+be.right;Rt.scroll({top:Jt,left:Ht,behavior:pt})}}}}]);
}());